\Google\Photos\Library\V1FiltersBuilder

Provides an easier interface for constructing {@link Filters} objects.

Usage: $filters = FiltersBuilder::new() ->addIncludedContentCategory(ContentCategory::LANDSCAPES) ->setIncludeArchivedMedia(true) ->build(); $searchMediaItemsRequest->setFilters($filters);

Summary

Methods
Properties
Constants
construct()
build()
setMediaTypeFromString()
setMediaType()
addIncludedCategory()
addIncludedCategoryFromString()
addExcludedCategory()
addExcludedCategoryFromString()
addDateRange()
addDateRangeFromDateTime()
addDate()
addDateFromDateTime()
setIncludeArchivedMedia()
No public properties found
No constants found
No protected methods found
No protected properties found
N/A
convertToCategory()
convertToGoogleDate()
$mediaType
$includedCategories
$excludedCategories
$ranges
$dates
$includeArchivedMedia
N/A

Properties

$mediaType

$mediaType : 

Type

$includedCategories

$includedCategories : 

Type

$excludedCategories

$excludedCategories : 

Type

$ranges

$ranges : 

Type

$dates

$dates : 

Type

$includeArchivedMedia

$includeArchivedMedia : 

Type

Methods

construct()

construct() 

setMediaTypeFromString()

setMediaTypeFromString(string  $mediaType) : $this

Sets the media type, from a string. Overwrites the existing media type.

Parameters

string $mediaType

The media type to set. Must be an element of {@link PhotosLibraryClient::mediaTypes()}

Returns

$this

setMediaType()

setMediaType(integer  $mediaType) : $this

Sets the media type. Overwrites the existing media type.

Parameters

integer $mediaType

The media type to set, a constant from MediaType.

Returns

$this

addIncludedCategory()

addIncludedCategory(integer  $category) : $this

Adds a category to the list of included categories.

Parameters

integer $category

The category to include; a constant from {@link ContentCategory}.

Returns

$this

addIncludedCategoryFromString()

addIncludedCategoryFromString(string  $category) : $this

Adds a category to the list of included categories.

Parameters

string $category

The category to include. Must be an element of {@link PhotosLibraryClient::contentCategories()}

Returns

$this

addExcludedCategory()

addExcludedCategory(integer  $category) : $this

Adds a category to the list of of excluded categories.

Parameters

integer $category

The category to exclude.

Returns

$this

addExcludedCategoryFromString()

addExcludedCategoryFromString(string  $category) : $this

Adds a category to the list of excluded categories.

Parameters

string $category

The category to exclude. Must be an element of {@link PhotosLibraryClient::contentCategories()}

Returns

$this

addDateRange()

addDateRange(\Google\Type\Date  $start, \Google\Type\Date  $end) : $this

Adds a date range to the list of included date ranges.

Parameters

\Google\Type\Date $start
\Google\Type\Date $end

Returns

$this

addDateRangeFromDateTime()

addDateRangeFromDateTime(\DateTime  $start, \DateTime  $end) : $this

Adds a date range to the list of included date ranges, from two DateTimes.

If you require dates with wildcards (e.g., a year-only date), you must use \addDateRange.

Parameters

\DateTime $start
\DateTime $end

Returns

$this

addDate()

addDate(\Google\Type\Date  $date) : $this

Adds a date to the list of included dates.

Parameters

\Google\Type\Date $date

Returns

$this

addDateFromDateTime()

addDateFromDateTime(\DateTime  $date) : $this

Adds a date to the list of included dates, from a DateTime.

If you require a date with wildcards (e.g., a year-only date), you must use \addDate.

Parameters

\DateTime $date

Returns

$this

setIncludeArchivedMedia()

setIncludeArchivedMedia(boolean  $includeArchivedMedia) : $this

Sets the flag to include archived media. If false, archived media will not be returned.

Parameters

boolean $includeArchivedMedia

Returns

$this

convertToCategory()

convertToCategory(string  $category) : integer

Converts a string into a {@link ContentCategory}.

Parameters

string $category

A stringified version of a ContentCategory, e.g. "NONE".

Throws

\InvalidArgumentException

if $category is not an element of {@link PhotosLibraryClient::contentCategories()}.

Returns

integer —

A constant from ContentCategory.

convertToGoogleDate()

convertToGoogleDate(\DateTime  $date) : \Google\Type\Date

Converts a DateTime object into a Google Date object.

Parameters

\DateTime $date

Returns

\Google\Type\Date