2017-12-07 18:57:12 +01:00
|
|
|
package eu.dnetlib.repo.manager.service.controllers;
|
|
|
|
|
|
|
|
import eu.dnetlib.repo.manager.shared.BrokerException;
|
2018-01-15 21:18:16 +01:00
|
|
|
import eu.dnetlib.repo.manager.shared.Term;
|
2017-12-07 18:57:12 +01:00
|
|
|
import eu.dnetlib.repo.manager.shared.broker.*;
|
2018-01-24 11:11:57 +01:00
|
|
|
import io.swagger.annotations.Api;
|
2018-02-06 15:59:03 +01:00
|
|
|
import io.swagger.annotations.ApiParam;
|
2017-12-07 18:57:12 +01:00
|
|
|
import org.json.JSONException;
|
|
|
|
import org.springframework.http.MediaType;
|
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
|
|
import java.io.IOException;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.Map;
|
|
|
|
|
|
|
|
@RestController
|
|
|
|
@RequestMapping(value = "/broker")
|
|
|
|
@Api(description = "Broker API", tags = {"broker"})
|
|
|
|
public interface BrokerApi {
|
|
|
|
|
2018-02-21 16:05:02 +01:00
|
|
|
@RequestMapping(value = "/getDatasourcesOfUser" , method = RequestMethod.POST,
|
|
|
|
produces = MediaType.APPLICATION_JSON_VALUE)
|
|
|
|
@ResponseBody
|
2018-02-12 15:10:57 +01:00
|
|
|
DatasourcesBroker getDatasourcesOfUser(String user,String includeShared,String includeByOthers) throws BrokerException, JSONException;
|
2017-12-07 18:57:12 +01:00
|
|
|
|
2018-02-21 16:05:02 +01:00
|
|
|
@RequestMapping(value = "/getTopicsForDatasource/{datasourceName}" , method = RequestMethod.GET,
|
|
|
|
produces = MediaType.APPLICATION_JSON_VALUE)
|
|
|
|
@ResponseBody
|
2017-12-07 18:57:12 +01:00
|
|
|
List<BrowseEntry> getTopicsForDatasource(String datasourceName) throws BrokerException;
|
|
|
|
|
2018-02-21 16:05:02 +01:00
|
|
|
@RequestMapping(value = "/advancedShowEvents/{page}/{size}" , method = RequestMethod.POST,
|
|
|
|
produces = MediaType.APPLICATION_JSON_VALUE)
|
|
|
|
@ResponseBody
|
2018-02-15 08:45:37 +01:00
|
|
|
EventsPage advancedShowEvents(String page,
|
|
|
|
String size,
|
|
|
|
AdvQueryObject advQueryObject) throws BrokerException, JSONException ,IOException;
|
2017-12-07 18:57:12 +01:00
|
|
|
|
2018-02-21 16:05:02 +01:00
|
|
|
@RequestMapping(value = "/showEvents/{datasourceName}/{topic}/{page}" , method = RequestMethod.GET,
|
|
|
|
produces = MediaType.APPLICATION_JSON_VALUE)
|
|
|
|
@ResponseBody
|
2018-02-15 08:45:37 +01:00
|
|
|
EventsPage showEvents(String datasourceName,
|
|
|
|
String topic,
|
2018-02-22 11:55:56 +01:00
|
|
|
String page,
|
|
|
|
String size) throws BrokerException, JSONException;
|
2017-12-07 18:57:12 +01:00
|
|
|
|
2018-02-21 16:05:02 +01:00
|
|
|
@RequestMapping(value = "/getSimpleSubscriptionsOfUser/{userEmail}" , method = RequestMethod.GET,
|
|
|
|
produces = MediaType.APPLICATION_JSON_VALUE)
|
2017-12-07 18:57:12 +01:00
|
|
|
@ResponseBody
|
2018-02-15 08:45:37 +01:00
|
|
|
Map<String, List<SimpleSubscriptionDesc>> getSimpleSubscriptionsOfUser(String userEmail) throws BrokerException;
|
2017-12-07 18:57:12 +01:00
|
|
|
|
2018-02-12 15:10:57 +01:00
|
|
|
@RequestMapping(value = "/subscribe" , method = RequestMethod.POST,consumes = MediaType.APPLICATION_JSON_VALUE,
|
|
|
|
produces = MediaType.APPLICATION_JSON_VALUE)
|
2017-12-07 18:57:12 +01:00
|
|
|
@ResponseBody
|
2018-02-15 08:45:37 +01:00
|
|
|
Subscription subscribe(OpenaireSubscription obj) throws BrokerException;
|
2017-12-07 18:57:12 +01:00
|
|
|
|
2018-02-12 15:10:57 +01:00
|
|
|
@RequestMapping(value = "/unsubscribe/{subscriptionId}" , method = RequestMethod.POST,consumes = MediaType.APPLICATION_JSON_VALUE,
|
|
|
|
produces = MediaType.APPLICATION_JSON_VALUE)
|
2017-12-07 18:57:12 +01:00
|
|
|
@ResponseBody
|
|
|
|
void unsubscribe(String subscriptionId) throws BrokerException;
|
|
|
|
|
|
|
|
@RequestMapping(value = "/getSubscription/{subscriptionId}" , method = RequestMethod.GET,produces = MediaType.APPLICATION_JSON_VALUE)
|
|
|
|
@ResponseBody
|
2018-02-15 08:45:37 +01:00
|
|
|
Subscription getSubscription(String subscriptionId) throws BrokerException;
|
2018-01-15 21:18:16 +01:00
|
|
|
|
|
|
|
|
|
|
|
@RequestMapping(value = "/getDnetTopics" , method = RequestMethod.GET,produces = MediaType.APPLICATION_JSON_VALUE)
|
|
|
|
@ResponseBody
|
|
|
|
Map<String, Term> getDnetTopics() throws BrokerException;
|
2018-01-24 16:10:47 +01:00
|
|
|
|
|
|
|
@RequestMapping(value = "/getNotificationsBySubscriptionId/{subscriptionId}/{page}/{size}" , method = RequestMethod.GET
|
|
|
|
,produces = MediaType.APPLICATION_JSON_VALUE)
|
|
|
|
@ResponseBody
|
|
|
|
EventsPage getNotificationsBySubscriptionId(String subscriptionId,String page,String size) throws BrokerException;
|
2018-01-25 16:14:19 +01:00
|
|
|
|
2018-02-27 14:41:12 +01:00
|
|
|
/*@RequestMapping(value = "/getSubscriptionsOfUser/{userEmail}" , method = RequestMethod.GET
|
2018-01-25 16:14:19 +01:00
|
|
|
,produces = MediaType.APPLICATION_JSON_VALUE)
|
2018-02-27 14:41:12 +01:00
|
|
|
@ResponseBody*/
|
2018-01-25 16:14:19 +01:00
|
|
|
Map<String, List<Subscription>> getSubscriptionsOfUser(String userEmail) throws BrokerException;
|
2017-12-07 18:57:12 +01:00
|
|
|
}
|