@@ -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
0 commit comments