using System.Xml.Serialization;
using System.Xml.Schema;
namespace FlickrNet
{
///
/// Collection containing a users photosets.
///
[System.Serializable]
public class Photosets
{
private int _canCreate;
private Photoset[] _photosetCollection = new Photoset[0];
///
/// Can the user create more photosets.
///
///
/// 1 meants yes, 0 means no.
///
[XmlAttribute("cancreate", Form=XmlSchemaForm.Unqualified)]
public int CanCreate
{
get { return _canCreate; }
set { _canCreate = value; }
}
///
/// An array of objects.
///
[XmlElement("photoset", Form=XmlSchemaForm.Unqualified)]
public Photoset[] PhotosetCollection
{
get { return _photosetCollection; }
set { _photosetCollection = value;}
}
}
///
/// A set of properties for the photoset.
///
[System.Serializable]
public class Photoset
{
private string _photosetId;
private string _url;
private string _ownerId;
private string _primaryPhotoId;
private string _secret;
private int _server;
private int _numberOfPhotos;
private string _title;
private string _description;
private Photo[] _photoCollection = new Photo[0];
///
/// The ID of the photoset.
///
[XmlAttribute("id", Form=XmlSchemaForm.Unqualified)]
public string PhotosetId
{
get { return _photosetId; } set { _photosetId = value; }
}
///
/// The URL of the photoset.
///
[XmlAttribute("url", Form=XmlSchemaForm.Unqualified)]
public string Url
{
get { return _url; } set { _url = value; }
}
///
/// The ID of the owner of the photoset.
///
[XmlAttribute("owner", Form=XmlSchemaForm.Unqualified)]
public string OwnerId
{
get { return _ownerId; } set { _ownerId = value; }
}
///
/// The photo ID of the primary photo of the photoset.
///
[XmlAttribute("primary", Form=XmlSchemaForm.Unqualified)]
public string PrimaryPhotoId
{
get { return _primaryPhotoId; } set { _primaryPhotoId = value; }
}
///
/// The secret for the primary photo for the photoset.
///
[XmlAttribute("secret", Form=XmlSchemaForm.Unqualified)]
public string Secret
{
get { return _secret; } set { _secret = value; }
}
///
/// The server for the primary photo for the photoset.
///
[XmlAttribute("server", Form=XmlSchemaForm.Unqualified)]
public int Server
{
get { return _server; } set { _server = value; }
}
///
/// The number of photos in the photoset.
///
[XmlAttribute("photos", Form=XmlSchemaForm.Unqualified)]
public int NumberOfPhotos
{
get { return _numberOfPhotos; } set { _numberOfPhotos = value; }
}
///
/// The title of the photoset.
///
[XmlElement("title", Form=XmlSchemaForm.Unqualified)]
public string Title
{
get { return _title; } set { _title = value; }
}
///
/// The description of the photoset.
///
[XmlElement("description", Form=XmlSchemaForm.Unqualified)]
public string Description
{
get { return _description; } set { _description = value; }
}
///
/// An array of photo objects in the photoset.
///
[XmlElement("photo", Form=XmlSchemaForm.Unqualified)]
public Photo[] PhotoCollection
{
get { return _photoCollection; } set { _photoCollection = value; }
}
private const string photoUrl = "http://static.flickr.com/{0}/{1}_{2}{3}.{4}";
///
/// The URL for the thumbnail of a photo.
///
[XmlIgnore()]
public string PhotosetThumbnailUrl
{
get { return string.Format(photoUrl, Server, PrimaryPhotoId, Secret, "_t", "jpg"); }
}
///
/// The URL for the square thumbnail of a photo.
///
[XmlIgnore()]
public string PhotosetSquareThumbnailUrl
{
get { return string.Format(photoUrl, Server, PrimaryPhotoId, Secret, "_s", "jpg"); }
}
///
/// The URL for the small copy of a photo.
///
[XmlIgnore()]
public string PhotosetSmallUrl
{
get { return string.Format(photoUrl, Server, PrimaryPhotoId, Secret, "_m", "jpg"); }
}
}
}