Skip to content

Commit 8e3dd44

Browse files
authored
Merge pull request #196 from XeroAPI/sid-development
Build from OAS 2.0.8
2 parents 619a928 + e4cb6cc commit 8e3dd44

241 files changed

Lines changed: 967 additions & 244 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<artifactId>xero-java</artifactId>
66
<packaging>jar</packaging>
77
<name>xero-java</name>
8-
<version>3.5.1</version>
8+
<version>3.5.2</version>
99
<url>https://github.com/XeroAPI/Xero-Java</url>
1010
<description>This is the official Java SDK for Xero API</description>
1111
<licenses>

src/main/java/com/xero/api/client/AccountingApi.java

Lines changed: 69 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ public class AccountingApi {
9191
private ApiClient apiClient;
9292
private static AccountingApi instance = null;
9393
private String userAgent = "Default";
94-
private String version = "3.5.1";
94+
private String version = "3.5.2";
9595

9696
public AccountingApi() {
9797
this(new ApiClient());
@@ -9699,6 +9699,74 @@ public HttpResponse getPurchaseOrderForHttpResponse(String accessToken, String
96999699
GenericUrl genericUrl = new GenericUrl(url);
97009700

97019701

9702+
HttpContent content = null;
9703+
Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken);
9704+
HttpTransport transport = apiClient.getHttpTransport();
9705+
HttpRequestFactory requestFactory = transport.createRequestFactory(credential);
9706+
return requestFactory.buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers)
9707+
.setConnectTimeout(apiClient.getConnectionTimeout())
9708+
.setReadTimeout(apiClient.getReadTimeout()).execute();
9709+
}
9710+
9711+
/**
9712+
* Allows you to retrieve purchase orders as PDF files
9713+
* <p><b>200</b> - Success - return response of byte array pdf version of specified Purchase Orders
9714+
* @param xeroTenantId Xero identifier for Tenant
9715+
* @param purchaseOrderID Unique identifier for an Purchase Order
9716+
* @param accessToken Authorization token for user set in header of each request
9717+
* @return File
9718+
* @throws IOException if an error occurs while attempting to invoke the API
9719+
**/
9720+
public ByteArrayInputStream getPurchaseOrderAsPdf(String accessToken, String xeroTenantId, UUID purchaseOrderID) throws IOException {
9721+
try {
9722+
TypeReference<File> typeRef = new TypeReference<File>() {};
9723+
HttpResponse response = getPurchaseOrderAsPdfForHttpResponse(accessToken, xeroTenantId, purchaseOrderID);
9724+
InputStream is = response.getContent();
9725+
return convertInputToByteArray(is);
9726+
9727+
} catch (HttpResponseException e) {
9728+
XeroApiExceptionHandler handler = new XeroApiExceptionHandler();
9729+
handler.execute(e,apiClient);
9730+
} catch (IOException ioe) {
9731+
throw ioe;
9732+
}
9733+
return null;
9734+
}
9735+
9736+
public HttpResponse getPurchaseOrderAsPdfForHttpResponse(String accessToken, String xeroTenantId, UUID purchaseOrderID) throws IOException {
9737+
// verify the required parameter 'xeroTenantId' is set
9738+
if (xeroTenantId == null) {
9739+
throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getPurchaseOrderAsPdf");
9740+
}// verify the required parameter 'purchaseOrderID' is set
9741+
if (purchaseOrderID == null) {
9742+
throw new IllegalArgumentException("Missing the required parameter 'purchaseOrderID' when calling getPurchaseOrderAsPdf");
9743+
}
9744+
if (accessToken == null) {
9745+
throw new IllegalArgumentException("Missing the required parameter 'accessToken' when calling getPurchaseOrderAsPdf");
9746+
}
9747+
HttpHeaders headers = new HttpHeaders();
9748+
headers.set("xero-tenant-id", xeroTenantId);
9749+
headers.setAccept("application/json");
9750+
headers.setUserAgent(this.getUserAgent());
9751+
9752+
String correctPath = "/PurchaseOrders/{PurchaseOrderID}/pdf";
9753+
9754+
// Hacky path manipulation to support different return types from same endpoint
9755+
String path = "/PurchaseOrders/{PurchaseOrderID}/pdf";
9756+
String type = "/pdf";
9757+
if(path.toLowerCase().contains(type.toLowerCase())) {
9758+
correctPath = path.replace("/pdf","");
9759+
headers.setAccept("application/pdf");
9760+
}
9761+
// create a map of path variables
9762+
final Map<String, Object> uriVariables = new HashMap<String, Object>();
9763+
uriVariables.put("PurchaseOrderID", purchaseOrderID);
9764+
9765+
UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath);
9766+
String url = uriBuilder.buildFromMap(uriVariables).toString();
9767+
GenericUrl genericUrl = new GenericUrl(url);
9768+
9769+
97029770
HttpContent content = null;
97039771
Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken);
97049772
HttpTransport transport = apiClient.getHttpTransport();

