Skip to content

Commit 619a928

Browse files
authored
Merge pull request #194 from XeroAPI/sid-development
Updates to Accounting and Assets v2.0.7 of OAS
2 parents 7463d8f + 51afa51 commit 619a928

238 files changed

Lines changed: 432 additions & 538 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 & 2 deletions
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.0</version>
8+
<version>3.5.1</version>
99
<url>https://github.com/XeroAPI/Xero-Java</url>
1010
<description>This is the official Java SDK for Xero API</description>
1111
<licenses>
@@ -87,7 +87,6 @@
8787
<artifactId>log4j-core</artifactId>
8888
<version>2.11.0</version>
8989
</dependency>
90-
9190
<!-- JSON processing: jackson -->
9291
<dependency>
9392
<groupId>com.fasterxml.jackson.core</groupId>

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

Lines changed: 69 additions & 67 deletions
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.0";
94+
private String version = "3.5.1";
9595

9696
public AccountingApi() {
9797
this(new ApiClient());
@@ -9986,6 +9986,74 @@ public HttpResponse getQuoteForHttpResponse(String accessToken, String xeroTena
99869986
GenericUrl genericUrl = new GenericUrl(url);
99879987

99889988

9989+
HttpContent content = null;
9990+
Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken);
9991+
HttpTransport transport = apiClient.getHttpTransport();
9992+
HttpRequestFactory requestFactory = transport.createRequestFactory(credential);
9993+
return requestFactory.buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers)
9994+
.setConnectTimeout(apiClient.getConnectionTimeout())
9995+
.setReadTimeout(apiClient.getReadTimeout()).execute();
9996+
}
9997+
9998+
/**
9999+
* Allows you to retrieve quotes as PDF files
10000+
* <p><b>200</b> - Success - return response of byte array pdf version of specified Quotes
10001+
* @param xeroTenantId Xero identifier for Tenant
10002+
* @param quoteID Unique identifier for an Quote
10003+
* @param accessToken Authorization token for user set in header of each request
10004+
* @return File
10005+
* @throws IOException if an error occurs while attempting to invoke the API
10006+
**/
10007+
public ByteArrayInputStream getQuoteAsPdf(String accessToken, String xeroTenantId, UUID quoteID) throws IOException {
10008+
try {
10009+
TypeReference<File> typeRef = new TypeReference<File>() {};
10010+
HttpResponse response = getQuoteAsPdfForHttpResponse(accessToken, xeroTenantId, quoteID);
10011+
InputStream is = response.getContent();
10012+
return convertInputToByteArray(is);
10013+
10014+
} catch (HttpResponseException e) {
10015+
XeroApiExceptionHandler handler = new XeroApiExceptionHandler();
10016+
handler.execute(e,apiClient);
10017+
} catch (IOException ioe) {
10018+
throw ioe;
10019+
}
10020+
return null;
10021+
}
10022+
10023+
public HttpResponse getQuoteAsPdfForHttpResponse(String accessToken, String xeroTenantId, UUID quoteID) throws IOException {
10024+
// verify the required parameter 'xeroTenantId' is set
10025+
if (xeroTenantId == null) {
10026+
throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getQuoteAsPdf");
10027+
}// verify the required parameter 'quoteID' is set
10028+
if (quoteID == null) {
10029+
throw new IllegalArgumentException("Missing the required parameter 'quoteID' when calling getQuoteAsPdf");
10030+
}
10031+
if (accessToken == null) {
10032+
throw new IllegalArgumentException("Missing the required parameter 'accessToken' when calling getQuoteAsPdf");
10033+
}
10034+
HttpHeaders headers = new HttpHeaders();
10035+
headers.set("xero-tenant-id", xeroTenantId);
10036+
headers.setAccept("application/json");
10037+
headers.setUserAgent(this.getUserAgent());
10038+
10039+
String correctPath = "/Quotes/{QuotesID}/pdf";
10040+
10041+
// Hacky path manipulation to support different return types from same endpoint
10042+
String path = "/Quotes/{QuotesID}/pdf";
10043+
String type = "/pdf";
10044+
if(path.toLowerCase().contains(type.toLowerCase())) {
10045+
correctPath = path.replace("/pdf","");
10046+
headers.setAccept("application/pdf");
10047+
}
10048+
// create a map of path variables
10049+
final Map<String, Object> uriVariables = new HashMap<String, Object>();
10050+
uriVariables.put("QuoteID", quoteID);
10051+
10052+
UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath);
10053+
String url = uriBuilder.buildFromMap(uriVariables).toString();
10054+
GenericUrl genericUrl = new GenericUrl(url);
10055+
10056+
998910057
HttpContent content = null;
999010058
Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken);
999110059
HttpTransport transport = apiClient.getHttpTransport();
@@ -13268,72 +13336,6 @@ public HttpResponse updateCreditNoteAttachmentByFileNameForHttpResponse(String a
1326813336
.setReadTimeout(apiClient.getReadTimeout()).execute();
1326913337
}
1327013338

