@Api(order=4000, description="In most cases, build resource is operated with build id, which is different from build number. "
30
+
+ "To get build id of a particular build number, use the <a href='/help/api/io.onedev.server.rest.BuildResource/queryBasicInfo'>Query Basic Info</a> operation with query for "
31
+
+ "instance <code>"Number" is "projectName#100"</code>")
30
32
@Path("/builds")
31
33
@Consumes(MediaType.APPLICATION_JSON)
32
34
@Produces(MediaType.APPLICATION_JSON)
skipped 10 lines
43
45
@Api(order=100)
44
46
@Path("/{buildId}")
45
47
@GET
46
-
public Build get(@PathParam("buildId") Long buildId) {
48
+
public Build getBasicInfo(@PathParam("buildId") Long buildId) {
47
49
Build build = buildManager.load(buildId);
48
50
if (!SecurityUtils.canAccess(build))
49
51
throw new UnauthorizedException();
skipped 42 lines
92
94
93
95
@Api(order=600)
94
96
@GET
95
-
public List<Build> query(@QueryParam("query") String query, @QueryParam("offset") int offset,
96
-
@QueryParam("count") int count) {
97
+
public List<Build> queryBasicInfo(
98
+
@QueryParam("query") @Api(description="Syntax of this query is the same as query box in <a href='/builds'>builds page</a>", example="\"Number\" is \"projectName#100\"") String query,
99
+
@QueryParam("offset") @Api(example="0") int offset,
100
+
@QueryParam("count") @Api(example="100") int count) {
97
101
98
-
if (count > RestUtils.MAX_PAGE_SIZE)
99
-
throw new InvalidParamException("Count should be less than " + RestUtils.MAX_PAGE_SIZE);
102
+
if (count > RestConstants.MAX_PAGE_SIZE)
103
+
throw new InvalidParamException("Count should be less than " + RestConstants.MAX_PAGE_SIZE);
if (!SecurityUtils.canReadCode(comment.getProject()))
60
60
throw new UnauthorizedException();
skipped 12 lines
73
73
74
74
@Api(order=300)
75
75
@GET
76
-
public Collection<CodeComment> query(@QueryParam("projectId")LongprojectId,
77
-
@QueryParam("pullRequestId") Long pullRequestId, @QueryParam("query") String query,
78
-
@QueryParam("offset") int offset, @QueryParam("count") int count) {
76
+
public Collection<CodeComment> queryBasicInfo(
77
+
@QueryParam("projectId") Long projectId,
78
+
@QueryParam("pullRequestId") Long pullRequestId,
79
+
@QueryParam("query") @Api(description="Syntax of this query is the same as query box in project code comments page", example="created by me") String query,
80
+
@QueryParam("offset") @Api(example="0") int offset, @QueryParam("count") @Api(example="100") int count) {
79
81
80
-
if (count > RestUtils.MAX_PAGE_SIZE)
81
-
throw new InvalidParamException("Count should be less than " + RestUtils.MAX_PAGE_SIZE);
82
+
if (count > RestConstants.MAX_PAGE_SIZE)
83
+
throw new InvalidParamException("Count should be less than " + RestConstants.MAX_PAGE_SIZE);
@Api(order=2000, description="In most cases, issue resource is operated with issue id, which is different from issue number. "
55
+
+ "To get issue id of a particular issue number, use the <a href='/help/api/io.onedev.server.rest.IssueResource/queryBasicInfo'>Query Basic Info</a> operation with query for "
56
+
+ "instance <code>"Number" is "projectName#100"</code>")
54
57
@Path("/issues")
55
58
@Consumes(MediaType.APPLICATION_JSON)
56
59
@Produces(MediaType.APPLICATION_JSON)
skipped 24 lines
81
84
@Api(order=100)
82
85
@Path("/{issueId}")
83
86
@GET
84
-
public Issue get(@PathParam("issueId") Long issueId) {
87
+
public Issue getBasicInfo(@PathParam("issueId") Long issueId) {
85
88
Issue issue = issueManager.load(issueId);
86
89
if (!SecurityUtils.canAccess(issue.getProject()))
87
90
throw new UnauthorizedException();
skipped 72 lines
160
163
161
164
@Api(order=900)
162
165
@GET
163
-
public List<Issue> query(@QueryParam("query") String query, @QueryParam("offset") int offset,
164
-
@QueryParam("count") int count) {
166
+
public List<Issue> queryBasicInfo(
167
+
@QueryParam("query") @Api(description="Syntax of this query is the same as query box in <a href='/issues'>issues page</a>", example="\"Number\" is \"projectName#100\"") String query,
168
+
@QueryParam("offset") @Api(example="0") int offset,
169
+
@QueryParam("count") @Api(example="100") int count) {
165
170
166
-
if (count > RestUtils.MAX_PAGE_SIZE)
167
-
throw new InvalidParamException("Count should be less than " + RestUtils.MAX_PAGE_SIZE);
171
+
if (count > RestConstants.MAX_PAGE_SIZE)
172
+
throw new InvalidParamException("Count should be less than " + RestConstants.MAX_PAGE_SIZE);
168
173
169
174
IssueQuery parsedQuery;
170
175
try {
skipped 7 lines
178
183
179
184
@Api(order=1000)
180
185
@POST
181
-
public Long open(@NotNull @Valid IssueOpenData data) {
186
+
public Long create(@NotNull @Valid IssueOpenData data) {
public Project get(@Api(description="Internalidofproject")@PathParam("projectId") Long projectId) {
67
+
public Project getBasicInfo(@PathParam("projectId") Long projectId) {
66
68
Project project = projectManager.load(projectId);
67
69
if (!SecurityUtils.canAccess(project))
68
70
throw new UnauthorizedException();
skipped 50 lines
119
121
120
122
@Api(order=700)
121
123
@GET
122
-
public List<Project> query(@QueryParam("query") String query, @QueryParam("offset") int offset,
123
-
@QueryParam("count") int count) {
124
+
public List<Project> queryBasicInfo(
125
+
@QueryParam("query") @Api(description="Syntax of this query is the same as query box in <a href='/projects'>projects page</a>", example="\"Name\" is \"projectName\"") String query,
126
+
@QueryParam("offset") @Api(example="0") int offset,
127
+
@QueryParam("count") @Api(example="100") int count) {
124
128
125
-
if (count > RestUtils.MAX_PAGE_SIZE)
126
-
throw new InvalidParamException("Count should be less than " + RestUtils.MAX_PAGE_SIZE);
129
+
if (count > RestConstants.MAX_PAGE_SIZE)
130
+
throw new InvalidParamException("Count should be less than " + RestConstants.MAX_PAGE_SIZE);
127
131
128
132
ProjectQuery parsedQuery;
129
133
try {
skipped 9 lines
139
143
@Path("/{projectId}/milestones")
140
144
@GET
141
145
public List<Milestone> queryMilestones(@PathParam("projectId") Long projectId, @QueryParam("name") String name,
@Api(order=3000, description="In most cases, pull request resource is operated with pull request id, which is different from pull request number. "
55
+
+ "To get pull request id of a particular pull request number, use the <a href='/help/api/io.onedev.server.rest.PullRequestResource/queryBasicInfo'>Query Basic Info</a> operation with query for "
56
+
+ "instance <code>"Number" is "projectName#100"</code>")
54
57
@Path("/pull-requests")
55
58
@Consumes(MediaType.APPLICATION_JSON)
56
59
@Produces(MediaType.APPLICATION_JSON)
skipped 17 lines
74
77
@Api(order=100)
75
78
@Path("/{requestId}")
76
79
@GET
77
-
public PullRequest get(@PathParam("requestId") Long requestId) {
80
+
public PullRequest getBasicInfo(@PathParam("requestId") Long requestId) {
if (!SecurityUtils.canReadCode(pullRequest.getProject()))
80
83
throw new UnauthorizedException();
skipped 92 lines
173
176
174
177
@Api(order=1100)
175
178
@GET
176
-
public List<PullRequest> query(@QueryParam("query") String query, @QueryParam("offset") int offset,
177
-
@QueryParam("count") int count) {
179
+
public List<PullRequest> queryBasicInfo(
180
+
@QueryParam("query") @Api(description="Syntax of this query is the same as query box in <a href='/pull-requests'>pull requests page</a>", example="\"Number\" is \"projectName#100\"") String query,
181
+
@QueryParam("offset") @Api(example="0") int offset,
182
+
@QueryParam("count") @Api(example="100") int count) {
178
183
179
-
if (count > RestUtils.MAX_PAGE_SIZE)
180
-
throw new InvalidParamException("Count should be less than " + RestUtils.MAX_PAGE_SIZE);
184
+
if (count > RestConstants.MAX_PAGE_SIZE)
185
+
throw new InvalidParamException("Count should be less than " + RestConstants.MAX_PAGE_SIZE);
181
186
182
187
PullRequestQuery parsedQuery;
183
188
try {
skipped 7 lines
191
196
192
197
@Api(order=1200)
193
198
@POST
194
-
public Long open(@NotNull PullRequestOpenData data) {
199
+
public Long create(@NotNull PullRequestOpenData data) {
195
200
User user = SecurityUtils.getUser();
196
201
197
202
ProjectAndBranch target = new ProjectAndBranch(data.getTargetProjectId(), data.getTargetBranch());
skipped 193 lines
391
396
return Response.ok().build();
392
397
}
393
398
399
+
@EntityCreate(PullRequest.class)
394
400
public static class PullRequestOpenData implements Serializable {