Skip to content

Commit ca40b73

Browse files
authored
Merge pull request #187 from XeroAPI/sid-development
Updates for OAS 2.0.3
2 parents cd4c771 + db11a53 commit ca40b73

164 files changed

Lines changed: 1013 additions & 172 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.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ Version 3.x of Xero Java SDK only supports oAuth2 authentication and the followi
88
* identity
99
* bank feeds
1010
* fixed asset
11+
* projects
1112
* payroll au (beta)
1213

1314
Coming soon
1415
* payroll nz/uk
15-
* projects
1616
* files
1717
* xero hq
1818

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.3.2</version>
8+
<version>3.4.0</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: 60 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ public class AccountingApi {
9090
private ApiClient apiClient;
9191
private static AccountingApi instance = null;
9292
private String userAgent = "Default";
93-
private String version = "3.3.2";
93+
private String version = "3.4.0";
9494

9595
public AccountingApi() {
9696
this(new ApiClient());
@@ -9698,6 +9698,65 @@ public HttpResponse getPurchaseOrderForHttpResponse(String accessToken, String
96989698
GenericUrl genericUrl = new GenericUrl(url);
96999699

97009700

9701+
HttpContent content = null;
9702+
Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken);
9703+
HttpTransport transport = apiClient.getHttpTransport();
9704+
HttpRequestFactory requestFactory = transport.createRequestFactory(credential);
9705+
return requestFactory.buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers)
9706+
.setConnectTimeout(apiClient.getConnectionTimeout())
9707+
.setReadTimeout(apiClient.getReadTimeout()).execute();
9708+
}
9709+
9710+
/**
9711+
* Allows you to retrieve a specified purchase orders
9712+
* <p><b>200</b> - Success - return response of type PurchaseOrder array for specified PurchaseOrder
9713+
* @param xeroTenantId Xero identifier for Tenant
9714+
* @param purchaseOrderNumber Unique identifier for a PurchaseOrder
9715+
* @param accessToken Authorization token for user set in header of each request
9716+
* @return PurchaseOrders
9717+
* @throws IOException if an error occurs while attempting to invoke the API
9718+
**/
9719+
public PurchaseOrders getPurchaseOrderByNumber(String accessToken, String xeroTenantId, String purchaseOrderNumber) throws IOException {
9720+
try {
9721+
TypeReference<PurchaseOrders> typeRef = new TypeReference<PurchaseOrders>() {};
9722+
HttpResponse response = getPurchaseOrderByNumberForHttpResponse(accessToken, xeroTenantId, purchaseOrderNumber);
9723+
return apiClient.getObjectMapper().readValue(response.getContent(), typeRef);
9724+
} catch (HttpResponseException e) {
9725+
XeroApiExceptionHandler handler = new XeroApiExceptionHandler();
9726+
handler.execute(e,apiClient);
9727+
} catch (IOException ioe) {
9728+
throw ioe;
9729+
}
9730+
return null;
9731+
}
9732+
9733+
public HttpResponse getPurchaseOrderByNumberForHttpResponse(String accessToken, String xeroTenantId, String purchaseOrderNumber) throws IOException {
9734+
// verify the required parameter 'xeroTenantId' is set
9735+
if (xeroTenantId == null) {
9736+
throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getPurchaseOrderByNumber");
9737+
}// verify the required parameter 'purchaseOrderNumber' is set
9738+
if (purchaseOrderNumber == null) {
9739+
throw new IllegalArgumentException("Missing the required parameter 'purchaseOrderNumber' when calling getPurchaseOrderByNumber");
9740+
}
9741+
if (accessToken == null) {
9742+
throw new IllegalArgumentException("Missing the required parameter 'accessToken' when calling getPurchaseOrderByNumber");
9743+
}
9744+
HttpHeaders headers = new HttpHeaders();
9745+
headers.set("xero-tenant-id", xeroTenantId);
9746+
headers.setAccept("application/json");
9747+
headers.setUserAgent(this.getUserAgent());
9748+
9749+
String correctPath = "/PurchaseOrders/{PurchaseOrderNumber}";
9750+
9751+
// create a map of path variables
9752+
final Map<String, Object> uriVariables = new HashMap<String, Object>();
9753+
uriVariables.put("PurchaseOrderNumber", purchaseOrderNumber);
9754+
9755+
UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath);
9756+
String url = uriBuilder.buildFromMap(uriVariables).toString();
9757+
GenericUrl genericUrl = new GenericUrl(url);
9758+
9759+
97019760
HttpContent content = null;
97029761
Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken);
97039762
HttpTransport transport = apiClient.getHttpTransport();

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public class AssetApi {
4444
private ApiClient apiClient;
4545
private static AssetApi instance = null;
4646
private String userAgent = "Default";
47-
private String version = "3.3.2";
47+
private String version = "3.4.0";
4848

4949
public AssetApi() {
5050
this(new ApiClient());

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.3.2";
48+
private String version = "3.4.0";
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.3.2";
44+
private String version = "3.4.0";
4545

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

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

Lines changed: 72 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import com.xero.models.projects.ProjectPatch;
99
import com.xero.models.projects.ProjectUsers;
1010
import com.xero.models.projects.Projects;
11+
import com.xero.models.projects.Task;
1112
import com.xero.models.projects.Tasks;
1213
import com.xero.models.projects.TimeEntries;
1314
import com.xero.models.projects.TimeEntry;
@@ -51,7 +52,7 @@ public class ProjectsApi {
5152
private ApiClient apiClient;
5253
private static ProjectsApi instance = null;
5354
private String userAgent = "Default";
54-
private String version = "3.3.2";
55+
private String version = "3.4.0";
5556

5657
public ProjectsApi() {
5758
this(new ApiClient());
@@ -412,7 +413,7 @@ public HttpResponse getProjectUsersForHttpResponse(String accessToken, String x
412413
* @return Projects
413414
* @throws IOException if an error occurs while attempting to invoke the API
414415
**/
415-
public Projects getProjects(String accessToken, String xeroTenantId, List<UUID> projectIds, UUID contactID, Projects states, Integer page, Integer pageSize) throws IOException {
416+
public Projects getProjects(String accessToken, String xeroTenantId, List<UUID> projectIds, UUID contactID, String states, Integer page, Integer pageSize) throws IOException {
416417
try {
417418
TypeReference<Projects> typeRef = new TypeReference<Projects>() {};
418419
HttpResponse response = getProjectsForHttpResponse(accessToken, xeroTenantId, projectIds, contactID, states, page, pageSize);
@@ -426,7 +427,7 @@ public Projects getProjects(String accessToken, String xeroTenantId, List<UUID>
426427
return null;
427428
}
428429

429-
public HttpResponse getProjectsForHttpResponse(String accessToken, String xeroTenantId, List<UUID> projectIds, UUID contactID, Projects states, Integer page, Integer pageSize) throws IOException {
430+
public HttpResponse getProjectsForHttpResponse(String accessToken, String xeroTenantId, List<UUID> projectIds, UUID contactID, String states, Integer page, Integer pageSize) throws IOException {
430431
// verify the required parameter 'xeroTenantId' is set
431432
if (xeroTenantId == null) {
432433
throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getProjects");
@@ -504,6 +505,70 @@ public HttpResponse getProjectsForHttpResponse(String accessToken, String xeroT
504505
.setReadTimeout(apiClient.getReadTimeout()).execute();
505506
}
506507

508+
/**
509+
* Allows you to retrieve a single project
510+
* Allows you to retrieve a specific project
511+
* <p><b>200</b> - OK/success, returns a list of task objects
512+
* @param xeroTenantId Xero identifier for Tenant
513+
* @param projectId You can specify an individual project by appending the projectId to the endpoint
514+
* @param taskId You can specify an individual task by appending the taskId to the endpoint, i.e. GET https://.../tasks/{taskId}
515+
* @param accessToken Authorization token for user set in header of each request
516+
* @return Task
517+
* @throws IOException if an error occurs while attempting to invoke the API
518+
**/
519+
public Task getTask(String accessToken, String xeroTenantId, UUID projectId, UUID taskId) throws IOException {
520+
try {
521+
TypeReference<Task> typeRef = new TypeReference<Task>() {};
522+
HttpResponse response = getTaskForHttpResponse(accessToken, xeroTenantId, projectId, taskId);
523+
return apiClient.getObjectMapper().readValue(response.getContent(), typeRef);
524+
} catch (HttpResponseException e) {
525+
XeroApiExceptionHandler handler = new XeroApiExceptionHandler();
526+
handler.execute(e,apiClient);
527+
} catch (IOException ioe) {
528+
throw ioe;
529+
}
530+
return null;
531+
}
532+
533+
public HttpResponse getTaskForHttpResponse(String accessToken, String xeroTenantId, UUID projectId, UUID taskId) throws IOException {
534+
// verify the required parameter 'xeroTenantId' is set
535+
if (xeroTenantId == null) {
536+
throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getTask");
537+
}// verify the required parameter 'projectId' is set
538+
if (projectId == null) {
539+
throw new IllegalArgumentException("Missing the required parameter 'projectId' when calling getTask");
540+
}// verify the required parameter 'taskId' is set
541+
if (taskId == null) {
542+
throw new IllegalArgumentException("Missing the required parameter 'taskId' when calling getTask");
543+
}
544+
if (accessToken == null) {
545+
throw new IllegalArgumentException("Missing the required parameter 'accessToken' when calling getTask");
546+
}
547+
HttpHeaders headers = new HttpHeaders();
548+
headers.set("Xero-Tenant-Id", xeroTenantId);
549+
headers.setAccept("application/json");
550+
headers.setUserAgent(this.getUserAgent());
551+
552+
String correctPath = "/projects/{projectId}/tasks/{taskId}";
553+
554+
// create a map of path variables
555+
final Map<String, Object> uriVariables = new HashMap<String, Object>();
556+
uriVariables.put("projectId", projectId);
557+
uriVariables.put("taskId", taskId);
558+
559+
UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath);
560+
String url = uriBuilder.buildFromMap(uriVariables).toString();
561+
GenericUrl genericUrl = new GenericUrl(url);
562+
HttpContent content = null;
563+
Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken);
564+
HttpTransport transport = apiClient.getHttpTransport();
565+
HttpRequestFactory requestFactory = transport.createRequestFactory(credential);
566+
567+
return requestFactory.buildRequest(HttpMethods.GET, genericUrl, content).setHeaders(headers)
568+
.setConnectTimeout(apiClient.getConnectionTimeout())
569+
.setReadTimeout(apiClient.getReadTimeout()).execute();
570+
}
571+
507572
/**
508573
* Allows you to retrieve a single project
509574
* Allows you to retrieve a specific project
@@ -512,7 +577,7 @@ public HttpResponse getProjectsForHttpResponse(String accessToken, String xeroT
512577
* @param projectId You can specify an individual project by appending the projectId to the endpoint
513578
* @param page Set to 1 by default. The requested number of the page in paged response - Must be a number greater than 0.
514579
* @param pageSize Optional, it is set to 50 by default. The number of items to return per page in a paged response - Must be a number between 1 and 500.
515-
* @param taskIds taskIdsSearch for all tasks that match a comma separated list of taskIds, i.e. GET https://.../tasks?taskIds&#x3D;{taskId},{taskId}
580+
* @param taskIds taskIds Search for all tasks that match a comma separated list of taskIds, i.e. GET https://.../tasks?taskIds&#x3D;{taskId},{taskId}
516581
* @param accessToken Authorization token for user set in header of each request
517582
* @return Tasks
518583
* @throws IOException if an error occurs while attempting to invoke the API
@@ -609,15 +674,15 @@ public HttpResponse getTasksForHttpResponse(String accessToken, String xeroTena
609674
* @param contactId Finds all time entries for this contact identifier.
610675
* @param page Set to 1 by default. The requested number of the page in paged response - Must be a number greater than 0.
611676
* @param pageSize Optional, it is set to 50 by default. The number of items to return per page in a paged response - Must be a number between 1 and 500.
612-
* @param states Comma-separated list of states to find. Will find all time entries that are in the status of whatever’s specified.
677+
* @param states Comma-separated list of states to find. Will find all time entries that are in the status of whatever’s specified.
613678
* @param isChargeable Finds all time entries which relate to tasks with the charge type &#x60;TIME&#x60; or &#x60;FIXED&#x60;.
614679
* @param dateAfterUtc ISO 8601 UTC date. Finds all time entries on or after this date filtered on the &#x60;dateUtc&#x60; field.
615680
* @param dateBeforeUtc ISO 8601 UTC date. Finds all time entries on or before this date filtered on the &#x60;dateUtc&#x60; field.
616681
* @param accessToken Authorization token for user set in header of each request
617682
* @return TimeEntries
618683
* @throws IOException if an error occurs while attempting to invoke the API
619684
**/
620-
public TimeEntries getTimeEntries(String accessToken, String xeroTenantId, UUID projectId, UUID userId, UUID taskId, UUID invoiceId, UUID contactId, Integer page, Integer pageSize, String states, Boolean isChargeable, OffsetDateTime dateAfterUtc, OffsetDateTime dateBeforeUtc) throws IOException {
685+
public TimeEntries getTimeEntries(String accessToken, String xeroTenantId, UUID projectId, UUID userId, UUID taskId, UUID invoiceId, UUID contactId, Integer page, Integer pageSize, List<String> states, Boolean isChargeable, OffsetDateTime dateAfterUtc, OffsetDateTime dateBeforeUtc) throws IOException {
621686
try {
622687
TypeReference<TimeEntries> typeRef = new TypeReference<TimeEntries>() {};
623688
HttpResponse response = getTimeEntriesForHttpResponse(accessToken, xeroTenantId, projectId, userId, taskId, invoiceId, contactId, page, pageSize, states, isChargeable, dateAfterUtc, dateBeforeUtc);
@@ -631,7 +696,7 @@ public TimeEntries getTimeEntries(String accessToken, String xeroTenantId, UUID
631696
return null;
632697
}
633698

634-
public HttpResponse getTimeEntriesForHttpResponse(String accessToken, String xeroTenantId, UUID projectId, UUID userId, UUID taskId, UUID invoiceId, UUID contactId, Integer page, Integer pageSize, String states, Boolean isChargeable, OffsetDateTime dateAfterUtc, OffsetDateTime dateBeforeUtc) throws IOException {
699+
public HttpResponse getTimeEntriesForHttpResponse(String accessToken, String xeroTenantId, UUID projectId, UUID userId, UUID taskId, UUID invoiceId, UUID contactId, Integer page, Integer pageSize, List<String> states, Boolean isChargeable, OffsetDateTime dateAfterUtc, OffsetDateTime dateBeforeUtc) throws IOException {
635700
// verify the required parameter 'xeroTenantId' is set
636701
if (xeroTenantId == null) {
637702
throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getTimeEntries");

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