-
Notifications
You must be signed in to change notification settings - Fork 88
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #275 from XeroAPI/sid-development
Build from OAS 2.10.3
- Loading branch information
Showing
14 changed files
with
218 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
* Xero Accounting API | ||
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) | ||
* | ||
* The version of the OpenAPI document: 2.10.1 | ||
* The version of the OpenAPI document: 2.10.3 | ||
* Contact: [email protected] | ||
* | ||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). | ||
|
@@ -98,7 +98,7 @@ public class AccountingApi { | |
private ApiClient apiClient; | ||
private static AccountingApi instance = null; | ||
private String userAgent = "Default"; | ||
private String version = "4.8.1"; | ||
private String version = "4.8.2"; | ||
static final Logger logger = LoggerFactory.getLogger(AccountingApi.class); | ||
|
||
/** AccountingApi */ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
* Xero Assets API | ||
* 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. | ||
* | ||
* The version of the OpenAPI document: 2.10.1 | ||
* The version of the OpenAPI document: 2.10.3 | ||
* Contact: [email protected] | ||
* | ||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). | ||
|
@@ -48,7 +48,7 @@ public class AssetApi { | |
private ApiClient apiClient; | ||
private static AssetApi instance = null; | ||
private String userAgent = "Default"; | ||
private String version = "4.8.1"; | ||
private String version = "4.8.2"; | ||
static final Logger logger = LoggerFactory.getLogger(AssetApi.class); | ||
|
||
/** AssetApi */ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
* Xero Bank Feeds API | ||
* 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. | ||
* | ||
* The version of the OpenAPI document: 2.10.1 | ||
* The version of the OpenAPI document: 2.10.3 | ||
* Contact: [email protected] | ||
* | ||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). | ||
|
@@ -46,7 +46,7 @@ public class BankFeedsApi { | |
private ApiClient apiClient; | ||
private static BankFeedsApi instance = null; | ||
private String userAgent = "Default"; | ||
private String version = "4.8.1"; | ||
private String version = "4.8.2"; | ||
static final Logger logger = LoggerFactory.getLogger(BankFeedsApi.class); | ||
|
||
/** BankFeedsApi */ | ||
|
@@ -118,9 +118,7 @@ public String getUserAgent() { | |
* | ||
* <p><b>202</b> - success new feed connection(s)response | ||
* | ||
* <p><b>400</b> - invalid input, object invalid | ||
* | ||
* <p><b>409</b> - failed to create new feed connection(s)response | ||
* <p><b>400</b> - failed to create new feed connection(s)response | ||
* | ||
* @param xeroTenantId Xero identifier for Tenant | ||
* @param feedConnections Feed Connection(s) array object in the body | ||
|
@@ -164,9 +162,7 @@ public FeedConnections createFeedConnections( | |
* | ||
* <p><b>202</b> - success new feed connection(s)response | ||
* | ||
* <p><b>400</b> - invalid input, object invalid | ||
* | ||
* <p><b>409</b> - failed to create new feed connection(s)response | ||
* <p><b>400</b> - failed to create new feed connection(s)response | ||
* | ||
* @param xeroTenantId Xero identifier for Tenant | ||
* @param feedConnections Feed Connection(s) array object in the body | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
* Xero Files API | ||
* These endpoints are specific to Xero Files API | ||
* | ||
* The version of the OpenAPI document: 2.10.1 | ||
* The version of the OpenAPI document: 2.10.3 | ||
* Contact: [email protected] | ||
* | ||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). | ||
|
@@ -53,7 +53,7 @@ public class FilesApi { | |
private ApiClient apiClient; | ||
private static FilesApi instance = null; | ||
private String userAgent = "Default"; | ||
private String version = "4.8.1"; | ||
private String version = "4.8.2"; | ||
static final Logger logger = LoggerFactory.getLogger(FilesApi.class); | ||
|
||
/** FilesApi */ | ||
|
@@ -1493,14 +1493,13 @@ public HttpResponse updateFolderForHttpResponse( | |
} | ||
|
||
/** | ||
* Uploads a File | ||
* Uploads a File to the inbox | ||
* | ||
* <p><b>201</b> - A successful request | ||
* | ||
* <p><b>400</b> - invalid input, object invalid | ||
* | ||
* @param xeroTenantId Xero identifier for Tenant | ||
* @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 | ||
|
@@ -1512,7 +1511,6 @@ public HttpResponse updateFolderForHttpResponse( | |
public FileObject uploadFile( | ||
String accessToken, | ||
String xeroTenantId, | ||
UUID folderId, | ||
File body, | ||
String name, | ||
String filename, | ||
|
@@ -1521,8 +1519,7 @@ public FileObject uploadFile( | |
try { | ||
TypeReference<FileObject> typeRef = new TypeReference<FileObject>() {}; | ||
HttpResponse response = | ||
uploadFileForHttpResponse( | ||
accessToken, xeroTenantId, folderId, body, name, filename, mimeType); | ||
uploadFileForHttpResponse(accessToken, xeroTenantId, body, name, filename, mimeType); | ||
return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); | ||
} catch (HttpResponseException e) { | ||
if (logger.isDebugEnabled()) { | ||
|
@@ -1541,14 +1538,13 @@ public FileObject uploadFile( | |
} | ||
|
||
/** | ||
* Uploads a File | ||
* Uploads a File to the inbox | ||
* | ||
* <p><b>201</b> - A successful request | ||
* | ||
* <p><b>400</b> - invalid input, object invalid | ||
* | ||
* @param xeroTenantId Xero identifier for Tenant | ||
* @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 | ||
|
@@ -1560,7 +1556,6 @@ public FileObject uploadFile( | |
public HttpResponse uploadFileForHttpResponse( | ||
String accessToken, | ||
String xeroTenantId, | ||
UUID folderId, | ||
File body, | ||
String name, | ||
String filename, | ||
|
@@ -1570,6 +1565,18 @@ public HttpResponse uploadFileForHttpResponse( | |
if (xeroTenantId == null) { | ||
throw new IllegalArgumentException( | ||
"Missing the required parameter 'xeroTenantId' when calling uploadFile"); | ||
} // verify the required parameter 'body' is set | ||
if (body == null) { | ||
throw new IllegalArgumentException( | ||
"Missing the required parameter 'body' when calling uploadFile"); | ||
} // verify the required parameter 'name' is set | ||
if (name == null) { | ||
throw new IllegalArgumentException( | ||
"Missing the required parameter 'name' when calling uploadFile"); | ||
} // verify the required parameter 'filename' is set | ||
if (filename == null) { | ||
throw new IllegalArgumentException( | ||
"Missing the required parameter 'filename' when calling uploadFile"); | ||
} | ||
if (accessToken == null) { | ||
throw new IllegalArgumentException( | ||
|
@@ -1580,18 +1587,161 @@ public HttpResponse uploadFileForHttpResponse( | |
headers.setAccept("application/json"); | ||
headers.setUserAgent(this.getUserAgent()); | ||
UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Files"); | ||
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); | ||
if (logger.isDebugEnabled()) { | ||
logger.debug("POST " + genericUrl.toString()); | ||
} | ||
|
||
Map<String, String> parameters = Maps.newHashMap(); | ||
parameters.put("name", name); | ||
parameters.put("filename", filename); | ||
|
||
// Add parameters | ||
MultipartContent content = | ||
new MultipartContent() | ||
.setMediaType( | ||
new HttpMediaType("multipart/form-data") | ||
.setParameter("boundary", "__END_OF_PART__")); | ||
|
||
for (String key : parameters.keySet()) { | ||
MultipartContent.Part part = | ||
new MultipartContent.Part(new ByteArrayContent(null, parameters.get(key).getBytes())); | ||
part.setHeaders( | ||
new HttpHeaders() | ||
.set("Content-Disposition", String.format("form-data; name=\"%s\"", key))); | ||
content.addPart(part); | ||
} | ||
|
||
FileContent fileContent = new FileContent(mimeType, body); | ||
MultipartContent.Part part = new MultipartContent.Part(fileContent); | ||
part.setHeaders( | ||
new HttpHeaders() | ||
.set( | ||
"Content-Disposition", | ||
String.format("form-data; name=\"content\"; filename=\"%s\"", filename))); | ||
content.addPart(part); | ||
Credential credential = | ||
new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); | ||
HttpTransport transport = apiClient.getHttpTransport(); | ||
HttpRequestFactory requestFactory = transport.createRequestFactory(credential); | ||
return requestFactory | ||
.buildRequest(HttpMethods.POST, genericUrl, content) | ||
.setHeaders(headers) | ||
.setConnectTimeout(apiClient.getConnectionTimeout()) | ||
.setReadTimeout(apiClient.getReadTimeout()) | ||
.execute(); | ||
} | ||
|
||
/** | ||
* Uploads a File to a specific folder | ||
* | ||
* <p><b>201</b> - A successful request | ||
* | ||
* <p><b>400</b> - invalid input, object invalid | ||
* | ||
* @param xeroTenantId Xero identifier for Tenant | ||
* @param folderId pass required 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 | ||
* @param accessToken Authorization token for user set in header of each request | ||
* @return FileObject | ||
* @throws IOException if an error occurs while attempting to invoke the API * | ||
*/ | ||
public FileObject uploadFileToFolder( | ||
String accessToken, | ||
String xeroTenantId, | ||
UUID folderId, | ||
File body, | ||
String name, | ||
String filename, | ||
String mimeType) | ||
throws IOException { | ||
try { | ||
TypeReference<FileObject> typeRef = new TypeReference<FileObject>() {}; | ||
HttpResponse response = | ||
uploadFileToFolderForHttpResponse( | ||
accessToken, xeroTenantId, folderId, body, name, filename, mimeType); | ||
return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); | ||
} catch (HttpResponseException e) { | ||
if (logger.isDebugEnabled()) { | ||
logger.debug( | ||
"------------------ HttpResponseException " | ||
+ e.getStatusCode() | ||
+ " : uploadFileToFolder -------------------"); | ||
logger.debug(e.toString()); | ||
} | ||
XeroApiExceptionHandler handler = new XeroApiExceptionHandler(); | ||
handler.execute(e); | ||
} catch (IOException ioe) { | ||
throw ioe; | ||
} | ||
String url = uriBuilder.build().toString(); | ||
return null; | ||
} | ||
|
||
/** | ||
* Uploads a File to a specific folder | ||
* | ||
* <p><b>201</b> - A successful request | ||
* | ||
* <p><b>400</b> - invalid input, object invalid | ||
* | ||
* @param xeroTenantId Xero identifier for Tenant | ||
* @param folderId pass required 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 | ||
* @param accessToken Authorization token for user set in header of each request | ||
* @return HttpResponse | ||
* @throws IOException if an error occurs while attempting to invoke the API | ||
*/ | ||
public HttpResponse uploadFileToFolderForHttpResponse( | ||
String accessToken, | ||
String xeroTenantId, | ||
UUID folderId, | ||
File body, | ||
String name, | ||
String filename, | ||
String mimeType) | ||
throws IOException { | ||
// verify the required parameter 'xeroTenantId' is set | ||
if (xeroTenantId == null) { | ||
throw new IllegalArgumentException( | ||
"Missing the required parameter 'xeroTenantId' when calling uploadFileToFolder"); | ||
} // verify the required parameter 'folderId' is set | ||
if (folderId == null) { | ||
throw new IllegalArgumentException( | ||
"Missing the required parameter 'folderId' when calling uploadFileToFolder"); | ||
} // verify the required parameter 'body' is set | ||
if (body == null) { | ||
throw new IllegalArgumentException( | ||
"Missing the required parameter 'body' when calling uploadFileToFolder"); | ||
} // verify the required parameter 'name' is set | ||
if (name == null) { | ||
throw new IllegalArgumentException( | ||
"Missing the required parameter 'name' when calling uploadFileToFolder"); | ||
} // verify the required parameter 'filename' is set | ||
if (filename == null) { | ||
throw new IllegalArgumentException( | ||
"Missing the required parameter 'filename' when calling uploadFileToFolder"); | ||
} | ||
if (accessToken == null) { | ||
throw new IllegalArgumentException( | ||
"Missing the required parameter 'accessToken' when calling uploadFileToFolder"); | ||
} | ||
HttpHeaders headers = new HttpHeaders(); | ||
headers.set("xero-tenant-id", xeroTenantId); | ||
headers.setAccept("application/json"); | ||
headers.setUserAgent(this.getUserAgent()); | ||
// create a map of path variables | ||
final Map<String, Object> uriVariables = new HashMap<String, Object>(); | ||
uriVariables.put("FolderId", folderId); | ||
|
||
UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Files/{FolderId}"); | ||
String url = uriBuilder.buildFromMap(uriVariables).toString(); | ||
GenericUrl genericUrl = new GenericUrl(url); | ||
if (logger.isDebugEnabled()) { | ||
logger.debug("POST " + genericUrl.toString()); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
* Xero OAuth 2 Identity Service API | ||
* These endpoints are related to managing authentication tokens and identity for Xero API | ||
* | ||
* The version of the OpenAPI document: 2.10.1 | ||
* The version of the OpenAPI document: 2.10.3 | ||
* Contact: [email protected] | ||
* | ||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). | ||
|
@@ -44,7 +44,7 @@ public class IdentityApi { | |
private ApiClient apiClient; | ||
private static IdentityApi instance = null; | ||
private String userAgent = "Default"; | ||
private String version = "4.8.1"; | ||
private String version = "4.8.2"; | ||
static final Logger logger = LoggerFactory.getLogger(IdentityApi.class); | ||
|
||
/** IdentityApi */ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
* Xero Payroll AU API | ||
* This is the Xero Payroll API for orgs in Australia region. | ||
* | ||
* The version of the OpenAPI document: 2.10.1 | ||
* The version of the OpenAPI document: 2.10.3 | ||
* Contact: [email protected] | ||
* | ||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). | ||
|
@@ -63,7 +63,7 @@ public class PayrollAuApi { | |
private ApiClient apiClient; | ||
private static PayrollAuApi instance = null; | ||
private String userAgent = "Default"; | ||
private String version = "4.8.1"; | ||
private String version = "4.8.2"; | ||
static final Logger logger = LoggerFactory.getLogger(PayrollAuApi.class); | ||
|
||
/** PayrollAuApi */ | ||
|
Oops, something went wrong.