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.repo.manager.shared.*;
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.util.List;
12
import java.util.Map;
13

    
14

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

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

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

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

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

    
46

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

    
52

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

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

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

    
70

    
71
    @RequestMapping(value = "/deleteInterface", method = RequestMethod.DELETE)
72
    @ResponseBody
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 = "/updateManagedStatus", method = RequestMethod.POST,
98
            produces = MediaType.APPLICATION_JSON_VALUE)
99
    @ResponseBody
100
    String updateManagedStatus(String id, String managed);
101

    
102
    @RequestMapping(value = "/updateEnglishName", method = RequestMethod.POST,
103
            produces = MediaType.APPLICATION_JSON_VALUE)
104
    @ResponseBody
105
    String updateEnglishName(String id,String officialName, String englishName);
106

    
107
    @RequestMapping(value = "/updateLatitude", method = RequestMethod.POST,
108
            produces = MediaType.APPLICATION_JSON_VALUE)
109
    @ResponseBody
110
    String updateLatitude(String id, String latitude);
111

    
112
    @RequestMapping(value = "/updateLongitude", method = RequestMethod.POST,
113
            produces = MediaType.APPLICATION_JSON_VALUE)
114
    @ResponseBody
115
    String updateLongitude(String id, String longitude);
116

    
117
    @RequestMapping(value = "/updateOfficialName", method = RequestMethod.POST,
118
            produces = MediaType.APPLICATION_JSON_VALUE)
119
    @ResponseBody
120
    String updateOfficialName(String id, String officialName);
121

    
122
    @RequestMapping(value = "/updateTimezone", method = RequestMethod.POST,
123
            produces = MediaType.APPLICATION_JSON_VALUE)
124
    @ResponseBody
125
    String updateTimezone(String id, String timezone);
126

    
127
    @RequestMapping(value = "/updateTypology", method = RequestMethod.POST,
128
            produces = MediaType.APPLICATION_JSON_VALUE)
129
    @ResponseBody
130
    String updateTypology(String id, String typology);
131

    
132
    @RequestMapping(value = "/updateLogoUrl", method = RequestMethod.POST,
133
            produces = MediaType.APPLICATION_JSON_VALUE)
134
    @ResponseBody
135
    String updateLogoUrl(String id, String logoUrl);
136

    
137
    @RequestMapping(value = "/updatePlatform", method = RequestMethod.POST,
138
            produces = MediaType.APPLICATION_JSON_VALUE)
139
    @ResponseBody
140
    String updatePlatform(String id, String platform);
141

    
142

    
143
    @RequestMapping(value = "/getUrlsOfUserRepos/{user_email}/{page}/{size}/",method = RequestMethod.GET,
144
            produces = MediaType.APPLICATION_JSON_VALUE)
145
    @ResponseBody
146
    List<String> getUrlsOfUserRepos(String user_email,
147
                                    String page,
148
                                    String size) throws JSONException;
149

    
150
    @RequestMapping(value = "/getDatasourceVocabularies/{mode}",method = RequestMethod.GET,
151
            produces = MediaType.APPLICATION_JSON_VALUE)
152
    @ResponseBody
153
    List<String> getDatasourceVocabularies(String mode);
154

    
155
    @RequestMapping(value = "/getCompatibilityClasses/{mode}",method = RequestMethod.GET,
156
            produces = MediaType.APPLICATION_JSON_VALUE)
157
    @ResponseBody
158
    Map<String, String> getCompatibilityClasses(String mode);
159

    
160
    @RequestMapping(value = "/getDatasourceClasses/{mode}",method = RequestMethod.GET,
161
            produces = MediaType.APPLICATION_JSON_VALUE)
162
    @ResponseBody
163
    Map<String, String> getDatasourceClasses(String mode);
164

    
165

    
166
    String getCountryName(String countryCode);
167

    
168
    @RequestMapping(value = "/getMetricsInfoForRepository/{repoId}",method = RequestMethod.GET,
169
            produces = MediaType.APPLICATION_JSON_VALUE)
170
    @ResponseBody
171
    MetricsInfo getMetricsInfoForRepository(String repoId) throws RepositoryServiceException;
172
}
(7-7/12)