Skip to content

Commit b42a2ed

Browse files
committed
Add support for filtering discovery results by watch provider
1 parent ae365a7 commit b42a2ed

2 files changed

Lines changed: 86 additions & 0 deletions

File tree

lib/Tmdb/Model/Query/Discover/DiscoverMoviesQuery.php

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,49 @@ public function language($language)
120120
return $this;
121121
}
122122

123+
/**
124+
* An ISO 3166-1 code. Combine this filter with with_watch_providers in order to filter your results by a specific watch provider in a specific region.
125+
*
126+
* @param string $watchRegion
127+
* @return $this
128+
*/
129+
public function watchRegion($watchRegion)
130+
{
131+
$this->set('watch_region', $watchRegion);
132+
133+
return $this;
134+
}
135+
136+
/**
137+
* Only include movies with the specified watch providers. Combine with watch_region.
138+
*
139+
* @param array|string $watchProviders
140+
* @param int $mode
141+
* @return $this
142+
*/
143+
public function withWatchProviders($watchProviders, $mode = self::MODE_OR)
144+
{
145+
$this->set('with_watch_providers', $this->with($watchProviders, $mode));
146+
147+
return $this;
148+
}
149+
150+
/**
151+
* Only include movies with the specified monetization types. Combine with watch_region.
152+
*
153+
* Allowed Values: flatrate, free, ads, rent, buy
154+
*
155+
* @param array|string $watchProviders
156+
* @param int $mode
157+
* @return $this
158+
*/
159+
public function withWatchMonetizationTypes($watchProviders, $mode = self::MODE_OR)
160+
{
161+
$this->set('with_watch_monetization_types', $this->with($watchProviders, $mode));
162+
163+
return $this;
164+
}
165+
123166
/**
124167
* Minimum value is 1, expected value is an integer.
125168
*

lib/Tmdb/Model/Query/Discover/DiscoverTvQuery.php

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,49 @@ public function language($language)
4949
return $this;
5050
}
5151

52+
/**
53+
* An ISO 3166-1 code. Combine this filter with with_watch_providers in order to filter your results by a specific watch provider in a specific region.
54+
*
55+
* @param string $watchRegion
56+
* @return $this
57+
*/
58+
public function watchRegion($watchRegion)
59+
{
60+
$this->set('watch_region', $watchRegion);
61+
62+
return $this;
63+
}
64+
65+
/**
66+
* Only include movies with the specified watch providers. Combine with watch_region.
67+
*
68+
* @param array|string $watchProviders
69+
* @param int $mode
70+
* @return $this
71+
*/
72+
public function withWatchProviders($watchProviders, $mode = self::MODE_OR)
73+
{
74+
$this->set('with_watch_providers', $this->with($watchProviders, $mode));
75+
76+
return $this;
77+
}
78+
79+
/**
80+
* Only include movies with the specified monetization types. Combine with watch_region.
81+
*
82+
* Allowed Values: flatrate, free, ads, rent, buy
83+
*
84+
* @param array|string $watchProviders
85+
* @param int $mode
86+
* @return $this
87+
*/
88+
public function withWatchMonetizationTypes($watchProviders, $mode = self::MODE_OR)
89+
{
90+
$this->set('with_watch_monetization_types', $this->with($watchProviders, $mode));
91+
92+
return $this;
93+
}
94+
5295
/**
5396
* Available options are vote_average.desc, vote_average.asc, first_air_date.desc,
5497
* first_air_date.asc, popularity.desc, popularity.asc

0 commit comments

Comments
 (0)