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.web.bind.annotation.*;
10

    
11
import java.io.IOException;
12
import java.util.List;
13
import java.util.Map;
14

    
15
@RestController
16
@RequestMapping(value = "/broker")
17
@Api(description = "Broker API",  tags = {"broker"})
18
public interface BrokerApi {
19

    
20
    @RequestMapping(value = "/getDatasourcesOfUser" , method = RequestMethod.POST,produces = MediaType.APPLICATION_JSON_VALUE)
21
    DatasourcesBroker getDatasourcesOfUser(@RequestBody String params) throws BrokerException, JSONException;
22

    
23
    @RequestMapping(value = "/getTopicsForDatasource/{datasourceName}" , method = RequestMethod.GET,produces = MediaType.APPLICATION_JSON_VALUE)
24
    List<BrowseEntry> getTopicsForDatasource(String datasourceName) throws BrokerException;
25

    
26
    @RequestMapping(value = "/advancedShowEvents" , method = RequestMethod.POST,produces = MediaType.APPLICATION_JSON_VALUE)
27
    EventsPage advancedShowEvents(@RequestBody String params) throws BrokerException, JSONException ,IOException;
28

    
29
    @RequestMapping(value = "/showEvents" , method = RequestMethod.POST,produces = MediaType.APPLICATION_JSON_VALUE)
30
    EventsPage showEvents(@RequestBody String params) throws BrokerException, JSONException;
31

    
32
    @RequestMapping(value = "/getSimpleSubscriptionsOfUser/{userEmail}" , method = RequestMethod.GET,produces = MediaType.APPLICATION_JSON_VALUE)
33
    @ResponseBody
34
    Map<String, List<SimpleSubscriptionDesc>> getSimpleSubscriptionsOfUser(String userEmail) throws BrokerException;
35

    
36
    @RequestMapping(value = "/subscribe" , method = RequestMethod.GET,produces = MediaType.APPLICATION_JSON_VALUE)
37
    @ResponseBody
38
    Subscription subscribe(@RequestBody OpenaireSubscription obj) throws BrokerException;
39

    
40
    @RequestMapping(value = "/unsubscribe/{subscriptionId}" , method = RequestMethod.GET,produces = MediaType.APPLICATION_JSON_VALUE)
41
    @ResponseBody
42
    void unsubscribe(String subscriptionId) throws BrokerException;
43

    
44
    @RequestMapping(value = "/getSubscription/{subscriptionId}" , method = RequestMethod.GET,produces = MediaType.APPLICATION_JSON_VALUE)
45
    @ResponseBody
46
    Subscription getSubscription(@PathVariable("subscriptionId") String subscriptionId) throws BrokerException;
47

    
48

    
49
    @RequestMapping(value = "/getDnetTopics" , method = RequestMethod.GET,produces = MediaType.APPLICATION_JSON_VALUE)
50
    @ResponseBody
51
    Map<String, Term> getDnetTopics() throws BrokerException;
52

    
53
    @RequestMapping(value = "/getNotificationsBySubscriptionId/{subscriptionId}/{page}/{size}" , method = RequestMethod.GET
54
            ,produces = MediaType.APPLICATION_JSON_VALUE)
55
    @ResponseBody
56
    EventsPage getNotificationsBySubscriptionId(String subscriptionId,String page,String size) throws BrokerException;
57

    
58
    @RequestMapping(value = "/getSubscriptionsOfUser/{userEmail}" , method = RequestMethod.GET
59
            ,produces = MediaType.APPLICATION_JSON_VALUE)
60
    @ResponseBody
61
    Map<String, List<Subscription>> getSubscriptionsOfUser(String userEmail) throws BrokerException;
62
}
(1-1/12)