File tree Expand file tree Collapse file tree 2 files changed +33
-5
lines changed
main/java/com/spotify/github/v3/search/requests
test/java/com/spotify/github/v3/search/requests Expand file tree Collapse file tree 2 files changed +33
-5
lines changed Original file line number Diff line number Diff line change 20
20
21
21
package com .spotify .github .v3 .search .requests ;
22
22
23
+ import java .util .Optional ;
24
+
25
+ import javax .annotation .Nullable ;
26
+
27
+ import org .immutables .value .Value ;
28
+
23
29
import com .fasterxml .jackson .databind .annotation .JsonDeserialize ;
24
30
import com .fasterxml .jackson .databind .annotation .JsonSerialize ;
25
31
import com .spotify .github .GithubStyle ;
26
32
import com .spotify .github .Parameters ;
27
- import java .util .Optional ;
28
- import javax .annotation .Nullable ;
29
- import org .immutables .value .Value ;
30
33
31
34
/**
32
35
* Search parameters resource defines required and optional parameters. To be serialized as
@@ -47,4 +50,15 @@ public interface SearchParameters extends Parameters {
47
50
48
51
/** The sort order if sort parameter is provided. One of asc or desc. Default: desc */
49
52
Optional <String > order ();
53
+
54
+ /**
55
+ * The number of results per page (max 100). Default: 30
56
+ */
57
+ @ SuppressWarnings ("checkstyle:methodname" )
58
+ Optional <Integer > per_page ();
59
+
60
+ /**
61
+ * Page number of the results to fetch. Default: 1
62
+ */
63
+ Optional <Integer > page ();
50
64
}
Original file line number Diff line number Diff line change 7
7
* Licensed under the Apache License, Version 2.0 (the "License");
8
8
* you may not use this file except in compliance with the License.
9
9
* You may obtain a copy of the License at
10
- *
10
+ *
11
11
* http://www.apache.org/licenses/LICENSE-2.0
12
- *
12
+ *
13
13
* Unless required by applicable law or agreed to in writing, software
14
14
* distributed under the License is distributed on an "AS IS" BASIS,
15
15
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -34,8 +34,22 @@ public void testFullSerialize() {
34
34
.q ("bogus-query" )
35
35
.sort ("bogus-sort" )
36
36
.order ("bogus-order" )
37
+ .per_page (50 )
38
+ .page (2 )
37
39
.build ();
38
40
41
+ assertThat (params .serialize (), is ("order=bogus-order&page=2&per_page=50&q=bogus-query&sort=bogus-sort" ));
42
+ }
43
+
44
+ @ Test
45
+ public void testSerializeWithoutPageAndPerPageParameters () {
46
+ final SearchParameters params =
47
+ ImmutableSearchParameters .builder ()
48
+ .q ("bogus-query" )
49
+ .sort ("bogus-sort" )
50
+ .order ("bogus-order" )
51
+ .build ();
52
+
39
53
assertThat (params .serialize (), is ("order=bogus-order&q=bogus-query&sort=bogus-sort" ));
40
54
}
41
55
}
You can’t perform that action at this time.
0 commit comments