Project

General

Profile

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

    
3
import eu.dnetlib.domain.data.Repository;
4
import eu.dnetlib.domain.data.RepositoryInterface;
5
import eu.dnetlib.domain.functionality.UserProfile;
6
import eu.dnetlib.repo.manager.shared.*;
7
import io.swagger.annotations.Api;
8
import org.json.JSONException;
9
import org.springframework.http.MediaType;
10
import org.springframework.web.bind.annotation.*;
11

    
12
import java.util.List;
13
import java.util.Map;
14

    
15

    
16
@RestController
17
@RequestMapping(value = "/repository")
18
@Api(description = "Repository API",  tags = {"repository"})
19
public interface RepositoryApi {
20
    
21
    @RequestMapping(value = "/testAggregations", method = RequestMethod.GET,
22
            produces = MediaType.APPLICATION_JSON_VALUE)
23
    @ResponseBody
24
    List<String> testAggregations() throws JSONException;
25

    
26
    @RequestMapping(value = "/getCountries", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
27
    @ResponseBody
28
    Country[] getCountries() ;
29

    
30
    @RequestMapping(value = "/getRepositoriesByCountry/{country}/{mode}", method = RequestMethod.GET,
31
            produces = MediaType.APPLICATION_JSON_VALUE)
32
    @ResponseBody
33
    List<Repository> getRepositoriesByCountry(String country, String mode, Boolean managed) throws JSONException;
34

    
35
    @RequestMapping(value = "/getRepositoriesOfUser/{userEmail}/{page}/{size}",method = RequestMethod.GET,
36
            produces = MediaType.APPLICATION_JSON_VALUE)
37
    @ResponseBody
38
    List<Repository> getRepositoriesOfUser(String userEmail,
39
                                           String page,
40
                                           String size) throws JSONException;
41

    
42
    @RequestMapping(value = "/getRepositoryById/{id}", method = RequestMethod.GET,
43
            produces = MediaType.APPLICATION_JSON_VALUE)
44
    @ResponseBody
45
    Repository getRepositoryById(String id) throws JSONException;
46

    
47

    
48
    @RequestMapping(value = "/getRepositoryAggregations/{id}", method = RequestMethod.GET,
49
            produces = MediaType.APPLICATION_JSON_VALUE)
50
    @ResponseBody
51
    Aggregations getRepositoryAggregations(String id) throws JSONException;
52

    
53

    
54
    @RequestMapping(value = "/getRepositoriesByName/{name}/{page}/{size}/", method = RequestMethod.GET,
55
            produces = MediaType.APPLICATION_JSON_VALUE)
56
    @ResponseBody
57
    List<Repository> getRepositoriesByName(String name,
58
                                           String page,
59
                                           String size) throws JSONException;
60

    
61
    @RequestMapping(value = "/getRepositoryInterface/{id}", method = RequestMethod.GET,
62
            produces = MediaType.APPLICATION_JSON_VALUE)
63
    @ResponseBody
64
    List<RepositoryInterface> getRepositoryInterface(String id) throws JSONException;
65

    
66
    @RequestMapping(value = "/addRepository", method = RequestMethod.POST,
67
            consumes = MediaType.APPLICATION_JSON_VALUE)
68
    @ResponseBody
69
    Repository addRepository(String datatype, Repository repository) throws Exception;
70

    
71

    
72
    @RequestMapping(value = "/deleteInterface/", method = RequestMethod.DELETE)
73
    void deleteRepositoryInterface(String id);
74

    
75
    @RequestMapping(value = "/addInterface", method = RequestMethod.POST,
76
            consumes = MediaType.APPLICATION_JSON_VALUE)
77
    @ResponseBody
78
    RepositoryInterface addRepositoryInterface(String datatype,
79
                                               String repoId,
80
                                               RepositoryInterface iFace) throws JSONException;
81

    
82
    @RequestMapping(value = "/getDnetCountries", method = RequestMethod.GET,
83
            produces = MediaType.APPLICATION_JSON_VALUE)
84
    @ResponseBody
85
    List<String> getDnetCountries();
86

    
87
    @RequestMapping(value = "/getTypologies", method = RequestMethod.GET,
88
            produces = MediaType.APPLICATION_JSON_VALUE)
89
    @ResponseBody
90
    List<String> getTypologies();
91

    
92
    @RequestMapping(value = "/getTimezones", method = RequestMethod.GET,
93
            produces = MediaType.APPLICATION_JSON_VALUE)
94
    @ResponseBody
95
    List<Timezone> getTimezones();
96

    
97
    @RequestMapping(value = "/updateRepository", method = RequestMethod.POST,
98
            consumes = MediaType.APPLICATION_JSON_VALUE)
99
    @ResponseBody
100
    Repository updateRepository(Repository repository) throws JSONException;
101
    
102
    @RequestMapping(value = "/getUrlsOfUserRepos/{user_email}/{page}/{size}/",method = RequestMethod.GET,
103
            produces = MediaType.APPLICATION_JSON_VALUE)
104
    @ResponseBody
105
    List<String> getUrlsOfUserRepos(String user_email,
106
                                    String page,
107
                                    String size) throws JSONException;
108

    
109
    @RequestMapping(value = "/getDatasourceVocabularies/{mode}",method = RequestMethod.GET,
110
            produces = MediaType.APPLICATION_JSON_VALUE)
111
    @ResponseBody
112
    List<String> getDatasourceVocabularies(String mode);
113

    
114
    @RequestMapping(value = "/getCompatibilityClasses/{mode}",method = RequestMethod.GET,
115
            produces = MediaType.APPLICATION_JSON_VALUE)
116
    @ResponseBody
117
    Map<String, String> getCompatibilityClasses(String mode);
118

    
119
    @RequestMapping(value = "/getDatasourceClasses/{mode}",method = RequestMethod.GET,
120
            produces = MediaType.APPLICATION_JSON_VALUE)
121
    @ResponseBody
122
    Map<String, String> getDatasourceClasses(String mode);
123

    
124

    
125
    String getCountryName(String countryCode);
126

    
127
    @RequestMapping(value = "/getMetricsInfoForRepository/{repoId}",method = RequestMethod.GET,
128
            produces = MediaType.APPLICATION_JSON_VALUE)
129
    @ResponseBody
130
    MetricsInfo getMetricsInfoForRepository(String repoId) throws RepositoryServiceException;
131

    
132
    @RequestMapping(value = "/getListLatestUpdate/{mode}",method = RequestMethod.GET,
133
            produces = MediaType.APPLICATION_JSON_VALUE)
134
    @ResponseBody
135
    Map<String, String> getListLatestUpdate(String mode) throws RepositoryServiceException, JSONException;
136

    
137
    @RequestMapping(value = "/updateRepositoryInterface", method = RequestMethod.POST,
138
            consumes = MediaType.APPLICATION_JSON_VALUE)
139
    @ResponseBody
140
    RepositoryInterface updateRepositoryInterface(String repositoryId,RepositoryInterface repositoryInterface) throws JSONException;
141

    
142

    
143

    
144
}
(9-9/14)