Project

General

Profile

1
package eu.dnetlib.repo.manager.service.controllers;
2

    
3
import eu.dnetlib.repo.manager.shared.BrokerException;
4
import eu.dnetlib.repo.manager.shared.Term;
5
import eu.dnetlib.repo.manager.shared.broker.*;
6
import io.swagger.annotations.Api;
7
import org.json.JSONException;
8
import org.springframework.http.MediaType;
9
import org.springframework.http.ResponseEntity;
10
import org.springframework.security.access.prepost.PostAuthorize;
11
import org.springframework.security.access.prepost.PreAuthorize;
12
import org.springframework.web.bind.annotation.*;
13

    
14
import java.io.IOException;
15
import java.util.List;
16
import java.util.Map;
17

    
18
@RestController
19
@RequestMapping(value = "/broker")
20
@Api(description = "Broker API",  tags = {"broker"})
21
public interface BrokerApi {
22

    
23
    @RequestMapping(value = "/getDatasourcesOfUser" , method = RequestMethod.GET,
24
            produces = MediaType.APPLICATION_JSON_VALUE)
25
    @ResponseBody
26
    DatasourcesBroker getDatasourcesOfUser(String user,String includeShared,String includeByOthers) throws BrokerException, JSONException;
27

    
28
    @RequestMapping(value = "/getTopicsForDatasource/{datasourceName:.+}" , method = RequestMethod.GET,
29
            produces = MediaType.APPLICATION_JSON_VALUE)
30
    @ResponseBody
31
    List<BrowseEntry> getTopicsForDatasource(String datasourceName) throws BrokerException;
32

    
33
    @RequestMapping(value = "/advancedShowEvents/{page}/{size}" , method = RequestMethod.POST,
34
            produces = MediaType.APPLICATION_JSON_VALUE)
35
    @ResponseBody
36
    EventsPage advancedShowEvents(String page,
37
                                  String size,
38
                                  AdvQueryObject advQueryObject) throws BrokerException, JSONException ,IOException;
39

    
40
    @RequestMapping(value = "/showEvents/{datasourceName:.+}/{topic}/{page}" , method = RequestMethod.GET,
41
            produces = MediaType.APPLICATION_JSON_VALUE)
42
    @ResponseBody
43
    EventsPage showEvents(String datasourceName,
44
                          String topic,
45
                          String page,
46
                          String size) throws BrokerException, JSONException;
47

    
48
    @RequestMapping(value = "/getSimpleSubscriptionsOfUser/{userEmail}" , method = RequestMethod.GET,
49
            produces = MediaType.APPLICATION_JSON_VALUE)
50
    @ResponseBody
51
    Map<String, List<SimpleSubscriptionDesc>> getSimpleSubscriptionsOfUser(String userEmail) throws BrokerException;
52

    
53
    @RequestMapping(value = "/subscribe" , method = RequestMethod.POST,consumes = MediaType.APPLICATION_JSON_VALUE,
54
            produces = MediaType.APPLICATION_JSON_VALUE)
55
    @ResponseBody
56
    Subscription subscribe(OpenaireSubscription obj) throws BrokerException;
57

    
58
    @RequestMapping(value = "/unsubscribe/{subscriptionId}" , method = RequestMethod.POST,consumes = MediaType.APPLICATION_JSON_VALUE,
59
            produces = MediaType.APPLICATION_JSON_VALUE)
60
    @ResponseBody
61
    ResponseEntity<Object> unsubscribe(String subscriptionId) throws BrokerException;
62

    
63
    @RequestMapping(value = "/getSubscription/{subscriptionId}" , method = RequestMethod.GET,produces = MediaType.APPLICATION_JSON_VALUE)
64
    @ResponseBody
65
    Subscription getSubscription(String subscriptionId) throws BrokerException;
66

    
67

    
68
    @RequestMapping(value = "/getDnetTopics" , method = RequestMethod.GET,produces = MediaType.APPLICATION_JSON_VALUE)
69
    @ResponseBody
70
    Map<String, Term> getDnetTopics() throws BrokerException;
71

    
72
    @RequestMapping(value = "/getNotificationsBySubscriptionId/{subscriptionId}/{page}/{size}" , method = RequestMethod.GET
73
            ,produces = MediaType.APPLICATION_JSON_VALUE)
74
    @ResponseBody
75
    EventsPage getNotificationsBySubscriptionId(String subscriptionId,String page,String size) throws BrokerException;
76

    
77
    /*@RequestMapping(value = "/getSubscriptionsOfUser/{userEmail}" , method = RequestMethod.GET
78
            ,produces = MediaType.APPLICATION_JSON_VALUE)
79
    @ResponseBody*/
80
    Map<String, List<Subscription>> getSubscriptionsOfUser(String userEmail) throws BrokerException;
81
}
(1-1/19)