Skip to content

Commit 8cf9c8a

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Regenerate client from commit 113773d of spec repo (#637)
Co-authored-by: ci.datadog-api-spec <packages@datadoghq.com>
1 parent 36931c2 commit 8cf9c8a

File tree

3 files changed

+4
-136
lines changed

3 files changed

+4
-136
lines changed

.apigentools-info

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44
"spec_versions": {
55
"v1": {
66
"apigentools_version": "1.4.1.dev2",
7-
"regenerated": "2021-02-03 08:38:29.208682",
8-
"spec_repo_commit": "f02c467"
7+
"regenerated": "2021-02-03 16:24:07.623332",
8+
"spec_repo_commit": "113773d"
99
},
1010
"v2": {
1111
"apigentools_version": "1.4.1.dev2",
12-
"regenerated": "2021-02-03 08:38:39.829272",
13-
"spec_repo_commit": "f02c467"
12+
"regenerated": "2021-02-03 16:24:15.926643",
13+
"spec_repo_commit": "113773d"
1414
}
1515
}
1616
}

src/main/java/com/datadog/api/v1/client/ApiClient.java

Lines changed: 0 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -688,17 +688,6 @@ public ApiClient setDebugging(boolean debugging) {
688688
return this;
689689
}
690690

691-
/**
692-
* The path of temporary folder used to store downloaded files from endpoints
693-
* with file response. The default value is <code>null</code>, i.e. using
694-
* the system's default tempopary folder.
695-
*
696-
* @return Temp folder path
697-
*/
698-
public String getTempFolderPath() {
699-
return tempFolderPath;
700-
}
701-
702691
/**
703692
* Set temp folder path
704693
* @param tempFolderPath Temp folder path
@@ -1108,10 +1097,6 @@ public <T> T deserialize(Response response, GenericType<T> returnType) throws Ap
11081097
if ("byte[]".equals(returnType.toString())) {
11091098
// Handle binary response (byte array).
11101099
return (T) response.readEntity(byte[].class);
1111-
} else if (returnType.getRawType() == File.class) {
1112-
// Handle file downloading.
1113-
T file = (T) downloadFileFromResponse(response);
1114-
return file;
11151100
}
11161101

11171102
String contentType = null;
@@ -1125,57 +1110,6 @@ public <T> T deserialize(Response response, GenericType<T> returnType) throws Ap
11251110
return response.readEntity(returnType);
11261111
}
11271112

1128-
/**
1129-
* Download file from the given response.
1130-
* @param response Response
1131-
* @return File
1132-
* @throws ApiException If fail to read file content from response and write to disk
1133-
*/
1134-
public File downloadFileFromResponse(Response response) throws ApiException {
1135-
try {
1136-
File file = prepareDownloadFile(response);
1137-
Files.copy(response.readEntity(InputStream.class), file.toPath(), StandardCopyOption.REPLACE_EXISTING);
1138-
return file;
1139-
} catch (IOException e) {
1140-
throw new ApiException(e);
1141-
}
1142-
}
1143-
1144-
public File prepareDownloadFile(Response response) throws IOException {
1145-
String filename = null;
1146-
String contentDisposition = (String) response.getHeaders().getFirst("Content-Disposition");
1147-
if (contentDisposition != null && !"".equals(contentDisposition)) {
1148-
// Get filename from the Content-Disposition header.
1149-
Pattern pattern = Pattern.compile("filename=['\"]?([^'\"\\s]+)['\"]?");
1150-
Matcher matcher = pattern.matcher(contentDisposition);
1151-
if (matcher.find())
1152-
filename = matcher.group(1);
1153-
}
1154-
1155-
String prefix;
1156-
String suffix = null;
1157-
if (filename == null) {
1158-
prefix = "download-";
1159-
suffix = "";
1160-
} else {
1161-
int pos = filename.lastIndexOf('.');
1162-
if (pos == -1) {
1163-
prefix = filename + "-";
1164-
} else {
1165-
prefix = filename.substring(0, pos) + "-";
1166-
suffix = filename.substring(pos);
1167-
}
1168-
// File.createTempFile requires the prefix to be at least three characters long
1169-
if (prefix.length() < 3)
1170-
prefix = "download-";
1171-
}
1172-
1173-
if (tempFolderPath == null)
1174-
return File.createTempFile(prefix, suffix);
1175-
else
1176-
return File.createTempFile(prefix, suffix, new File(tempFolderPath));
1177-
}
1178-
11791113
/**
11801114
* Invoke API by sending HTTP request with the given options.
11811115
*

src/main/java/com/datadog/api/v2/client/ApiClient.java

Lines changed: 0 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -505,17 +505,6 @@ public ApiClient setDebugging(boolean debugging) {
505505
return this;
506506
}
507507

508-
/**
509-
* The path of temporary folder used to store downloaded files from endpoints
510-
* with file response. The default value is <code>null</code>, i.e. using
511-
* the system's default tempopary folder.
512-
*
513-
* @return Temp folder path
514-
*/
515-
public String getTempFolderPath() {
516-
return tempFolderPath;
517-
}
518-
519508
/**
520509
* Set temp folder path
521510
* @param tempFolderPath Temp folder path
@@ -925,10 +914,6 @@ public <T> T deserialize(Response response, GenericType<T> returnType) throws Ap
925914
if ("byte[]".equals(returnType.toString())) {
926915
// Handle binary response (byte array).
927916
return (T) response.readEntity(byte[].class);
928-
} else if (returnType.getRawType() == File.class) {
929-
// Handle file downloading.
930-
T file = (T) downloadFileFromResponse(response);
931-
return file;
932917
}
933918

934919
String contentType = null;
@@ -942,57 +927,6 @@ public <T> T deserialize(Response response, GenericType<T> returnType) throws Ap
942927
return response.readEntity(returnType);
943928
}
944929

945-
/**
946-
* Download file from the given response.
947-
* @param response Response
948-
* @return File
949-
* @throws ApiException If fail to read file content from response and write to disk
950-
*/
951-
public File downloadFileFromResponse(Response response) throws ApiException {
952-
try {
953-
File file = prepareDownloadFile(response);
954-
Files.copy(response.readEntity(InputStream.class), file.toPath(), StandardCopyOption.REPLACE_EXISTING);
955-
return file;
956-
} catch (IOException e) {
957-
throw new ApiException(e);
958-
}
959-
}
960-
961-
public File prepareDownloadFile(Response response) throws IOException {
962-
String filename = null;
963-
String contentDisposition = (String) response.getHeaders().getFirst("Content-Disposition");
964-
if (contentDisposition != null && !"".equals(contentDisposition)) {
965-
// Get filename from the Content-Disposition header.
966-
Pattern pattern = Pattern.compile("filename=['\"]?([^'\"\\s]+)['\"]?");
967-
Matcher matcher = pattern.matcher(contentDisposition);
968-
if (matcher.find())
969-
filename = matcher.group(1);
970-
}
971-
972-
String prefix;
973-
String suffix = null;
974-
if (filename == null) {
975-
prefix = "download-";
976-
suffix = "";
977-
} else {
978-
int pos = filename.lastIndexOf('.');
979-
if (pos == -1) {
980-
prefix = filename + "-";
981-
} else {
982-
prefix = filename.substring(0, pos) + "-";
983-
suffix = filename.substring(pos);
984-
}
985-
// File.createTempFile requires the prefix to be at least three characters long
986-
if (prefix.length() < 3)
987-
prefix = "download-";
988-
}
989-
990-
if (tempFolderPath == null)
991-
return File.createTempFile(prefix, suffix);
992-
else
993-
return File.createTempFile(prefix, suffix, new File(tempFolderPath));
994-
}
995-
996930
/**
997931
* Invoke API by sending HTTP request with the given options.
998932
*

0 commit comments

Comments
 (0)