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) 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 params) throws Exception;
69

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

    
74
    @RequestMapping(value = "/addInterface", method = RequestMethod.POST,
75
            consumes = MediaType.APPLICATION_JSON_VALUE)
76
    @ResponseBody
77
    RepositoryInterface addRepositoryInterface(String params) throws JSONException;
78

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

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

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

    
94
    @RequestMapping(value = "/updateManagedStatus", method = RequestMethod.POST,
95
            produces = MediaType.APPLICATION_JSON_VALUE)
96
    @ResponseBody
97
    String updateManagedStatus(String id, String managed);
98

    
99
    @RequestMapping(value = "/updateEnglishName", method = RequestMethod.POST,
100
            produces = MediaType.APPLICATION_JSON_VALUE)
101
    @ResponseBody
102
    String updateEnglishName(String id, String englishName);
103

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

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

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

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

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

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

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

    
139

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

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

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

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

    
162

    
163
    String getCountryName(String countryCode);
164
}
(7-7/10)