using System;
namespace FlickrNet
{
///
/// Summary description for PartialSearchOptions.
///
public class PartialSearchOptions
{
#region Private Variables
private DateTime _minUploadDate = DateTime.MinValue;
private DateTime _maxUploadDate = DateTime.MinValue;
private DateTime _minTakenDate = DateTime.MinValue;
private DateTime _maxTakenDate = DateTime.MinValue;
private PhotoSearchExtras _extras = PhotoSearchExtras.None;
private PhotoSearchSortOrder _sort = PhotoSearchSortOrder.None;
private int _perPage = 0;
private int _page = 0;
private PrivacyFilter _privacyFilter = PrivacyFilter.None;
#endregion
#region Public Properties
///
/// Minimum date uploaded. Defaults to which
/// signifies that the value is not to be used.
///
public DateTime MinUploadDate
{
get { return _minUploadDate; }
set { _minUploadDate = value; }
}
///
/// Maximum date uploaded. Defaults to which
/// signifies that the value is not to be used.
///
public DateTime MaxUploadDate
{
get { return _maxUploadDate; }
set { _maxUploadDate = value; }
}
///
/// Minimum date taken. Defaults to which
/// signifies that the value is not to be used.
///
public DateTime MinTakenDate
{
get { return _minTakenDate; }
set { _minTakenDate = value; }
}
///
/// Maximum date taken. Defaults to which
/// signifies that the value is not to be used.
///
public DateTime MaxTakenDate
{
get { return _maxTakenDate; }
set { _maxTakenDate = value; }
}
///
/// Optional extras to return, defaults to all. See for more details.
///
public PhotoSearchExtras Extras
{
get { return _extras; }
set { _extras = value; }
}
///
/// Number of photos to return per page. Defaults to 100.
///
public int PerPage
{
get { return _perPage; }
set { _perPage = value; }
}
///
/// The page to return. Defaults to page 1.
///
public int Page
{
get { return _page; }
set
{
if( value < 0 ) throw new ArgumentOutOfRangeException("Page", value, "Must be greater than 0");
_page = value;
}
}
///
/// The sort order of the returned list. Default is .
///
public PhotoSearchSortOrder SortOrder
{
get { return _sort; }
set { _sort = value; }
}
///
/// The privacy fitler to filter the search on.
///
public PrivacyFilter PrivacyFilter
{
get { return _privacyFilter; }
set { _privacyFilter = value; }
}
#endregion
#region Constructors
///
/// Default constructor.
///
public PartialSearchOptions()
{
}
///
/// Constructor taking a default parameter.
///
/// See for more details.
public PartialSearchOptions(PhotoSearchExtras extras)
{
Extras = extras;
}
///
/// Constructor taking a perPage and page parameter.
///
/// The number of photos to return per page (maximum).
/// The page number to return.
public PartialSearchOptions(int perPage, int page)
{
PerPage = perPage;
Page = page;
}
///
/// Constructor taking a perPage and page parameter and a default parameter.
///
/// The number of photos to return per page (maximum).
/// The page number to return.
/// See for more details.
public PartialSearchOptions(int perPage, int page, PhotoSearchExtras extras)
{
PerPage = perPage;
Page = page;
Extras = extras;
}
#endregion
internal PartialSearchOptions(PhotoSearchOptions options)
{
this.Extras = options.Extras;
this.MaxTakenDate = options.MaxTakenDate;
this.MinTakenDate = options.MinTakenDate;
this.MaxUploadDate = options.MaxUploadDate;
this.MinUploadDate = options.MinUploadDate;
this.Page = options.Page;
this.PerPage = options.PerPage;
this.PrivacyFilter = options.PrivacyFilter;
}
internal string ExtrasString
{
get { return Utils.ExtrasToString(Extras); }
}
internal string SortOrderString
{
get { return Utils.SortOrderToString(SortOrder); }
}
}
}