Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add lang Parameter #134

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion src/Search.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,12 @@ class Search extends Endpoint
* @param string $content_filter Limit results by content safety. (Optional; default: low). Valid values are low and high.
* @param string $color Filter results by color. Optional. Valid values are: black_and_white, black, white,
* yellow, orange, red, purple, magenta, green, teal, and blue.
* @param string $lang Language code. Optional. Valid values are: cs, de, en, es, fr, id, it, ja, pt, ru, zh... Default: en
*
* @return PageResult
*/
public static function photos($search, $page = 1, $per_page = 10, $orientation = null, $collections = null,
$order_by = null, $content_filter = "low", $color = null)
$order_by = null, $content_filter = "low", $color = null, $lang = null)
{
$query = [
'query' => $search,
Expand Down Expand Up @@ -54,11 +56,16 @@ public static function photos($search, $page = 1, $per_page = 10, $orientation =
$query['color'] = $color;
}

if ( ! empty($lang)) {
$query['lang'] = $lang;
}

$photos = self::get(
"/search/photos",
[ 'query' => $query ]
);


return self::getPageResult($photos->getBody(), $photos->getHeaders(), Photo::class);
}

Expand Down