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 2020
2121package com .spotify .github .v3 .search .requests ;
2222
23+ import java .util .Optional ;
24+
25+ import javax .annotation .Nullable ;
26+
27+ import org .immutables .value .Value ;
28+
2329import com .fasterxml .jackson .databind .annotation .JsonDeserialize ;
2430import com .fasterxml .jackson .databind .annotation .JsonSerialize ;
2531import com .spotify .github .GithubStyle ;
2632import com .spotify .github .Parameters ;
27- import java .util .Optional ;
28- import javax .annotation .Nullable ;
29- import org .immutables .value .Value ;
3033
3134/**
3235 * Search parameters resource defines required and optional parameters. To be serialized as
@@ -47,4 +50,15 @@ public interface SearchParameters extends Parameters {
4750
4851 /** The sort order if sort parameter is provided. One of asc or desc. Default: desc */
4952 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 ();
5064}
Original file line number Diff line number Diff line change 77 * Licensed under the Apache License, Version 2.0 (the "License");
88 * you may not use this file except in compliance with the License.
99 * You may obtain a copy of the License at
10- *
10+ *
1111 * http://www.apache.org/licenses/LICENSE-2.0
12- *
12+ *
1313 * Unless required by applicable law or agreed to in writing, software
1414 * distributed under the License is distributed on an "AS IS" BASIS,
1515 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -34,8 +34,22 @@ public void testFullSerialize() {
3434 .q ("bogus-query" )
3535 .sort ("bogus-sort" )
3636 .order ("bogus-order" )
37+ .per_page (50 )
38+ .page (2 )
3739 .build ();
3840
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+
3953 assertThat (params .serialize (), is ("order=bogus-order&q=bogus-query&sort=bogus-sort" ));
4054 }
4155}
You can’t perform that action at this time.
0 commit comments