1
- package de .tud .cs .stg .zenodo ;
1
+ package de .upb .cs .swt .zenodo ;
2
2
3
3
import com .fasterxml .jackson .annotation .JsonInclude ;
4
4
import com .fasterxml .jackson .core .JsonProcessingException ;
5
5
import com .fasterxml .jackson .core .type .TypeReference ;
6
6
import com .fasterxml .jackson .databind .util .ISO8601DateFormat ;
7
7
import com .mashape .unirest .http .HttpResponse ;
8
- import com .mashape .unirest .http .JsonNode ;
9
8
import com .mashape .unirest .http .ObjectMapper ;
10
9
import com .mashape .unirest .http .Unirest ;
11
10
import com .mashape .unirest .http .exceptions .UnirestException ;
12
11
import com .mashape .unirest .request .GetRequest ;
13
12
import com .mashape .unirest .request .HttpRequestWithBody ;
14
- import com .mashape .unirest .request .body .MultipartBody ;
15
13
import com .mashape .unirest .request .body .RequestBodyEntity ;
16
14
17
15
import java .io .ByteArrayOutputStream ;
18
- import java .io .File ;
19
16
import java .io .IOException ;
20
17
import java .text .ParseException ;
21
18
import java .util .ArrayList ;
27
24
*/
28
25
public class ZenodoClient implements ZenodoAPI {
29
26
30
- private static final String productionToken = "E7MJ0NJUzEwLKk9FH5f3xcaj2DgSgxZpR83kEn2EneMuR42YkeD7dM3Znn6b " ;
31
- private static final String sandboxToken = "HWiH1QCdIj81fj0a9vB9knBzfH8puk55NXiEZqkumpILavP2BHgKnjgUEyc9 " ;
27
+ private static final String productionToken = "tokengoeshere " ;
28
+ private static final String sandboxToken = "tokengoeshere " ;
32
29
33
30
private static final String sandboxURL = "https://sandbox.zenodo.org/" ;
34
31
private static final String productionURL = "https://zenodo.org/" ;
@@ -171,7 +168,7 @@ public Deposition createDeposition(final Metadata m) throws UnsupportedOperation
171
168
data = objectMapper .writeValue (new Object () {
172
169
public Metadata metadata = m ;
173
170
});
174
-
171
+
175
172
RequestBodyEntity completePost = post .body (data );
176
173
completePost .getEntity ().writeTo (bytes );
177
174
System .out .println (bytes .toString ());
@@ -184,7 +181,7 @@ public Deposition createDeposition(final Metadata m) throws UnsupportedOperation
184
181
}
185
182
return null ;
186
183
}
187
-
184
+
188
185
/**
189
186
* Created by agupta on 19.11.18. to get the list of files for a particular
190
187
* deposition
@@ -219,7 +216,7 @@ public DepositionFile uploadFile(final FileMetadata f, Integer depositionId) thr
219
216
System .out .println (response .getStatus () + " " + response .getStatusText () + response .getBody ().toString ());
220
217
return response .getBody ();
221
218
222
- } catch (UnirestException e ) {
219
+ } catch (UnirestException e ) {
223
220
e .printStackTrace ();
224
221
225
222
}
@@ -284,9 +281,9 @@ private HttpRequestWithBody prepareDeleteRequest(String url) {
284
281
//// "API test",
285
282
//// "1.0",
286
283
//// Metadata.AccessRight.CLOSED);
287
- ////
284
+ ////
288
285
//// Deposition deposition = client.createDeposition(firstTry);
289
- //
286
+ //
290
287
// HttpResponse<JsonNode> jsonResponse = Unirest.post("https://sandbox.zenodo.org/"+API.Deposit.Files).routeParam("id", Integer.toString(252680))
291
288
// .header("Authorization", "Bearer "+ sandboxToken)
292
289
// .header("accept", "application/json")
@@ -305,9 +302,9 @@ private HttpRequestWithBody prepareDeleteRequest(String url) {
305
302
// for (DepositionFile f : files) {
306
303
// System.out.println(f.filename + " " + f.id + " " + f.filesize + " " + f.links.download);
307
304
// }
308
- //
309
- //
310
- //
305
+ //
306
+ //
307
+ //
311
308
//
312
309
// }
313
310
}
0 commit comments