File: PartialSearchOptions.cs

package info (click to toggle)
libflickrnet 25277-6
  • links: PTS, VCS
  • area: main
  • in suites: lenny
  • size: 628 kB
  • ctags: 1,355
  • sloc: cs: 7,136; makefile: 24; sh: 13; ansic: 6
file content (179 lines) | stat: -rw-r--r-- 4,933 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
using System;

namespace FlickrNet
{
	/// <summary>
	/// Summary description for PartialSearchOptions.
	/// </summary>
	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
		/// <summary>
		/// Minimum date uploaded. Defaults to <see cref="DateTime.MinValue"/> which
		/// signifies that the value is not to be used.
		/// </summary>
		public DateTime MinUploadDate
		{
			get { return _minUploadDate; }
			set { _minUploadDate = value; }
		}
	
		/// <summary>
		/// Maximum date uploaded. Defaults to <see cref="DateTime.MinValue"/> which
		/// signifies that the value is not to be used.
		/// </summary>
		public DateTime MaxUploadDate
		{
			get { return _maxUploadDate; }
			set { _maxUploadDate = value; }
		}
	
		/// <summary>
		/// Minimum date taken. Defaults to <see cref="DateTime.MinValue"/> which
		/// signifies that the value is not to be used.
		/// </summary>
		public DateTime MinTakenDate
		{
			get { return _minTakenDate; }
			set { _minTakenDate = value; }
		}
	
		/// <summary>
		/// Maximum date taken. Defaults to <see cref="DateTime.MinValue"/> which
		/// signifies that the value is not to be used.
		/// </summary>
		public DateTime MaxTakenDate
		{
			get { return _maxTakenDate; }
			set { _maxTakenDate = value; }
		}

		/// <summary>
		/// Optional extras to return, defaults to all. See <see cref="PhotoSearchExtras"/> for more details.
		/// </summary>
		public PhotoSearchExtras Extras
		{
			get { return _extras; }
			set { _extras = value; }
		}

		/// <summary>
		/// Number of photos to return per page. Defaults to 100.
		/// </summary>
		public int PerPage
		{
			get { return _perPage; }
			set { _perPage = value; }
		}

		/// <summary>
		/// The page to return. Defaults to page 1.
		/// </summary>
		public int Page
		{
			get { return _page; }
			set 
			{
				if( value < 0 ) throw new ArgumentOutOfRangeException("Page", "Must be greater than 0");
				_page = value; 
			}
		}

		/// <summary>
		/// The sort order of the returned list. Default is <see cref="PhotoSearchSortOrder.None"/>.
		/// </summary>
		public PhotoSearchSortOrder SortOrder
		{
			get { return _sort; }
			set { _sort = value; }
		}

		/// <summary>
		/// The privacy fitler to filter the search on.
		/// </summary>
		public PrivacyFilter PrivacyFilter
		{
			get { return _privacyFilter; }
			set { _privacyFilter = value; }
		}

		#endregion

		#region Constructors
		/// <summary>
		/// Default constructor.
		/// </summary>
		public PartialSearchOptions()
		{
		}

		/// <summary>
		/// Constructor taking a default <see cref="PhotoSearchExtras"/> parameter.
		/// </summary>
		/// <param name="extras">See <see cref="PhotoSearchExtras"/> for more details.</param>
		public PartialSearchOptions(PhotoSearchExtras extras)
		{
			Extras = extras;
		}

		/// <summary>
		/// Constructor taking a perPage and page parameter.
		/// </summary>
		/// <param name="perPage">The number of photos to return per page (maximum).</param>
		/// <param name="page">The page number to return.</param>
		public PartialSearchOptions(int perPage, int page)
		{
			PerPage = perPage;
			Page = page;
		}

		/// <summary>
		/// Constructor taking a perPage and page parameter and a default <see cref="PhotoSearchExtras"/> parameter.
		/// </summary>
		/// <param name="perPage">The number of photos to return per page (maximum).</param>
		/// <param name="page">The page number to return.</param>
		/// <param name="extras">See <see cref="PhotoSearchExtras"/> for more details.</param>
		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); }
		}

	}
}