public async Task<IEnumerable<IGalleryItem>> SearchGalleryAdvancedAsync(
string qAll = null, string qAny = null,
string qExactly = null, string qNot = null,
ImageFileType? fileType = null, ImageSize? imageSize = null,
GallerySortOrder? sort = GallerySortOrder.Time,
TimeWindow? window = TimeWindow.All, int? page = null)
{
if (string.IsNullOrWhiteSpace(qAll) &&
string.IsNullOrWhiteSpace(qAny) &&
string.IsNullOrWhiteSpace(qExactly) &&
string.IsNullOrWhiteSpace(qNot))
throw new ArgumentNullException(null,
"At least one search parameter must be provided (All | Any | Exactly | Not).");
sort = sort ?? GallerySortOrder.Time;
window = window ?? TimeWindow.All;
var sortValue = $"{sort}".ToLower();
var windowValue = $"{window}".ToLower();
var url = $"gallery/search/{sortValue}/{windowValue}/{page}";
url = RequestBuilder.SearchGalleryAdvancedRequest(url, qAll, qAny, qExactly, qNot, fileType,
imageSize);
using (var request = RequestBuilder.CreateRequest(HttpMethod.Get, url))
{
var searchResults = await SendRequestAsync<IEnumerable<GalleryItem>>(request).ConfigureAwait(false);
return searchResults;
}
}