src/main/java/com/xero/api/client/AssetApi.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import com.xero.api.ApiClient;
33

44
import com.xero.models.assets.Asset;
5-
import com.xero.models.assets.AssetStatus;
5+
import com.xero.models.assets.AssetStatusQueryParam;
66
import com.xero.models.assets.AssetType;
77
import com.xero.models.assets.Assets;
88
import com.xero.models.assets.Setting;
@@ -45,7 +45,7 @@ public class AssetApi {
4545
private ApiClient apiClient;
4646
private static AssetApi instance = null;
4747
private String userAgent = "Default";
48-
private String version = "3.5.1";
48+
private String version = "3.5.2";
4949

5050
public AssetApi() {
5151
this(new ApiClient());
@@ -366,7 +366,7 @@ public HttpResponse getAssetTypesForHttpResponse(String accessToken, String xer
366366
* @return Assets
367367
* @throws IOException if an error occurs while attempting to invoke the API
368368
**/
369-
public Assets getAssets(String accessToken, String xeroTenantId, AssetStatus status, Integer page, Integer pageSize, String orderBy, String sortDirection, String filterBy) throws IOException {
369+
public Assets getAssets(String accessToken, String xeroTenantId, AssetStatusQueryParam status, Integer page, Integer pageSize, String orderBy, String sortDirection, String filterBy) throws IOException {
370370
try {
371371
TypeReference<Assets> typeRef = new TypeReference<Assets>() {};
372372
HttpResponse response = getAssetsForHttpResponse(accessToken, xeroTenantId, status, page, pageSize, orderBy, sortDirection, filterBy);
@@ -380,7 +380,7 @@ public Assets getAssets(String accessToken, String xeroTenantId, AssetStatus st
380380
return null;
381381
}
382382

383-
public HttpResponse getAssetsForHttpResponse(String accessToken, String xeroTenantId, AssetStatus status, Integer page, Integer pageSize, String orderBy, String sortDirection, String filterBy) throws IOException {
383+
public HttpResponse getAssetsForHttpResponse(String accessToken, String xeroTenantId, AssetStatusQueryParam status, Integer page, Integer pageSize, String orderBy, String sortDirection, String filterBy) throws IOException {
384384
// verify the required parameter 'xeroTenantId' is set
385385
if (xeroTenantId == null) {
386386
throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getAssets");

src/main/java/com/xero/api/client/BankFeedsApi.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public class BankFeedsApi {
4545
private ApiClient apiClient;
4646
private static BankFeedsApi instance = null;
4747
private String userAgent = "Default";
48-
private String version = "3.5.1";
48+
private String version = "3.5.2";
4949

5050
public BankFeedsApi() {
5151
this(new ApiClient());

src/main/java/com/xero/api/client/IdentityApi.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public class IdentityApi {
4141
private ApiClient apiClient;
4242
private static IdentityApi instance = null;
4343
private String userAgent = "Default";
44-
private String version = "3.5.1";
44+
private String version = "3.5.2";
4545

4646
public IdentityApi() {
4747
this(new ApiClient());

src/main/java/com/xero/api/client/PayrollAuApi.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public class PayrollAuApi {
5959
private ApiClient apiClient;
6060
private static PayrollAuApi instance = null;
6161
private String userAgent = "Default";
62-
private String version = "3.5.1";
62+
private String version = "3.5.2";
6363

6464
public PayrollAuApi() {
6565
this(new ApiClient());

src/main/java/com/xero/api/client/ProjectApi.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public class ProjectApi {
5252
private ApiClient apiClient;
5353
private static ProjectApi instance = null;
5454
private String userAgent = "Default";
55-
private String version = "3.5.1";
55+
private String version = "3.5.2";
5656

5757
public ProjectApi() {
5858
this(new ApiClient());

src/main/java/com/xero/models/accounting/Account.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* Accounting API
33
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
44
*
5-
* The version of the OpenAPI document: 2.0.7
5+
* The version of the OpenAPI document: 2.0.8
66
* Contact: api@xero.com
77
*
88
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).

src/main/java/com/xero/models/accounting/AccountType.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* Accounting API
33
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
44
*
5-
* The version of the OpenAPI document: 2.0.7
5+
* The version of the OpenAPI document: 2.0.8
66
* Contact: api@xero.com
77
*
88
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).

src/main/java/com/xero/models/accounting/Accounts.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* Accounting API
33
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
44
*
5-
* The version of the OpenAPI document: 2.0.7
5+
* The version of the OpenAPI document: 2.0.8
66
* Contact: api@xero.com
77
*
88
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).

0 commit comments

Comments
 (0)