File: Response.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 (143 lines) | stat: -rw-r--r-- 3,963 bytes parent folder | download
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
using System;
using System.Xml;
using System.Xml.Serialization;
using System.Xml.Schema;

namespace FlickrNet
{
	/// <summary>
	/// The root object returned by Flickr. Used with Xml Serialization to get the relevant object.
	/// It is internal to the FlickrNet API Library and should not be used elsewhere.
	/// </summary>
	[XmlRoot("rsp", Namespace="", IsNullable=false)]
	[Serializable]
	public class Response 
	{

		/// <remarks/>
		[XmlElement("blogs", Form=XmlSchemaForm.Unqualified)]
		public Blogs Blogs;

		/// <remarks/>
		[XmlElement("contacts", Form=XmlSchemaForm.Unqualified)]
		public Contacts Contacts;

		/// <remarks/>
		[XmlElement("photos", Form=XmlSchemaForm.Unqualified)]
		public Photos Photos;

		/// <remarks/>
		[XmlElement("category", Form=XmlSchemaForm.Unqualified)]
		public Category Category;

		/// <remarks/>
		[XmlElement("photocounts", Form=XmlSchemaForm.Unqualified)]
		public PhotoCounts PhotoCounts;

		/// <remarks/>
		[XmlElement("photo", Form=XmlSchemaForm.Unqualified)]
		public PhotoInfo PhotoInfo;

		/// <remarks/>
		[XmlElement("photoset", Form=XmlSchemaForm.Unqualified)]
		public Photoset Photoset;

		/// <remarks/>
		[XmlElement("photosets", Form=XmlSchemaForm.Unqualified)]
		public Photosets Photosets;

		/// <remarks/>
		[XmlElement("sizes", Form=XmlSchemaForm.Unqualified)]
		public Sizes Sizes;
    
		/// <remarks/>
		[XmlElement("licenses", Form=XmlSchemaForm.Unqualified)]
		public Licenses Licenses;

		/// <remarks/>
		[XmlElement("count", Form=XmlSchemaForm.Unqualified)]
		public ContextCount ContextCount;

		/// <remarks/>
		[XmlElement("nextphoto", Form=XmlSchemaForm.Unqualified)]
		public ContextPhoto ContextNextPhoto;

		/// <remarks/>
		[XmlElement("prevphoto", Form=XmlSchemaForm.Unqualified)]
		public ContextPhoto ContextPrevPhoto;

		/// <remarks/>
		[XmlAttribute("stat", Form=XmlSchemaForm.Unqualified)]
		public ResponseStatus Status;

		/// <summary>
		/// If an error occurs the Error property is populated with 
		/// a <see cref="ResponseError"/> instance.
		/// </summary>
		[XmlElement("err", Form=XmlSchemaForm.Unqualified)]
		public ResponseError Error;

		/// <summary>
		/// A <see cref="Method"/> instance.
		/// </summary>
		[XmlElement("method", Form=XmlSchemaForm.Unqualified)]
		public Method Method;

		/// <summary>
		/// If using flickr.test.echo this contains all the other elements not covered above.
		/// </summary>
		/// <remarks>
		/// t is an array of <see cref="XmlElement"/> objects. Use the XmlElement Name and InnerXml properties
		/// to get the name and value of the returned property.
		/// </remarks>
		[XmlAnyElement(), NonSerialized()]
		public XmlElement[] AllElements;
	}

	/// <summary>
	/// If an error occurs then Flickr returns this object.
	/// </summary>
	[System.Serializable]
	public class ResponseError
	{
		/// <summary>
		/// The code or number of the error.
		/// </summary>
		/// <remarks>
		/// 100 - Invalid Api Key.
		/// 99  - User not logged in.
		/// Other codes are specific to a method.
		/// </remarks>
		[XmlAttribute("code", Form=XmlSchemaForm.Unqualified)]
		public int Code;

		/// <summary>
		/// The verbose message matching the error code.
		/// </summary>
		[XmlAttribute("msg", Form=XmlSchemaForm.Unqualified)]
		public string Message;
	}

	/// <summary>
	/// The status of the response, either ok or fail.
	/// </summary>
	public enum ResponseStatus
	{
		/// <summary>
		/// An unknown status, and the default value if not set.
		/// </summary>
		[XmlEnum("unknown")]
		Unknown,

		/// <summary>
		/// The response returns "ok" on a successful execution of the method.
		/// </summary>
		[XmlEnum("ok")]
		OK,
		/// <summary>
		/// The response returns "fail" if there is an error, such as invalid API key or login failure.
		/// </summary>
		[XmlEnum("fail")]
		Failed
	}
}