using System;
namespace FlickrNet
{
///
/// Used to specify the authentication levels needed for the Auth methods.
///
public enum AuthLevel
{
///
/// No access required - do not use this value!
///
None,
///
/// Read only access is required by your application.
///
Read,
///
/// Read and write access is required by your application.
///
Write,
///
/// Read, write and delete access is required by your application.
/// Deleting does not mean deleting photos, just meta data such as tags.
///
Delete
}
///
/// Successful authentication returns a object.
///
public class Auth
{
private string _token;
private AuthLevel _permissions;
private FoundUser _user;
///
/// The authentication token returned by the or methods.
///
public string Token
{
get { return _token; }
set { _token = value; }
}
///
/// The permissions the current token allows the application to perform.
///
public AuthLevel Permissions
{
get { return _permissions; }
set { _permissions = value; }
}
///
/// The object associated with the token. Readonly.
///
public FoundUser User
{
get { return _user; }
}
///
/// Creates a new instance of the class.
///
public Auth()
{
}
internal Auth(System.Xml.XmlElement element)
{
Token = element.SelectSingleNode("token").InnerText;
Permissions = (AuthLevel)Enum.Parse(typeof(AuthLevel), element.SelectSingleNode("perms").InnerText, true);
System.Xml.XmlNode node = element.SelectSingleNode("user");
_user = new FoundUser(node);
}
}
}