Observed: MediaQueryBuilder was only returning images on query because the property MediaType was taking the default value of Image from MediaQueryType enum.
Fix:
Added a ExcludeQueryTextAttribute to decorate properties which are to be excluded from the final query parameters.
If the ExclusionValue property of ExcludeQueryTextAttribute matches the value of the decorated property, then the decorated property's query text is not included in the final query parameters.
Added the logic in the BuildQuery method which compares the ExclusionValue property to the actual value of the decorated property and excludes the property query text if it is a match.
Also added Text type in the MediaQueryType enum as Text is supported by WP Rest Api (as per docs)
Observed:
MediaQueryBuilder
was only returning images on query because the propertyMediaType
was taking the default value ofImage
fromMediaQueryType
enum.Fix:
ExcludeQueryTextAttribute
to decorate properties which are to be excluded from the final query parameters.ExclusionValue
property ofExcludeQueryTextAttribute
matches the value of the decorated property, then the decorated property's query text is not included in the final query parameters.BuildQuery
method which compares theExclusionValue
property to the actual value of the decorated property and excludes the property query text if it is a match.Also added
Text
type in theMediaQueryType
enum asText
is supported by WP Rest Api (as per docs)