File: Methods.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 (136 lines) | stat: -rw-r--r-- 3,089 bytes parent folder | download | duplicates (4)
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
using System;
using System.Xml;
using System.Xml.Serialization;
using System.Xml.Schema;

namespace FlickrNet
{
	/// <summary>
	/// Summary description for Methods.
	/// </summary>
	public class Methods
	{
		private Methods()
		{
		}

		internal static string[] GetMethods(XmlElement element)
		{
			XmlNodeList nodes = element.SelectNodes("method");
			string[] _methods = new string[nodes.Count];
			for(int i = 0; i < nodes.Count; i++)
			{
				_methods[i] = nodes[i].Value;
			}
			return _methods;
		}
	}

	/// <summary>
	/// A method supported by the Flickr API.
	/// </summary>
	/// <remarks>
	/// See <a href="http://www.flickr.com/services/api">Flickr API Documentation</a> for a complete list
	/// of methods.
	/// </remarks>
	[Serializable]
	public class Method
	{
		/// <summary>
		/// Default constructor.
		/// </summary>
		public Method()
		{
		}

		/// <summary>
		/// The name of the method.
		/// </summary>
		[XmlAttribute("name", Form=XmlSchemaForm.Unqualified)]
		public string Name;

		/// <summary>
		/// The description of the method.
		/// </summary>
		[XmlElement("description", Form=XmlSchemaForm.Unqualified)]
		public string Description;

		/// <summary>
		/// An example response for the method.
		/// </summary>
		[XmlElement("response", Form=XmlSchemaForm.Unqualified)]
		public string Response;

		/// <summary>
		/// An explanation of the example response for the method.
		/// </summary>
		[XmlElement("explanation", Form=XmlSchemaForm.Unqualified)]
		public string Explanation;

		/// <summary>
		/// The arguments of the method.
		/// </summary>
		[XmlElement("arguments", Form=XmlSchemaForm.Unqualified)]
		public Arguments Arguments;

		/// <summary>
		/// The possible errors that could be returned by the method.
		/// </summary>
		[XmlArray()]
		[XmlArrayItem("error", typeof(MethodError), Form=XmlSchemaForm.Unqualified)]
		public MethodError[] Errors;

	}

	/// <summary>
	/// An instance containing a collection of <see cref="Argument"/> instances.
	/// </summary>
	[Serializable]
	public class Arguments
	{
		/// <summary>
		/// A collection of <see cref="Argument"/> instances.
		/// </summary>
		[XmlElement("argument", Form=XmlSchemaForm.Unqualified)]
		public Argument[] ArgumentCollection;
	}

	/// <summary>
	/// An argument for a method.
	/// </summary>
	[Serializable]
	public class Argument
	{
		/// <summary>
		/// The name of the argument.
		/// </summary>
		[XmlElement("name")]
		public string ArgumentName;

		/// <summary>
		/// Is the argument optional or not.
		/// </summary>
		[XmlElement("optional")]
		public int Optional;

		/// <summary>
		/// The description of the argument.
		/// </summary>
		[XmlText()]
		public string ArgumentDescription;
	}

	/// <summary>
	/// A possible error that a method can return.
	/// </summary>
	[Serializable]
	public class MethodError
	{
		/// <summary>
		/// The code for the error.
		/// </summary>
		[XmlElement("code")]
		public int Code;

	}
}