using System; using System.Xml.Serialization; using System.Xml.Schema; namespace FlickrNet { /// /// Detailed information returned by or methods. /// [System.Serializable] public class PhotoInfo { /// /// The id of the photo. /// [XmlAttribute("id", Form=XmlSchemaForm.Unqualified)] public string PhotoId; /// /// The secret of the photo. Used to calculate the URL (amongst other things). /// [XmlAttribute("secret", Form=XmlSchemaForm.Unqualified)] public string Secret; /// /// The server on which the photo resides. /// [XmlAttribute("server", Form=XmlSchemaForm.Unqualified)] public int Server; /// /// The date the photo was uploaded (or 'posted'). /// [XmlIgnore()] public DateTime DateUploaded { get { return Utils.UnixTimestampToDate(dateuploaded_raw); } } /// /// The raw value for when the photo was uploaded. /// [XmlAttribute("dateuploaded", Form=XmlSchemaForm.Unqualified)] public string dateuploaded_raw; /// /// Is the photo a favourite of the current authorised user. /// Will be 0 if the user is not authorised. /// [XmlAttribute("isfavorite", Form=XmlSchemaForm.Unqualified)] public int IsFavourite; /// /// The license of the photo. /// [XmlAttribute("license", Form=XmlSchemaForm.Unqualified)] public int License; /// /// The owner of the photo. /// /// /// See for more details. /// [XmlElement("owner", Form=XmlSchemaForm.Unqualified)] public PhotoInfoOwner Owner; /// /// The title of the photo. /// [XmlElement("title", Form=XmlSchemaForm.Unqualified)] public string Title; /// /// The description of the photo. /// [XmlElement("description", Form=XmlSchemaForm.Unqualified)] public string Description; /// /// The visibility of the photo. /// /// /// See for more details. /// [XmlElement("visibility", Form=XmlSchemaForm.Unqualified)] public PhotoInfoVisibility Visibility; /// /// The permissions of the photo. /// /// /// See for more details. /// [XmlElement("permissions", Form=XmlSchemaForm.Unqualified)] public PhotoInfoPermissions Permissions; /// /// The editability of the photo. /// /// /// See for more details. /// [XmlElement("editability", Form=XmlSchemaForm.Unqualified)] public PhotoInfoEditability Editability; /// /// The number of comments the photo has. /// [XmlElement("comments", Form=XmlSchemaForm.Unqualified)] public int CommentsCount; /// /// The notes for the photo. /// [XmlElement("notes", Form=XmlSchemaForm.Unqualified)] public PhotoInfoNotes Notes; /// /// The tags for the photo. /// [XmlElement("tags", Form=XmlSchemaForm.Unqualified)] public PhotoInfoTags Tags; /// /// The EXIF tags for the photo. /// [XmlElement("exif", Form=XmlSchemaForm.Unqualified)] public ExifTag[] ExifTagCollection; /// /// The dates (uploaded and taken dates) for the photo. /// [XmlElement("dates", Form=XmlSchemaForm.Unqualified)] public PhotoDates Dates; /// /// The location information of this photo, if available. /// /// /// Will be null if the photo has no location information stored on Flickr. /// [XmlElement("location", Form=XmlSchemaForm.Unqualified)] public PhotoLocation Location; /// /// The Web url for flickr web page for this photo. /// [XmlIgnore()] public string WebUrl { get { return string.Format("http://www.flickr.com/photos/{0}/{1}/", Owner.UserId, PhotoId); } } private const string photoUrl = "http://static.flickr.com/{0}/{1}_{2}{3}.jpg"; /// /// The URL for the square thumbnail for the photo. /// [XmlIgnore()] public string SquareThumbnailUrl { get { return string.Format(photoUrl, Server, PhotoId, Secret, "_s"); } } /// /// The URL for the thumbnail for the photo. /// [XmlIgnore()] public string ThumbnailUrl { get { return string.Format(photoUrl, Server, PhotoId, Secret, "_t"); } } /// /// The URL for the small version of this photo. /// [XmlIgnore()] public string SmallUrl { get { return string.Format(photoUrl, Server, PhotoId, Secret, "_m"); } } /// /// The URL for the medium version of this photo. /// /// /// There is no guarentee that this size of the image actually exists. /// Use to get a list of existing photo URLs. /// [XmlIgnore()] public string MediumUrl { get { return string.Format(photoUrl, Server, PhotoId, Secret, ""); } } /// /// The URL for the large version of this photo. /// /// /// There is no guarentee that this size of the image actually exists. /// Use to get a list of existing photo URLs. /// [XmlIgnore()] public string LargeUrl { get { return string.Format(photoUrl, Server, PhotoId, Secret, "_b"); } } } /// /// The information about the owner of a photo. /// [System.Serializable] public class PhotoInfoOwner { /// /// The id of the own of the photo. /// [XmlAttribute("nsid", Form=XmlSchemaForm.Unqualified)] public string UserId; /// /// The username of the owner of the photo. /// [XmlAttribute("username", Form=XmlSchemaForm.Unqualified)] public string UserName; /// /// The real name (as stored on Flickr) of the owner of the photo. /// [XmlAttribute("realname", Form=XmlSchemaForm.Unqualified)] public string RealName; /// /// The location (as stored on Flickr) of the owner of the photo. /// [XmlAttribute("location", Form=XmlSchemaForm.Unqualified)] public string Location; } /// /// The visibility of the photo. /// [System.Serializable] public class PhotoInfoVisibility { /// /// Is the photo visible to the public. /// [XmlAttribute("ispublic", Form=XmlSchemaForm.Unqualified)] public int IsPublic; /// /// Is the photo visible to contacts marked as friends. /// [XmlAttribute("isfriend", Form=XmlSchemaForm.Unqualified)] public int IsFriend; /// /// Is the photo visible to contacts marked as family. /// [XmlAttribute("isfamily", Form=XmlSchemaForm.Unqualified)] public int IsFamily; } /// /// Who has permissions to add information to this photo (comments, tag and notes). /// [System.Serializable] public class PhotoInfoPermissions { /// /// Who has permissions to add comments to this photo. /// [XmlAttribute("permcomment", Form=XmlSchemaForm.Unqualified)] public PermissionComment PermissionComment; /// /// Who has permissions to add meta data (tags and notes) to this photo. /// [XmlAttribute("permaddmeta", Form=XmlSchemaForm.Unqualified)] public PermissionAddMeta PermissionAddMeta; } /// /// Information about who can edit the details of a photo. /// [System.Serializable] public class PhotoInfoEditability { /// /// Can the authorized user add new comments. /// /// /// "1" = true, "0" = false. /// [XmlAttribute("cancomment", Form=XmlSchemaForm.Unqualified)] public string CanComment; /// /// Can the authorized user add new meta data (tags and notes). /// /// /// "1" = true, "0" = false. /// [XmlAttribute("canaddmeta", Form=XmlSchemaForm.Unqualified)] public string CanAddMeta; } /// /// A class containing information about the notes for a photo. /// [System.Serializable] public class PhotoInfoNotes { /// /// A collection of notes for this photo. /// [XmlElement("note", Form=XmlSchemaForm.Unqualified)] public PhotoInfoNote[] NoteCollection; } /// /// A class containing information about a note on a photo. /// [System.Serializable] public class PhotoInfoNote { /// /// The notes unique ID. /// [XmlAttribute("id", Form=XmlSchemaForm.Unqualified)] public string NoteId; /// /// The User ID of the user who wrote the note. /// [XmlAttribute("author", Form=XmlSchemaForm.Unqualified)] public string AuthorId; /// /// The name of the user who wrote the note. /// [XmlAttribute("authorname", Form=XmlSchemaForm.Unqualified)] public string AuthorName; /// /// The x (left) position of the top left corner of the note. /// [XmlAttribute("x", Form=XmlSchemaForm.Unqualified)] public int XPosition; /// /// The y (top) position of the top left corner of the note. /// [XmlAttribute("y", Form=XmlSchemaForm.Unqualified)] public int YPosition; /// /// The width of the note. /// [XmlAttribute("w", Form=XmlSchemaForm.Unqualified)] public int Width; /// /// The height of the note. /// [XmlAttribute("h", Form=XmlSchemaForm.Unqualified)] public int Height; /// /// The text of the note. /// [XmlText()] public string NoteText; } /// /// A class containing a collection of tags for the photo. /// [System.Serializable] public class PhotoInfoTags { /// /// A collection of tags for the photo. /// [XmlElement("tag", Form=XmlSchemaForm.Unqualified)] public PhotoInfoTag[] TagCollection; } /// /// The details of a tag of a photo. /// [System.Serializable] public class PhotoInfoTag { /// /// The id of the tag. /// [XmlAttribute("id", Form=XmlSchemaForm.Unqualified)] public string TagId; /// /// The author id of the tag. /// [XmlAttribute("author", Form=XmlSchemaForm.Unqualified)] public string AuthorId; /// /// Author of the tag - only available if using . /// [XmlAttribute("authorname", Form=XmlSchemaForm.Unqualified)] public string AuthorName; /// /// Raw copy of the tag, as the user entered it. /// [XmlAttribute("raw", Form=XmlSchemaForm.Unqualified)] public string Raw; /// /// The actually tag. /// [XmlText()] public string TagText; } }