Skip to content

Commit 0ead3dc

Browse files
authored
Merge pull request #275 from XeroAPI/sid-development
Build from OAS 2.10.3
2 parents 6a7086c + 94bd4e7 commit 0ead3dc

File tree

14 files changed

+218
-66
lines changed

14 files changed

+218
-66
lines changed

docs/v4/accounting/index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6396,9 +6396,9 @@ <h1>Xero Accounting API</h1>
63966396
<div id="header">
63976397
<div id="api-_">
63986398
<h2 id="welcome-to-apidoc">API and SDK Documentation</h2>
6399-
<div class="app-desc">Version: 4.8.1</div>
6399+
<div class="app-desc">Version: 4.8.2</div>
64006400
<!--
6401-
<div class="app-desc">Version: 2.10.1</div>
6401+
<div class="app-desc">Version: 2.10.3</div>
64026402
<hr>
64036403
<div id="app-description" class="app-desc">
64046404
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)

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>4.8.1</version>
8+
<version>4.8.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: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* Xero 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.10.1
5+
* The version of the OpenAPI document: 2.10.3
66
* Contact: [email protected]
77
*
88
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
@@ -98,7 +98,7 @@ public class AccountingApi {
9898
private ApiClient apiClient;
9999
private static AccountingApi instance = null;
100100
private String userAgent = "Default";
101-
private String version = "4.8.1";
101+
private String version = "4.8.2";
102102
static final Logger logger = LoggerFactory.getLogger(AccountingApi.class);
103103

104104
/** AccountingApi */

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* Xero Assets API
33
* The Assets API exposes fixed asset related functions of the Xero Accounting application and can be used for a variety of purposes such as creating assets, retrieving asset valuations etc.
44
*
5-
* The version of the OpenAPI document: 2.10.1
5+
* The version of the OpenAPI document: 2.10.3
66
* Contact: [email protected]
77
*
88
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
@@ -48,7 +48,7 @@ public class AssetApi {
4848
private ApiClient apiClient;
4949
private static AssetApi instance = null;
5050
private String userAgent = "Default";
51-
private String version = "4.8.1";
51+
private String version = "4.8.2";
5252
static final Logger logger = LoggerFactory.getLogger(AssetApi.class);
5353

5454
/** AssetApi */

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

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* Xero Bank Feeds API
33
* The Bank Feeds API is a closed API that is only available to financial institutions that have an established financial services partnership with Xero. If you're an existing financial services partner that wants access, contact your local Partner Manager. If you're a financial institution who wants to provide bank feeds to your business customers, contact us to become a financial services partner.
44
*
5-
* The version of the OpenAPI document: 2.10.1
5+
* The version of the OpenAPI document: 2.10.3
66
* Contact: [email protected]
77
*
88
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
@@ -46,7 +46,7 @@ public class BankFeedsApi {
4646
private ApiClient apiClient;
4747
private static BankFeedsApi instance = null;
4848
private String userAgent = "Default";
49-
private String version = "4.8.1";
49+
private String version = "4.8.2";
5050
static final Logger logger = LoggerFactory.getLogger(BankFeedsApi.class);
5151

5252
/** BankFeedsApi */
@@ -118,9 +118,7 @@ public String getUserAgent() {
118118
*
119119
* <p><b>202</b> - success new feed connection(s)response
120120
*
121-
* <p><b>400</b> - invalid input, object invalid
122-
*
123-
* <p><b>409</b> - failed to create new feed connection(s)response
121+
* <p><b>400</b> - failed to create new feed connection(s)response
124122
*
125123
* @param xeroTenantId Xero identifier for Tenant
126124
* @param feedConnections Feed Connection(s) array object in the body
@@ -164,9 +162,7 @@ public FeedConnections createFeedConnections(
164162
*
165163
* <p><b>202</b> - success new feed connection(s)response
166164
*
167-
* <p><b>400</b> - invalid input, object invalid
168-
*
169-
* <p><b>409</b> - failed to create new feed connection(s)response
165+
* <p><b>400</b> - failed to create new feed connection(s)response
170166
*
171167
* @param xeroTenantId Xero identifier for Tenant
172168
* @param feedConnections Feed Connection(s) array object in the body

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

Lines changed: 170 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* Xero Files API
33
* These endpoints are specific to Xero Files API
44
*
5-
* The version of the OpenAPI document: 2.10.1
5+
* The version of the OpenAPI document: 2.10.3
66
* Contact: [email protected]
77
*
88
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
@@ -53,7 +53,7 @@ public class FilesApi {
5353
private ApiClient apiClient;
5454
private static FilesApi instance = null;
5555
private String userAgent = "Default";
56-
private String version = "4.8.1";
56+
private String version = "4.8.2";
5757
static final Logger logger = LoggerFactory.getLogger(FilesApi.class);
5858

5959
/** FilesApi */
@@ -1493,14 +1493,13 @@ public HttpResponse updateFolderForHttpResponse(
14931493
}
14941494

14951495
/**
1496-
* Uploads a File
1496+
* Uploads a File to the inbox
14971497
*
14981498
* <p><b>201</b> - A successful request
14991499
*
15001500
* <p><b>400</b> - invalid input, object invalid
15011501
*
15021502
* @param xeroTenantId Xero identifier for Tenant
1503-
* @param folderId pass an optional folder id to save file to specific folder
15041503
* @param body The body parameter
15051504
* @param name exact name of the file you are uploading
15061505
* @param filename The filename parameter
@@ -1512,7 +1511,6 @@ public HttpResponse updateFolderForHttpResponse(
15121511
public FileObject uploadFile(
15131512
String accessToken,
15141513
String xeroTenantId,
1515-
UUID folderId,
15161514
File body,
15171515
String name,
15181516
String filename,
@@ -1521,8 +1519,7 @@ public FileObject uploadFile(
15211519
try {
15221520
TypeReference<FileObject> typeRef = new TypeReference<FileObject>() {};
15231521
HttpResponse response =
1524-
uploadFileForHttpResponse(
1525-
accessToken, xeroTenantId, folderId, body, name, filename, mimeType);
1522+
uploadFileForHttpResponse(accessToken, xeroTenantId, body, name, filename, mimeType);
15261523
return apiClient.getObjectMapper().readValue(response.getContent(), typeRef);
15271524
} catch (HttpResponseException e) {
15281525
if (logger.isDebugEnabled()) {
@@ -1541,14 +1538,13 @@ public FileObject uploadFile(
15411538
}
15421539

15431540
/**
1544-
* Uploads a File
1541+
* Uploads a File to the inbox
15451542
*
15461543
* <p><b>201</b> - A successful request
15471544
*
15481545
* <p><b>400</b> - invalid input, object invalid
15491546
*
15501547
* @param xeroTenantId Xero identifier for Tenant
1551-
* @param folderId pass an optional folder id to save file to specific folder
15521548
* @param body The body parameter
15531549
* @param name exact name of the file you are uploading
15541550
* @param filename The filename parameter
@@ -1560,7 +1556,6 @@ public FileObject uploadFile(
15601556
public HttpResponse uploadFileForHttpResponse(
15611557
String accessToken,
15621558
String xeroTenantId,
1563-
UUID folderId,
15641559
File body,
15651560
String name,
15661561
String filename,
@@ -1570,6 +1565,18 @@ public HttpResponse uploadFileForHttpResponse(
15701565
if (xeroTenantId == null) {
15711566
throw new IllegalArgumentException(
15721567
"Missing the required parameter 'xeroTenantId' when calling uploadFile");
1568+
} // verify the required parameter 'body' is set
1569+
if (body == null) {
1570+
throw new IllegalArgumentException(
1571+
"Missing the required parameter 'body' when calling uploadFile");
1572+
} // verify the required parameter 'name' is set
1573+
if (name == null) {
1574+
throw new IllegalArgumentException(
1575+
"Missing the required parameter 'name' when calling uploadFile");
1576+
} // verify the required parameter 'filename' is set
1577+
if (filename == null) {
1578+
throw new IllegalArgumentException(
1579+
"Missing the required parameter 'filename' when calling uploadFile");
15731580
}
15741581
if (accessToken == null) {
15751582
throw new IllegalArgumentException(
@@ -1580,18 +1587,161 @@ public HttpResponse uploadFileForHttpResponse(
15801587
headers.setAccept("application/json");
15811588
headers.setUserAgent(this.getUserAgent());
15821589
UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Files");
1583-
if (folderId != null) {
1584-
String key = "FolderId";
1585-
Object value = folderId;
1586-
if (value instanceof Collection) {
1587-
uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray());
1588-
} else if (value instanceof Object[]) {
1589-
uriBuilder = uriBuilder.queryParam(key, (Object[]) value);
1590-
} else {
1591-
uriBuilder = uriBuilder.queryParam(key, value);
1590+
String url = uriBuilder.build().toString();
1591+
GenericUrl genericUrl = new GenericUrl(url);
1592+
if (logger.isDebugEnabled()) {
1593+
logger.debug("POST " + genericUrl.toString());
1594+
}
1595+
1596+
Map<String, String> parameters = Maps.newHashMap();
1597+
parameters.put("name", name);
1598+
parameters.put("filename", filename);
1599+
1600+
// Add parameters
1601+
MultipartContent content =
1602+
new MultipartContent()
1603+
.setMediaType(
1604+
new HttpMediaType("multipart/form-data")
1605+
.setParameter("boundary", "__END_OF_PART__"));
1606+
1607+
for (String key : parameters.keySet()) {
1608+
MultipartContent.Part part =
1609+
new MultipartContent.Part(new ByteArrayContent(null, parameters.get(key).getBytes()));
1610+
part.setHeaders(
1611+
new HttpHeaders()
1612+
.set("Content-Disposition", String.format("form-data; name=\"%s\"", key)));
1613+
content.addPart(part);
1614+
}
1615+
1616+
FileContent fileContent = new FileContent(mimeType, body);
1617+
MultipartContent.Part part = new MultipartContent.Part(fileContent);
1618+
part.setHeaders(
1619+
new HttpHeaders()
1620+
.set(
1621+
"Content-Disposition",
1622+
String.format("form-data; name=\"content\"; filename=\"%s\"", filename)));
1623+
content.addPart(part);
1624+
Credential credential =
1625+
new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken);
1626+
HttpTransport transport = apiClient.getHttpTransport();
1627+
HttpRequestFactory requestFactory = transport.createRequestFactory(credential);
1628+
return requestFactory
1629+
.buildRequest(HttpMethods.POST, genericUrl, content)
1630+
.setHeaders(headers)
1631+
.setConnectTimeout(apiClient.getConnectionTimeout())
1632+
.setReadTimeout(apiClient.getReadTimeout())
1633+
.execute();
1634+
}
1635+
1636+
/**
1637+
* Uploads a File to a specific folder
1638+
*
1639+
* <p><b>201</b> - A successful request
1640+
*
1641+
* <p><b>400</b> - invalid input, object invalid
1642+
*
1643+
* @param xeroTenantId Xero identifier for Tenant
1644+
* @param folderId pass required folder id to save file to specific folder
1645+
* @param body The body parameter
1646+
* @param name exact name of the file you are uploading
1647+
* @param filename The filename parameter
1648+
* @param mimeType The mimeType parameter
1649+
* @param accessToken Authorization token for user set in header of each request
1650+
* @return FileObject
1651+
* @throws IOException if an error occurs while attempting to invoke the API *
1652+
*/
1653+
public FileObject uploadFileToFolder(
1654+
String accessToken,
1655+
String xeroTenantId,
1656+
UUID folderId,
1657+
File body,
1658+
String name,
1659+
String filename,
1660+
String mimeType)
1661+
throws IOException {
1662+
try {
1663+
TypeReference<FileObject> typeRef = new TypeReference<FileObject>() {};
1664+
HttpResponse response =
1665+
uploadFileToFolderForHttpResponse(
1666+
accessToken, xeroTenantId, folderId, body, name, filename, mimeType);
1667+
return apiClient.getObjectMapper().readValue(response.getContent(), typeRef);
1668+
} catch (HttpResponseException e) {
1669+
if (logger.isDebugEnabled()) {
1670+
logger.debug(
1671+
"------------------ HttpResponseException "
1672+
+ e.getStatusCode()
1673+
+ " : uploadFileToFolder -------------------");
1674+
logger.debug(e.toString());
15921675
}
1676+
XeroApiExceptionHandler handler = new XeroApiExceptionHandler();
1677+
handler.execute(e);
1678+
} catch (IOException ioe) {
1679+
throw ioe;
15931680
}
1594-
String url = uriBuilder.build().toString();
1681+
return null;
1682+
}
1683+
1684+
/**
1685+
* Uploads a File to a specific folder
1686+
*
1687+
* <p><b>201</b> - A successful request
1688+
*
1689+
* <p><b>400</b> - invalid input, object invalid
1690+
*
1691+
* @param xeroTenantId Xero identifier for Tenant
1692+
* @param folderId pass required folder id to save file to specific folder
1693+
* @param body The body parameter
1694+
* @param name exact name of the file you are uploading
1695+
* @param filename The filename parameter
1696+
* @param mimeType The mimeType parameter
1697+
* @param accessToken Authorization token for user set in header of each request
1698+
* @return HttpResponse
1699+
* @throws IOException if an error occurs while attempting to invoke the API
1700+
*/
1701+
public HttpResponse uploadFileToFolderForHttpResponse(
1702+
String accessToken,
1703+
String xeroTenantId,
1704+
UUID folderId,
1705+
File body,
1706+
String name,
1707+
String filename,
1708+
String mimeType)
1709+
throws IOException {
1710+
// verify the required parameter 'xeroTenantId' is set
1711+
if (xeroTenantId == null) {
1712+
throw new IllegalArgumentException(
1713+
"Missing the required parameter 'xeroTenantId' when calling uploadFileToFolder");
1714+
} // verify the required parameter 'folderId' is set
1715+
if (folderId == null) {
1716+
throw new IllegalArgumentException(
1717+
"Missing the required parameter 'folderId' when calling uploadFileToFolder");
1718+
} // verify the required parameter 'body' is set
1719+
if (body == null) {
1720+
throw new IllegalArgumentException(
1721+
"Missing the required parameter 'body' when calling uploadFileToFolder");
1722+
} // verify the required parameter 'name' is set
1723+
if (name == null) {
1724+
throw new IllegalArgumentException(
1725+
"Missing the required parameter 'name' when calling uploadFileToFolder");
1726+
} // verify the required parameter 'filename' is set
1727+
if (filename == null) {
1728+
throw new IllegalArgumentException(
1729+
"Missing the required parameter 'filename' when calling uploadFileToFolder");
1730+
}
1731+
if (accessToken == null) {
1732+
throw new IllegalArgumentException(
1733+
"Missing the required parameter 'accessToken' when calling uploadFileToFolder");
1734+
}
1735+
HttpHeaders headers = new HttpHeaders();
1736+
headers.set("xero-tenant-id", xeroTenantId);
1737+
headers.setAccept("application/json");
1738+
headers.setUserAgent(this.getUserAgent());
1739+
// create a map of path variables
1740+
final Map<String, Object> uriVariables = new HashMap<String, Object>();
1741+
uriVariables.put("FolderId", folderId);
1742+
1743+
UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Files/{FolderId}");
1744+
String url = uriBuilder.buildFromMap(uriVariables).toString();
15951745
GenericUrl genericUrl = new GenericUrl(url);
15961746
if (logger.isDebugEnabled()) {
15971747
logger.debug("POST " + genericUrl.toString());

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* Xero OAuth 2 Identity Service API
33
* These endpoints are related to managing authentication tokens and identity for Xero API
44
*
5-
* The version of the OpenAPI document: 2.10.1
5+
* The version of the OpenAPI document: 2.10.3
66
* Contact: [email protected]
77
*
88
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
@@ -44,7 +44,7 @@ public class IdentityApi {
4444
private ApiClient apiClient;
4545
private static IdentityApi instance = null;
4646
private String userAgent = "Default";
47-
private String version = "4.8.1";
47+
private String version = "4.8.2";
4848
static final Logger logger = LoggerFactory.getLogger(IdentityApi.class);
4949

5050
/** IdentityApi */

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* Xero Payroll AU API
33
* This is the Xero Payroll API for orgs in Australia region.
44
*
5-
* The version of the OpenAPI document: 2.10.1
5+
* The version of the OpenAPI document: 2.10.3
66
* Contact: [email protected]
77
*
88
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
@@ -63,7 +63,7 @@ public class PayrollAuApi {
6363
private ApiClient apiClient;
6464
private static PayrollAuApi instance = null;
6565
private String userAgent = "Default";
66-
private String version = "4.8.1";
66+
private String version = "4.8.2";
6767
static final Logger logger = LoggerFactory.getLogger(PayrollAuApi.class);
6868

6969
/** PayrollAuApi */

0 commit comments

Comments
 (0)