changed deprecated method with non deprecated versioen

This commit is contained in:
Miriam Baglioni 2020-10-30 14:10:10 +01:00
parent 14bf2e7238
commit 10d8bbada8
1 changed files with 12 additions and 11 deletions

View File

@ -59,8 +59,7 @@ public class ZenodoAPIClient implements Serializable {
String json = "{}";
OkHttpClient httpClient = new OkHttpClient.Builder().connectTimeout(600, TimeUnit.SECONDS).build();
//RequestBody body = RequestBody.create(MEDIA_TYPE_JSON, json);
// RequestBody body = RequestBody.create(MEDIA_TYPE_JSON, json);
RequestBody body = RequestBody.create(json, MEDIA_TYPE_JSON);
@ -101,7 +100,8 @@ public class ZenodoAPIClient implements Serializable {
OkHttpClient httpClient = new OkHttpClient.Builder()
.writeTimeout(600, TimeUnit.SECONDS)
.readTimeout(600, TimeUnit.SECONDS)
.connectTimeout(600, TimeUnit.SECONDS).build();
.connectTimeout(600, TimeUnit.SECONDS)
.build();
Request request = new Request.Builder()
.url(bucket + "/" + file_name)
@ -128,7 +128,7 @@ public class ZenodoAPIClient implements Serializable {
OkHttpClient httpClient = new OkHttpClient.Builder().connectTimeout(600, TimeUnit.SECONDS).build();
//RequestBody body = RequestBody.create(MEDIA_TYPE_JSON, metadata);
// RequestBody body = RequestBody.create(MEDIA_TYPE_JSON, metadata);
RequestBody body = RequestBody.create(metadata, MEDIA_TYPE_JSON);
Request request = new Request.Builder()
@ -166,7 +166,7 @@ public class ZenodoAPIClient implements Serializable {
Request request = new Request.Builder()
.url(urlString + "/" + deposition_id + "/actions/publish")
.addHeader("Authorization", "Bearer " + access_token)
//.post(RequestBody.create(MEDIA_TYPE_JSON, json))
// .post(RequestBody.create(MEDIA_TYPE_JSON, json))
.post(body)
.build();
@ -202,7 +202,7 @@ public class ZenodoAPIClient implements Serializable {
Request request = new Request.Builder()
.url(urlString + "/" + deposition_id + "/actions/newversion")
.addHeader("Authorization", "Bearer " + access_token)
//.post(RequestBody.create(MEDIA_TYPE_JSON, json))
// .post(RequestBody.create(MEDIA_TYPE_JSON, json))
.post(body)
.build();
@ -285,7 +285,8 @@ public class ZenodoAPIClient implements Serializable {
private String getBucket(String url) throws IOException {
OkHttpClient httpClient = new OkHttpClient.Builder()
.connectTimeout(600, TimeUnit.SECONDS).build();
.connectTimeout(600, TimeUnit.SECONDS)
.build();
Request request = new Request.Builder()
.url(url)