blob: 0d42bf60eef8432b382ccf6587f4e56da9180b87 [file] [log] [blame]
Viktar Donichbc8088e2018-04-23 15:29:57 -07001= Gerrit Code Review - Repo admin customization API
2
3This API is provided by link:pg-plugin-dev.html#plugin-rest-api[plugin.restApi()]
4and provides interface for Gerrit REST API.
5
6== getLoggedIn
7`repoApi.getLoggedIn()`
8
9Get user logged in status.
10
11.Params
12- None
13
14.Returns
15- Promise<boolean>
16
17== getVersion
18`repoApi.getVersion()`
19
20Get server version.
21
22.Params
23- None
24
25.Returns
26- Promise<string>
27
Thomas Draebing996639a2019-10-24 17:09:28 +020028== getConfig
29`repoApi.getConfig()`
30
31Get server config.
32
33.Params
34- None
35
36.Returns
37- Promise<Object>
38
Viktar Donichbc8088e2018-04-23 15:29:57 -070039== get
40`repoApi.get(url)`
41
42Issues a GET REST API call to the URL, returns Promise that is resolved to
43parsed response on success. Returned Promise is rejected on network error.
44
45.Params
46- *url* String URL without base path or plugin prefix.
47
48.Returns
49- Promise<Object> Parsed response.
50
51== post
52`repoApi.post(url, opt_payload)`
53
54Issues a POST REST API call to the URL, returns Promise that is resolved to
55parsed response on success. Returned Promise is rejected on network error.
56
57.Params
58- *url* String URL without base path or plugin prefix.
59- *opt_payload* (optional) Object Payload to be sent with the request.
60
61.Returns
62- Promise<Object> Parsed response.
63
64== put
65`repoApi.put(url, opt_payload)`
66
67Issues a PUT REST API call to the URL, returns Promise that is resolved to
68parsed response on success. Returned Promise is rejected on network error.
69
70.Params
71- *url* String URL without base path or plugin prefix.
72- *opt_payload* (optional) Object Payload to be sent with the request.
73
74.Returns
75- Promise<Object> Parsed response.
76
77== delete
78`repoApi.delete(url)`
79
80Issues a DELETE REST API call to the URL, returns Promise that is resolved to
81parsed response on HTTP 204, and rejected otherwise.
82
83.Params
84- *url* String URL without base path or plugin prefix.
85
86.Returns
87- Promise<Response> Fetch API's Response object.
88
89== send
90`repoApi.send(method, url, opt_payload)`
91
92Send payload and parse the response, if request succeeds. Returned Promise is
93rejected with detailed message or HTTP error code on network error.
94
95.Params
96- *method* String HTTP method.
97- *url* String URL without base path or plugin prefix.
98- *opt_payload* (optional) Object Respected for POST and PUT only.
99
100.Returns
101- Promise<Object> Parsed response.
102
103== fetch
104`repoApi.fetch(method, url, opt_payload)`
105
106Send payload and return native Response. This method is for low-level access, to
107implement custom error handling and parsing.
108
109.Params
110- *method* String HTTP method.
111- *url* String URL without base path or plugin prefix.
112- *opt_payload* (optional) Object Respected for POST and PUT only.
113
114.Returns
115- Promise<Response> Fetch API's Response object.