6
/// Summary description for PhotoSearchOptions.
8
public class PhotoSearchOptions
10
private string _userId;
12
private TagMode _tagMode = TagMode.None;
14
private DateTime _minUploadDate = DateTime.MinValue;
15
private DateTime _maxUploadDate = DateTime.MinValue;
16
private DateTime _minTakenDate = DateTime.MinValue;
17
private DateTime _maxTakenDate = DateTime.MinValue;
18
private System.Collections.ArrayList _licenses = new System.Collections.ArrayList();
19
private PhotoSearchExtras _extras = PhotoSearchExtras.None;
20
private int _perPage = 0;
21
private int _page = 0;
22
private PhotoSearchSortOrder _sort = PhotoSearchSortOrder.None;
23
private PrivacyFilter _privacyFilter = PrivacyFilter.None;
24
private BoundaryBox _boundaryBox = new BoundaryBox();
27
/// Creates a new instance of the search options.
29
public PhotoSearchOptions()
34
/// Creates a new instance of the search options, setting the UserId property to the parameter
37
/// <param name="userId">The ID of the User to search for.</param>
38
public PhotoSearchOptions(string userId) : this(userId, null, TagMode.AllTags, null)
43
/// Create an instance of the <see cref="PhotoSearchOptions"/> for a given user ID and tag list.
45
/// <param name="userId">The ID of the User to search for.</param>
46
/// <param name="tags">The tags (comma delimited) to search for. Will match all tags.</param>
47
public PhotoSearchOptions(string userId, string tags) : this( userId, tags, TagMode.AllTags, null)
52
/// Create an instance of the <see cref="PhotoSearchOptions"/> for a given user ID and tag list,
53
/// with the selected tag mode.
55
/// <param name="userId">The ID of the User to search for.</param>
56
/// <param name="tags">The tags (comma delimited) to search for.</param>
57
/// <param name="tagMode">The <see cref="TagMode"/> to use to search.</param>
58
public PhotoSearchOptions(string userId, string tags, TagMode tagMode) : this( userId, tags, tagMode, null)
63
/// Create an instance of the <see cref="PhotoSearchOptions"/> for a given user ID and tag list,
64
/// with the selected tag mode, and containing the selected text.
66
/// <param name="userId">The ID of the User to search for.</param>
67
/// <param name="tags">The tags (comma delimited) to search for.</param>
68
/// <param name="tagMode">The <see cref="TagMode"/> to use to search.</param>
69
/// <param name="text">The text to search for in photo title and descriptions.</param>
70
public PhotoSearchOptions(string userId, string tags, TagMode tagMode, string text)
74
this.TagMode = tagMode;
79
/// The user Id of the user to search on. Defaults to null for no specific user.
83
get { return _userId; }
84
set { _userId = value; }
88
/// A comma delimited list of tags
93
set { _tags = value; }
97
/// Tag mode can either be 'all', or 'any'. Defaults to <see cref="FlickrNet.TagMode.AllTags"/>
99
public TagMode TagMode
101
get { return _tagMode; }
102
set { _tagMode = value; }
105
internal string TagModeString
113
case TagMode.AllTags:
117
case TagMode.Boolean:
126
/// Search for the given text in photo titles and descriptions.
130
get { return _text; }
131
set { _text = value; }
135
/// Minimum date uploaded. Defaults to <see cref="DateTime.MinValue"/> which
136
/// signifies that the value is not to be used.
138
public DateTime MinUploadDate
140
get { return _minUploadDate; }
141
set { _minUploadDate = value; }
145
/// Maximum date uploaded. Defaults to <see cref="DateTime.MinValue"/> which
146
/// signifies that the value is not to be used.
148
public DateTime MaxUploadDate
150
get { return _maxUploadDate; }
151
set { _maxUploadDate = value; }
155
/// Minimum date taken. Defaults to <see cref="DateTime.MinValue"/> which
156
/// signifies that the value is not to be used.
158
public DateTime MinTakenDate
160
get { return _minTakenDate; }
161
set { _minTakenDate = value; }
165
/// Maximum date taken. Defaults to <see cref="DateTime.MinValue"/> which
166
/// signifies that the value is not to be used.
168
public DateTime MaxTakenDate
170
get { return _maxTakenDate; }
171
set { _maxTakenDate = value; }
175
/// Only return licenses with the selected license number.
176
/// See http://www.flickr.com/services/api/flickr.photos.licenses.getInfo.html
177
/// for more details on the numbers to use.
179
[Obsolete("Use AddLicense/RemoveLicense to add/remove licenses")]
184
if( _licenses.Count == 0 )
187
return (int)_licenses[0];
191
if( _licenses.Count == 0 )
192
_licenses.Add(value);
194
_licenses[0] = value;
199
/// Returns a copy of the licenses to be searched for.
201
public int[] Licenses
205
return (int[])_licenses.ToArray(typeof(int));
210
/// Adds a new license to the list of licenses to be searched for.
212
/// <param name="license">The number of the license to search for.</param>
213
public void AddLicense(int license)
215
if( !_licenses.Contains(license) ) _licenses.Add(license);
219
/// Removes a license from the list of licenses to be searched for.
221
/// <param name="license">The number of the license to remove.</param>
222
public void RemoveLicense(int license)
224
if( _licenses.Contains(license) ) _licenses.Remove(license);
228
/// Optional extras to return, defaults to all. See <see cref="PhotoSearchExtras"/> for more details.
230
public PhotoSearchExtras Extras
232
get { return _extras; }
233
set { _extras = value; }
237
/// Number of photos to return per page. Defaults to 100.
241
get { return _perPage; }
242
set { _perPage = value; }
246
/// The page to return. Defaults to page 1.
250
get { return _page; }
253
if( value < 0 ) throw new ArgumentOutOfRangeException("Page", value, "Must be greater than 0");
259
/// The sort order of the returned list. Default is <see cref="PhotoSearchSortOrder.None"/>.
261
public PhotoSearchSortOrder SortOrder
263
get { return _sort; }
264
set { _sort = value; }
268
/// The privacy fitler to filter the search on.
270
public PrivacyFilter PrivacyFilter
272
get { return _privacyFilter; }
273
set { _privacyFilter = value; }
277
/// The boundary box for which to search for geo location photos.
279
public BoundaryBox BoundaryBox
281
get { return _boundaryBox; }
285
_boundaryBox = new BoundaryBox();
287
_boundaryBox = value;
292
/// The accuracy of the search for geo location photos.
295
/// Can also be set as a property of the <see cref="BoundaryBox"/> property.
297
public GeoAccuracy Accuracy
299
get { return _boundaryBox==null?GeoAccuracy.None:_boundaryBox.Accuracy; }
302
if (_boundaryBox==null) { _boundaryBox = new BoundaryBox(); }
303
_boundaryBox.Accuracy = value;
308
internal string ExtrasString
310
get { return Utils.ExtrasToString(Extras); }
313
internal string SortOrderString
315
get { return Utils.SortOrderToString(_sort); }