13271-
/**
13272-
* Allows you to update a specific employee used in Xero payrun
13273-
* <p><b>200</b> - Success - return response of type Employees array with updated Employee
13274-
* <p><b>400</b> - A failed request due to validation error
13275-
* @param xeroTenantId Xero identifier for Tenant
13276-
* @param employeeID Unique identifier for a Employee
13277-
* @param employees The employees parameter
13278-
* @param accessToken Authorization token for user set in header of each request
13279-
* @return Employees
13280-
* @throws IOException if an error occurs while attempting to invoke the API
13281-
**/
13282-
public Employees updateEmployee(String accessToken, String xeroTenantId, UUID employeeID, Employees employees) throws IOException {
13283-
try {
13284-
TypeReference<Employees> typeRef = new TypeReference<Employees>() {};
13285-
HttpResponse response = updateEmployeeForHttpResponse(accessToken, xeroTenantId, employeeID, employees);
13286-
return apiClient.getObjectMapper().readValue(response.getContent(), typeRef);
13287-
} catch (HttpResponseException e) {
13288-
XeroApiExceptionHandler handler = new XeroApiExceptionHandler();
13289-
handler.execute(e,apiClient);
13290-
} catch (IOException ioe) {
13291-
throw ioe;
13292-
}
13293-
return null;
13294-
}
13295-
13296-
public HttpResponse updateEmployeeForHttpResponse(String accessToken, String xeroTenantId, UUID employeeID, Employees employees) throws IOException {
13297-
// verify the required parameter 'xeroTenantId' is set
13298-
if (xeroTenantId == null) {
13299-
throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateEmployee");
13300-
}// verify the required parameter 'employeeID' is set
13301-
if (employeeID == null) {
13302-
throw new IllegalArgumentException("Missing the required parameter 'employeeID' when calling updateEmployee");
13303-
}// verify the required parameter 'employees' is set
13304-
if (employees == null) {
13305-
throw new IllegalArgumentException("Missing the required parameter 'employees' when calling updateEmployee");
13306-
}
13307-
if (accessToken == null) {
13308-
throw new IllegalArgumentException("Missing the required parameter 'accessToken' when calling updateEmployee");
13309-
}
13310-
HttpHeaders headers = new HttpHeaders();
13311-
headers.set("xero-tenant-id", xeroTenantId);
13312-
headers.setAccept("application/json");
13313-
headers.setUserAgent(this.getUserAgent());
13314-
13315-
String correctPath = "/Employees/{EmployeeID}";
13316-
13317-
// create a map of path variables
13318-
final Map<String, Object> uriVariables = new HashMap<String, Object>();
13319-
uriVariables.put("EmployeeID", employeeID);
13320-
13321-
UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath);
13322-
String url = uriBuilder.buildFromMap(uriVariables).toString();
13323-
GenericUrl genericUrl = new GenericUrl(url);
13324-
13325-
13326-
HttpContent content = null;
13327-
content = apiClient.new JacksonJsonHttpContent(employees);
13328-
13329-
Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken);
13330-
HttpTransport transport = apiClient.getHttpTransport();
13331-
HttpRequestFactory requestFactory = transport.createRequestFactory(credential);
13332-
return requestFactory.buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers)
13333-
.setConnectTimeout(apiClient.getConnectionTimeout())
13334-
.setReadTimeout(apiClient.getReadTimeout()).execute();
13335-
}
13336-
1333713339
/**
1333813340
* Allows you to update specified expense claims
1333913341
* <p><b>200</b> - Success - return response of type ExpenseClaims array with updated ExpenseClaim

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

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

44
import com.xero.models.assets.Asset;
5+
import com.xero.models.assets.AssetStatus;
56
import com.xero.models.assets.AssetType;
67
import com.xero.models.assets.Assets;
78
import com.xero.models.assets.Setting;
@@ -44,7 +45,7 @@ public class AssetApi {
4445
private ApiClient apiClient;
4546
private static AssetApi instance = null;
4647
private String userAgent = "Default";
47-
private String version = "3.5.0";
48+
private String version = "3.5.1";
4849

4950
public AssetApi() {
5051
this(new ApiClient());
@@ -365,7 +366,7 @@ public HttpResponse getAssetTypesForHttpResponse(String accessToken, String xer
365366
* @return Assets
366367
* @throws IOException if an error occurs while attempting to invoke the API
367368
**/
368-
public Assets getAssets(String accessToken, String xeroTenantId, String status, Integer page, Integer pageSize, String orderBy, String sortDirection, String filterBy) throws IOException {
369+
public Assets getAssets(String accessToken, String xeroTenantId, AssetStatus status, Integer page, Integer pageSize, String orderBy, String sortDirection, String filterBy) throws IOException {
369370
try {
370371
TypeReference<Assets> typeRef = new TypeReference<Assets>() {};
371372
HttpResponse response = getAssetsForHttpResponse(accessToken, xeroTenantId, status, page, pageSize, orderBy, sortDirection, filterBy);
@@ -379,7 +380,7 @@ public Assets getAssets(String accessToken, String xeroTenantId, String status,
379380
return null;
380381
}
381382

382-
public HttpResponse getAssetsForHttpResponse(String accessToken, String xeroTenantId, String status, Integer page, Integer pageSize, String orderBy, String sortDirection, String filterBy) throws IOException {
383+
public HttpResponse getAssetsForHttpResponse(String accessToken, String xeroTenantId, AssetStatus status, Integer page, Integer pageSize, String orderBy, String sortDirection, String filterBy) throws IOException {
383384
// verify the required parameter 'xeroTenantId' is set
384385
if (xeroTenantId == null) {
385386
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.0";
48+
private String version = "3.5.1";
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.0";
44+
private String version = "3.5.1";
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.0";
62+
private String version = "3.5.1";
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.0";
55+
private String version = "3.5.1";
5656

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

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

Lines changed: 3 additions & 3 deletions
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.5
5+
* The version of the OpenAPI document: 2.0.7
66
* Contact: api@xero.com
77
*
88
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
@@ -302,7 +302,7 @@ public static SystemAccountEnum fromValue(String value) {
302302

303303

304304
@JsonProperty("HasAttachments")
305-
private Boolean hasAttachments;
305+
private Boolean hasAttachments = false;
306306

307307
@JsonDeserialize(using = com.xero.api.CustomOffsetDateTimeDeserializer.class)
308308
@JsonProperty("UpdatedDateUTC")
@@ -571,7 +571,7 @@ public String getReportingCodeName() {
571571
* boolean to indicate if an account has an attachment (read only)
572572
* @return hasAttachments
573573
**/
574-
@ApiModelProperty(value = "boolean to indicate if an account has an attachment (read only)")
574+
@ApiModelProperty(example = "false", value = "boolean to indicate if an account has an attachment (read only)")
575575
public Boolean getHasAttachments() {
576576
return hasAttachments;
577577
}

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.5
5+
* The version of the OpenAPI document: 2.0.7
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.5
5+
* The version of the OpenAPI document: 2.0.7
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)