Skip to content

Commit 4f9c741

Browse files
OsD977Gianluca Lain
andauthored
Add searchExact and searchPrecise support to game filters (#2)
* Add searchExact and searchPrecise support to game filters; update test to support searchExact and searchPrecise Co-authored-by: Gianluca Lain <gianluca.lain@inf.ethz.ch>
1 parent d1c94e4 commit 4f9c741

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

filters.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,18 @@ func (filter *GamesFilter) WithoutGameSeries() *GamesFilter {
159159
return filter
160160
}
161161

162+
// WithSearchExact sets "search_exact" parameter
163+
func (filter *GamesFilter) WithSearchExact() *GamesFilter {
164+
filter.searchExact = true
165+
return filter
166+
}
167+
168+
// WithSearchPrecise sets "search_precise" parameter
169+
func (filter *GamesFilter) WithSearchPrecise() *GamesFilter {
170+
filter.searchPrecise = true
171+
return filter
172+
}
173+
162174
// SetOrdering sets results ordering
163175
func (filter *GamesFilter) SetOrdering(ordering string) *GamesFilter {
164176
filter.ordering = ordering

filters_test.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,9 @@ func TestNewGamesFilter(t *testing.T) {
4444
WithoutParents().
4545
WithoutGameSeries().
4646
SetOrdering("-name").
47-
SetMetacritic(20, 80)
47+
SetMetacritic(20, 80).
48+
WithSearchExact().
49+
WithSearchPrecise()
4850

4951
assert.Equal(t, map[string]interface{}{
5052
"creators": "28,mike-morasky",
@@ -54,6 +56,8 @@ func TestNewGamesFilter(t *testing.T) {
5456
"exclude_collection": 123,
5557
"exclude_game_series": true,
5658
"exclude_parents": true,
59+
"search_exact": true,
60+
"search_precise": true,
5761
"genres": "9,action,indie",
5862
"ordering": "-name",
5963
"page": 1,

0 commit comments

Comments
 (0)