Skip to content

Commit

Permalink
PETOS-560 Adds Content Type for API Calls
Browse files Browse the repository at this point in the history
  • Loading branch information
Vignesh Kennadi committed Sep 23, 2024
1 parent 5f58475 commit 8efad97
Show file tree
Hide file tree
Showing 11 changed files with 500 additions and 2 deletions.
259 changes: 259 additions & 0 deletions src/main/java/com/xero/api/client/AccountingApi.java

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions src/main/java/com/xero/api/client/AppStoreApi.java
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ public HttpResponse getSubscriptionForHttpResponse(String accessToken, UUID subs
}
HttpHeaders headers = new HttpHeaders();
headers.setAccept("application/json");
headers.setContentType("");
headers.setUserAgent(this.getUserAgent());
// create a map of path variables
final Map<String, Object> uriVariables = new HashMap<String, Object>();
Expand Down Expand Up @@ -257,6 +258,7 @@ public HttpResponse getUsageRecordsForHttpResponse(String accessToken, UUID subs
}
HttpHeaders headers = new HttpHeaders();
headers.setAccept("application/json");
headers.setContentType("");
headers.setUserAgent(this.getUserAgent());
// create a map of path variables
final Map<String, Object> uriVariables = new HashMap<String, Object>();
Expand Down Expand Up @@ -372,6 +374,7 @@ public HttpResponse postUsageRecordsForHttpResponse(
HttpHeaders headers = new HttpHeaders();
headers.set("Idempotency-Key", idempotencyKey);
headers.setAccept("application/json");
headers.setContentType("application/json");
headers.setUserAgent(this.getUserAgent());
// create a map of path variables
final Map<String, Object> uriVariables = new HashMap<String, Object>();
Expand Down Expand Up @@ -504,6 +507,7 @@ public HttpResponse putUsageRecordsForHttpResponse(
HttpHeaders headers = new HttpHeaders();
headers.set("Idempotency-Key", idempotencyKey);
headers.setAccept("application/json");
headers.setContentType("application/json");
headers.setUserAgent(this.getUserAgent());
// create a map of path variables
final Map<String, Object> uriVariables = new HashMap<String, Object>();
Expand Down
6 changes: 6 additions & 0 deletions src/main/java/com/xero/api/client/AssetApi.java
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@ public HttpResponse createAssetForHttpResponse(
headers.set("xero-tenant-id", xeroTenantId);
headers.set("Idempotency-Key", idempotencyKey);
headers.setAccept("application/json");
headers.setContentType("application/json");
headers.setUserAgent(this.getUserAgent());
UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Assets");
String url = uriBuilder.build().toString();
Expand Down Expand Up @@ -306,6 +307,7 @@ public HttpResponse createAssetTypeForHttpResponse(
headers.set("xero-tenant-id", xeroTenantId);
headers.set("Idempotency-Key", idempotencyKey);
headers.setAccept("application/json");
headers.setContentType("application/json");
headers.setUserAgent(this.getUserAgent());
UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/AssetTypes");
String url = uriBuilder.build().toString();
Expand Down Expand Up @@ -396,6 +398,7 @@ public HttpResponse getAssetByIdForHttpResponse(String accessToken, String xeroT
HttpHeaders headers = new HttpHeaders();
headers.set("xero-tenant-id", xeroTenantId);
headers.setAccept("application/json");
headers.setContentType("");
headers.setUserAgent(this.getUserAgent());
// create a map of path variables
final Map<String, Object> uriVariables = new HashMap<String, Object>();
Expand Down Expand Up @@ -482,6 +485,7 @@ public HttpResponse getAssetSettingsForHttpResponse(String accessToken, String x
HttpHeaders headers = new HttpHeaders();
headers.set("xero-tenant-id", xeroTenantId);
headers.setAccept("application/json");
headers.setContentType("");
headers.setUserAgent(this.getUserAgent());
UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Settings");
String url = uriBuilder.build().toString();
Expand Down Expand Up @@ -564,6 +568,7 @@ public HttpResponse getAssetTypesForHttpResponse(String accessToken, String xero
HttpHeaders headers = new HttpHeaders();
headers.set("xero-tenant-id", xeroTenantId);
headers.setAccept("application/json");
headers.setContentType("");
headers.setUserAgent(this.getUserAgent());
UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/AssetTypes");
String url = uriBuilder.build().toString();
Expand Down Expand Up @@ -693,6 +698,7 @@ public HttpResponse getAssetsForHttpResponse(
HttpHeaders headers = new HttpHeaders();
headers.set("xero-tenant-id", xeroTenantId);
headers.setAccept("application/json");
headers.setContentType("");
headers.setUserAgent(this.getUserAgent());
UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Assets");
if (status != null) {
Expand Down
11 changes: 9 additions & 2 deletions src/main/java/com/xero/api/client/BankFeedsApi.java
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,7 @@ public HttpResponse createFeedConnectionsForHttpResponse(
headers.set("Xero-Tenant-Id", xeroTenantId);
headers.set("Idempotency-Key", idempotencyKey);
headers.setAccept("application/json");
headers.setContentType("application/json");
headers.setUserAgent(this.getUserAgent());
UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/FeedConnections");
String url = uriBuilder.build().toString();
Expand Down Expand Up @@ -327,7 +328,8 @@ public HttpResponse createStatementsForHttpResponse(
HttpHeaders headers = new HttpHeaders();
headers.set("Xero-Tenant-Id", xeroTenantId);
headers.set("Idempotency-Key", idempotencyKey);
headers.setAccept("application/jsonapplication/problem+json");
headers.setAccept("application/json;application/problem+json");
headers.setContentType("application/json");
headers.setUserAgent(this.getUserAgent());
UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Statements");
String url = uriBuilder.build().toString();
Expand Down Expand Up @@ -434,6 +436,7 @@ public HttpResponse deleteFeedConnectionsForHttpResponse(
headers.set("Xero-Tenant-Id", xeroTenantId);
headers.set("Idempotency-Key", idempotencyKey);
headers.setAccept("application/json");
headers.setContentType("application/json");
headers.setUserAgent(this.getUserAgent());
UriBuilder uriBuilder =
UriBuilder.fromUri(apiClient.getBasePath() + "/FeedConnections/DeleteRequests");
Expand Down Expand Up @@ -526,6 +529,7 @@ public HttpResponse getFeedConnectionForHttpResponse(
HttpHeaders headers = new HttpHeaders();
headers.set("Xero-Tenant-Id", xeroTenantId);
headers.setAccept("application/json");
headers.setContentType("");
headers.setUserAgent(this.getUserAgent());
// create a map of path variables
final Map<String, Object> uriVariables = new HashMap<String, Object>();
Expand Down Expand Up @@ -630,6 +634,7 @@ public HttpResponse getFeedConnectionsForHttpResponse(
HttpHeaders headers = new HttpHeaders();
headers.set("Xero-Tenant-Id", xeroTenantId);
headers.setAccept("application/json");
headers.setContentType("");
headers.setUserAgent(this.getUserAgent());
UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/FeedConnections");
if (page != null) {
Expand Down Expand Up @@ -759,6 +764,7 @@ public HttpResponse getStatementForHttpResponse(
HttpHeaders headers = new HttpHeaders();
headers.set("Xero-Tenant-Id", xeroTenantId);
headers.setAccept("application/json");
headers.setContentType("");
headers.setUserAgent(this.getUserAgent());
// create a map of path variables
final Map<String, Object> uriVariables = new HashMap<String, Object>();
Expand Down Expand Up @@ -872,7 +878,8 @@ public HttpResponse getStatementsForHttpResponse(
headers.set("Xero-Tenant-Id", xeroTenantId);
headers.set("Xero-Application-Id", xeroApplicationId);
headers.set("Xero-User-Id", xeroUserId);
headers.setAccept("application/jsonapplication/problem+json");
headers.setAccept("application/json;application/problem+json");
headers.setContentType("");
headers.setUserAgent(this.getUserAgent());
UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Statements");
if (page != null) {
Expand Down
18 changes: 18 additions & 0 deletions src/main/java/com/xero/api/client/FilesApi.java
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,7 @@ public HttpResponse createFileAssociationForHttpResponse(
headers.set("xero-tenant-id", xeroTenantId);
headers.set("Idempotency-Key", idempotencyKey);
headers.setAccept("application/json");
headers.setContentType("application/json");
headers.setUserAgent(this.getUserAgent());
// create a map of path variables
final Map<String, Object> uriVariables = new HashMap<String, Object>();
Expand Down Expand Up @@ -313,6 +314,7 @@ public HttpResponse createFolderForHttpResponse(
headers.set("xero-tenant-id", xeroTenantId);
headers.set("Idempotency-Key", idempotencyKey);
headers.setAccept("application/json");
headers.setContentType("application/json");
headers.setUserAgent(this.getUserAgent());
UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Folders");
String url = uriBuilder.build().toString();
Expand Down Expand Up @@ -393,6 +395,7 @@ public HttpResponse deleteFileForHttpResponse(
HttpHeaders headers = new HttpHeaders();
headers.set("xero-tenant-id", xeroTenantId);
headers.setAccept("");
headers.setContentType("");
headers.setUserAgent(this.getUserAgent());
// create a map of path variables
final Map<String, Object> uriVariables = new HashMap<String, Object>();
Expand Down Expand Up @@ -484,6 +487,7 @@ public HttpResponse deleteFileAssociationForHttpResponse(
HttpHeaders headers = new HttpHeaders();
headers.set("xero-tenant-id", xeroTenantId);
headers.setAccept("");
headers.setContentType("");
headers.setUserAgent(this.getUserAgent());
// create a map of path variables
final Map<String, Object> uriVariables = new HashMap<String, Object>();
Expand Down Expand Up @@ -569,6 +573,7 @@ public HttpResponse deleteFolderForHttpResponse(
HttpHeaders headers = new HttpHeaders();
headers.set("xero-tenant-id", xeroTenantId);
headers.setAccept("");
headers.setContentType("");
headers.setUserAgent(this.getUserAgent());
// create a map of path variables
final Map<String, Object> uriVariables = new HashMap<String, Object>();
Expand Down Expand Up @@ -682,6 +687,7 @@ public HttpResponse getAssociationsByObjectForHttpResponse(
HttpHeaders headers = new HttpHeaders();
headers.set("xero-tenant-id", xeroTenantId);
headers.setAccept("application/json");
headers.setContentType("");
headers.setUserAgent(this.getUserAgent());
// create a map of path variables
final Map<String, Object> uriVariables = new HashMap<String, Object>();
Expand Down Expand Up @@ -853,6 +859,7 @@ public HttpResponse getAssociationsCountForHttpResponse(
HttpHeaders headers = new HttpHeaders();
headers.set("xero-tenant-id", xeroTenantId);
headers.setAccept("application/json");
headers.setContentType("");
headers.setUserAgent(this.getUserAgent());
UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Associations/Count");
if (objectIds != null) {
Expand Down Expand Up @@ -956,6 +963,7 @@ public HttpResponse getFileForHttpResponse(String accessToken, String xeroTenant
HttpHeaders headers = new HttpHeaders();
headers.set("xero-tenant-id", xeroTenantId);
headers.setAccept("application/json");
headers.setContentType("");
headers.setUserAgent(this.getUserAgent());
// create a map of path variables
final Map<String, Object> uriVariables = new HashMap<String, Object>();
Expand Down Expand Up @@ -1043,6 +1051,7 @@ public HttpResponse getFileAssociationsForHttpResponse(
HttpHeaders headers = new HttpHeaders();
headers.set("xero-tenant-id", xeroTenantId);
headers.setAccept("application/json");
headers.setContentType("");
headers.setUserAgent(this.getUserAgent());
// create a map of path variables
final Map<String, Object> uriVariables = new HashMap<String, Object>();
Expand Down Expand Up @@ -1135,6 +1144,7 @@ public HttpResponse getFileContentForHttpResponse(
HttpHeaders headers = new HttpHeaders();
headers.set("xero-tenant-id", xeroTenantId);
headers.setAccept("application/octet-stream");
headers.setContentType("");
headers.setUserAgent(this.getUserAgent());
// create a map of path variables
final Map<String, Object> uriVariables = new HashMap<String, Object>();
Expand Down Expand Up @@ -1225,6 +1235,7 @@ public HttpResponse getFilesForHttpResponse(
HttpHeaders headers = new HttpHeaders();
headers.set("xero-tenant-id", xeroTenantId);
headers.setAccept("application/json");
headers.setContentType("");
headers.setUserAgent(this.getUserAgent());
UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Files");
if (pagesize != null) {
Expand Down Expand Up @@ -1370,6 +1381,7 @@ public HttpResponse getFolderForHttpResponse(
HttpHeaders headers = new HttpHeaders();
headers.set("xero-tenant-id", xeroTenantId);
headers.setAccept("application/json");
headers.setContentType("");
headers.setUserAgent(this.getUserAgent());
// create a map of path variables
final Map<String, Object> uriVariables = new HashMap<String, Object>();
Expand Down Expand Up @@ -1453,6 +1465,7 @@ public HttpResponse getFoldersForHttpResponse(
HttpHeaders headers = new HttpHeaders();
headers.set("xero-tenant-id", xeroTenantId);
headers.setAccept("application/json");
headers.setContentType("");
headers.setUserAgent(this.getUserAgent());
UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Folders");
if (sort != null) {
Expand Down Expand Up @@ -1549,6 +1562,7 @@ public HttpResponse getInboxForHttpResponse(String accessToken, String xeroTenan
HttpHeaders headers = new HttpHeaders();
headers.set("xero-tenant-id", xeroTenantId);
headers.setAccept("application/json");
headers.setContentType("");
headers.setUserAgent(this.getUserAgent());
UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Inbox");
String url = uriBuilder.build().toString();
Expand Down Expand Up @@ -1658,6 +1672,7 @@ public HttpResponse updateFileForHttpResponse(
headers.set("xero-tenant-id", xeroTenantId);
headers.set("Idempotency-Key", idempotencyKey);
headers.setAccept("application/json");
headers.setContentType("application/json");
headers.setUserAgent(this.getUserAgent());
// create a map of path variables
final Map<String, Object> uriVariables = new HashMap<String, Object>();
Expand Down Expand Up @@ -1767,6 +1782,7 @@ public HttpResponse updateFolderForHttpResponse(
headers.set("xero-tenant-id", xeroTenantId);
headers.set("Idempotency-Key", idempotencyKey);
headers.setAccept("application/json");
headers.setContentType("application/json");
headers.setUserAgent(this.getUserAgent());
// create a map of path variables
final Map<String, Object> uriVariables = new HashMap<String, Object>();
Expand Down Expand Up @@ -1895,6 +1911,7 @@ public HttpResponse uploadFileForHttpResponse(
headers.set("xero-tenant-id", xeroTenantId);
headers.set("Idempotency-Key", idempotencyKey);
headers.setAccept("application/json");
headers.setContentType("multipart/form-data");
headers.setUserAgent(this.getUserAgent());
UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Files");
String url = uriBuilder.build().toString();
Expand Down Expand Up @@ -2052,6 +2069,7 @@ public HttpResponse uploadFileToFolderForHttpResponse(
headers.set("xero-tenant-id", xeroTenantId);
headers.set("Idempotency-Key", idempotencyKey);
headers.setAccept("application/json");
headers.setContentType("multipart/form-data");
headers.setUserAgent(this.getUserAgent());
// create a map of path variables
final Map<String, Object> uriVariables = new HashMap<String, Object>();
Expand Down
12 changes: 12 additions & 0 deletions src/main/java/com/xero/api/client/FinanceApi.java
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ public HttpResponse getAccountingActivityAccountUsageForHttpResponse(
HttpHeaders headers = new HttpHeaders();
headers.set("xero-tenant-id", xeroTenantId);
headers.setAccept("application/json");
headers.setContentType("");
headers.setUserAgent(this.getUserAgent());
UriBuilder uriBuilder =
UriBuilder.fromUri(apiClient.getBasePath() + "/AccountingActivities/AccountUsage");
Expand Down Expand Up @@ -332,6 +333,7 @@ public HttpResponse getAccountingActivityLockHistoryForHttpResponse(
HttpHeaders headers = new HttpHeaders();
headers.set("xero-tenant-id", xeroTenantId);
headers.setAccept("application/json");
headers.setContentType("");
headers.setUserAgent(this.getUserAgent());
UriBuilder uriBuilder =
UriBuilder.fromUri(apiClient.getBasePath() + "/AccountingActivities/LockHistory");
Expand Down Expand Up @@ -449,6 +451,7 @@ public HttpResponse getAccountingActivityReportHistoryForHttpResponse(
HttpHeaders headers = new HttpHeaders();
headers.set("xero-tenant-id", xeroTenantId);
headers.setAccept("application/json");
headers.setContentType("");
headers.setUserAgent(this.getUserAgent());
UriBuilder uriBuilder =
UriBuilder.fromUri(apiClient.getBasePath() + "/AccountingActivities/ReportHistory");
Expand Down Expand Up @@ -569,6 +572,7 @@ public HttpResponse getAccountingActivityUserActivitiesForHttpResponse(
HttpHeaders headers = new HttpHeaders();
headers.set("xero-tenant-id", xeroTenantId);
headers.setAccept("application/json");
headers.setContentType("");
headers.setUserAgent(this.getUserAgent());
UriBuilder uriBuilder =
UriBuilder.fromUri(apiClient.getBasePath() + "/AccountingActivities/UserActivities");
Expand Down Expand Up @@ -726,6 +730,7 @@ public HttpResponse getBankStatementAccountingForHttpResponse(
HttpHeaders headers = new HttpHeaders();
headers.set("xero-tenant-id", xeroTenantId);
headers.setAccept("application/json");
headers.setContentType("");
headers.setUserAgent(this.getUserAgent());
UriBuilder uriBuilder =
UriBuilder.fromUri(apiClient.getBasePath() + "/BankStatementsPlus/statements");
Expand Down Expand Up @@ -947,6 +952,7 @@ public HttpResponse getCashValidationForHttpResponse(
HttpHeaders headers = new HttpHeaders();
headers.set("xero-tenant-id", xeroTenantId);
headers.setAccept("application/json");
headers.setContentType("");
headers.setUserAgent(this.getUserAgent());
UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/CashValidation");
if (balanceDate != null) {
Expand Down Expand Up @@ -1101,6 +1107,7 @@ public HttpResponse getFinancialStatementBalanceSheetForHttpResponse(
HttpHeaders headers = new HttpHeaders();
headers.set("xero-tenant-id", xeroTenantId);
headers.setAccept("application/json");
headers.setContentType("");
headers.setUserAgent(this.getUserAgent());
UriBuilder uriBuilder =
UriBuilder.fromUri(apiClient.getBasePath() + "/FinancialStatements/BalanceSheet");
Expand Down Expand Up @@ -1225,6 +1232,7 @@ public HttpResponse getFinancialStatementCashflowForHttpResponse(
HttpHeaders headers = new HttpHeaders();
headers.set("xero-tenant-id", xeroTenantId);
headers.setAccept("application/json");
headers.setContentType("");
headers.setUserAgent(this.getUserAgent());
UriBuilder uriBuilder =
UriBuilder.fromUri(apiClient.getBasePath() + "/FinancialStatements/Cashflow");
Expand Down Expand Up @@ -1394,6 +1402,7 @@ public HttpResponse getFinancialStatementContactsExpenseForHttpResponse(
HttpHeaders headers = new HttpHeaders();
headers.set("xero-tenant-id", xeroTenantId);
headers.setAccept("application/json");
headers.setContentType("");
headers.setUserAgent(this.getUserAgent());
UriBuilder uriBuilder =
UriBuilder.fromUri(apiClient.getBasePath() + "/FinancialStatements/contacts/expense");
Expand Down Expand Up @@ -1603,6 +1612,7 @@ public HttpResponse getFinancialStatementContactsRevenueForHttpResponse(
HttpHeaders headers = new HttpHeaders();
headers.set("xero-tenant-id", xeroTenantId);
headers.setAccept("application/json");
headers.setContentType("");
headers.setUserAgent(this.getUserAgent());
UriBuilder uriBuilder =
UriBuilder.fromUri(apiClient.getBasePath() + "/FinancialStatements/contacts/revenue");
Expand Down Expand Up @@ -1781,6 +1791,7 @@ public HttpResponse getFinancialStatementProfitAndLossForHttpResponse(
HttpHeaders headers = new HttpHeaders();
headers.set("xero-tenant-id", xeroTenantId);
headers.setAccept("application/json");
headers.setContentType("");
headers.setUserAgent(this.getUserAgent());
UriBuilder uriBuilder =
UriBuilder.fromUri(apiClient.getBasePath() + "/FinancialStatements/ProfitAndLoss");
Expand Down Expand Up @@ -1912,6 +1923,7 @@ public HttpResponse getFinancialStatementTrialBalanceForHttpResponse(
HttpHeaders headers = new HttpHeaders();
headers.set("xero-tenant-id", xeroTenantId);
headers.setAccept("application/json");
headers.setContentType("");
headers.setUserAgent(this.getUserAgent());
UriBuilder uriBuilder =
UriBuilder.fromUri(apiClient.getBasePath() + "/FinancialStatements/TrialBalance");
Expand Down
Loading

0 comments on commit 8efad97

Please sign in to comment.