GetNodeChildValue() public static method

public static GetNodeChildValue ( XPathNavigator node, string childName ) : string
node System.Xml.XPath.XPathNavigator
childName string
return string
Beispiel #1
0
        // * Get upload token
        // Implements http://www.23developer.com/api/photo-get-upload-token
        public Domain.PhotoUploadToken GetUploadToken(string returnUrl, bool?backgroundReturn, int?userId, int?albumId, string title, string description, string tags, bool?publish, int?validMinutes, int?maxUploads)
        {
            if (String.IsNullOrEmpty(returnUrl))
            {
                return(null);
            }

            // Build request URL
            List <MultipartPostPart> data = new List <MultipartPostPart>
            {
                MultipartPostPart.CreateFormPart("return_url", returnUrl)
            };

            if (backgroundReturn != null)
            {
                data.Add(MultipartPostPart.CreateFormPart("background_return_p", backgroundReturn.Value ? "1" : "0"));
            }

            if (userId != null)
            {
                data.Add(MultipartPostPart.CreateFormPart("user_id", userId.ToString()));
            }
            if (albumId != null)
            {
                data.Add(MultipartPostPart.CreateFormPart("album_id", albumId.ToString()));
            }
            if (title != null)
            {
                data.Add(MultipartPostPart.CreateFormPart("title", title));
            }
            if (description != null)
            {
                data.Add(MultipartPostPart.CreateFormPart("description", description));
            }
            if (tags != null)
            {
                data.Add(MultipartPostPart.CreateFormPart("tags", tags));
            }

            if (publish != null)
            {
                data.Add(MultipartPostPart.CreateFormPart("publish", publish.Value ? "1" : "0"));
            }

            if (validMinutes != null)
            {
                data.Add(MultipartPostPart.CreateFormPart("valid_minutes", validMinutes.ToString()));
            }
            if (maxUploads != null)
            {
                data.Add(MultipartPostPart.CreateFormPart("max_uploads", maxUploads.ToString()));
            }

            // Do the request
            MessageReceivingEndpoint requestMessage = new MessageReceivingEndpoint(_provider.GetRequestUrl("/api/photo/get-upload-token", null), HttpDeliveryMethods.PostRequest | HttpDeliveryMethods.AuthorizationHeaderRequest);

            XPathNavigator responseMessage = _provider.DoRequest(requestMessage, data);

            if (responseMessage == null)
            {
                return(null);
            }

            // Get the token
            XPathNodeIterator tokenNode = responseMessage.Select("/response");

            if (!tokenNode.MoveNext())
            {
                return(null);
            }

            Domain.PhotoUploadToken uploadToken = new Domain.PhotoUploadToken
            {
                UploadToken = Helpers.GetNodeChildValue(tokenNode.Current, "upload_token"),

                Title       = Helpers.GetNodeChildValue(tokenNode.Current, "title"),
                Description = Helpers.GetNodeChildValue(tokenNode.Current, "description"),
                Tags        = Helpers.GetNodeChildValue(tokenNode.Current, "tags"),

                Publish = (Helpers.GetNodeChildValue(tokenNode.Current, "publish") == "1"),

                UserId  = Helpers.ConvertStringToInteger(Helpers.GetNodeChildValue(tokenNode.Current, "user_id")),
                AlbumId = Helpers.ConvertStringToInteger(Helpers.GetNodeChildValue(tokenNode.Current, "album_id")),

                ValidMinutes = Helpers.ConvertStringToInteger(Helpers.GetNodeChildValue(tokenNode.Current, "valid_minutes")),
                ValidUntil   = Helpers.ConvertStringToInteger(Helpers.GetNodeChildValue(tokenNode.Current, "valid_until")),

                ReturnURL = Helpers.GetNodeChildValue(tokenNode.Current, "return_url")
            };

            // If nothing pops up, we'll return null
            return(uploadToken);
        }
Beispiel #2
0
        /// <summary>
        /// Returns a list of photos by specific parameters
        /// </summary>
        public List <Domain.Photo> GetList(PhotoListParameters requestParameters)
        {
            // Build request URL
            List <string> requestUrlParameters = new List <string>();

            if (requestParameters.AlbumId != null)
            {
                requestUrlParameters.Add("album_id=" + requestParameters.AlbumId);
            }
            if (requestParameters.PhotoId != null)
            {
                requestUrlParameters.Add("photo_id=" + requestParameters.PhotoId);
            }
            if (requestParameters.UserId != null)
            {
                requestUrlParameters.Add("user_id=" + requestParameters.UserId);
            }
            if (requestParameters.PlayerId != null)
            {
                requestUrlParameters.Add("player_id=" + requestParameters.PlayerId);
            }

            if (requestParameters.Token != null)
            {
                requestUrlParameters.Add("token=" + HttpUtility.UrlEncode(requestParameters.Token));
            }
            if (requestParameters.Search != null)
            {
                requestUrlParameters.Add("search=" + HttpUtility.UrlEncode(requestParameters.Search));
            }

            if (requestParameters.Year != null)
            {
                requestUrlParameters.Add("year=" + requestParameters.Year);
            }
            if (requestParameters.Month != null)
            {
                requestUrlParameters.Add("month=" + requestParameters.Month);
            }
            if (requestParameters.Day != null)
            {
                requestUrlParameters.Add("day=" + requestParameters.Day);
            }

            if (requestParameters.Video != null)
            {
                requestUrlParameters.Add("video_p=" + (requestParameters.Video.Value ? "1" : "0"));
            }
            if (requestParameters.Audio != null)
            {
                requestUrlParameters.Add("audio_p=" + (requestParameters.Audio.Value ? "1" : "0"));
            }
            if (requestParameters.VideoEncoded != null)
            {
                requestUrlParameters.Add("video_encoded_p=" + (requestParameters.VideoEncoded.Value ? "1" : "0"));
            }

            requestUrlParameters.Add("prioritize_promoted_p=" + (requestParameters.PrioritizePromoted ? "1": "0"));

            requestUrlParameters.Add("include_unpublished_p=" + (requestParameters.IncludeUnpublished ? "1" : "0"));

            if (requestParameters.Tags.Count > 0)
            {
                string tagString = "";

                foreach (string tag in requestParameters.Tags)
                {
                    tagString += (String.IsNullOrEmpty(tagString) ? "" : " ") + (((tag.Contains(" ")) && (tag[0] != '"')) ? "\"" + tag + "\"" : tag);
                }

                requestUrlParameters.Add("tags=" + HttpUtility.UrlEncode(tagString));
            }
            if (requestParameters.TagMode != PhotoTagMode.And)
            {
                requestUrlParameters.Add("tag_mode=" + RequestValues.Get(requestParameters.TagMode));
            }

            if (requestParameters.OrderBy != PhotoListSort.Published)
            {
                requestUrlParameters.Add("orderby=" + RequestValues.Get(requestParameters.OrderBy));
            }
            if (requestParameters.Order != GenericSort.Descending)
            {
                requestUrlParameters.Add("order=" + RequestValues.Get(requestParameters.Order));
            }

            if (requestParameters.PageOffset != null)
            {
                requestUrlParameters.Add("p=" + requestParameters.PageOffset);
            }
            if (requestParameters.Size != null)
            {
                requestUrlParameters.Add("size=" + requestParameters.Size);
            }

            // Do the request
            MessageReceivingEndpoint requestMessage = new MessageReceivingEndpoint(_provider.GetRequestUrl("/api/photo/list", requestUrlParameters), HttpDeliveryMethods.GetRequest);

            XPathNavigator responseMessage = _provider.DoRequest(requestMessage);

            if (responseMessage == null)
            {
                return(null);
            }

            // List all the videos
            XPathNodeIterator   photos = responseMessage.Select("/response/photo");
            List <Domain.Photo> result = new List <Domain.Photo>();

            while (photos.MoveNext())
            {
                // Create the domain Photo
                Domain.Photo photoModel = new Domain.Photo
                {
                    PhotoId = Helpers.ConvertStringToInteger(photos.Current.GetAttribute("photo_id", "")),

                    Title = photos.Current.GetAttribute("title", ""),
                    Token = photos.Current.GetAttribute("token", ""),
                    One   = photos.Current.GetAttribute("one", ""),

                    AlbumId    = Helpers.ConvertStringToInteger(photos.Current.GetAttribute("album_id", "")),
                    AlbumTitle = photos.Current.GetAttribute("album_title", ""),

                    Published = (photos.Current.GetAttribute("published_p", "") == "1"),
                    Promoted  = (photos.Current.GetAttribute("promoted_p", "") == "1"),

                    CreationDateANSI = photos.Current.GetAttribute("creation_date_ansi", ""),
                    CreationDateDate = photos.Current.GetAttribute("creation_date__date", ""),
                    CreationDateTime = photos.Current.GetAttribute("creation_date__time", ""),

                    OriginalDateANSI = photos.Current.GetAttribute("original_date_ansi", ""),
                    OriginalDateDate = photos.Current.GetAttribute("original_date__date", ""),
                    OriginalDateTime = photos.Current.GetAttribute("original_date__time", ""),

                    ViewCount        = Helpers.ConvertStringToInteger(photos.Current.GetAttribute("view_count", "")),
                    NumberOfComments = Helpers.ConvertStringToInteger(photos.Current.GetAttribute("number_of_comments", "")),
                    NumberOfAlbums   = Helpers.ConvertStringToInteger(photos.Current.GetAttribute("number_of_albums", "")),
                    NumberOfTags     = Helpers.ConvertStringToInteger(photos.Current.GetAttribute("number_of_tags", "")),
                    NumberOfRatings  = Helpers.ConvertStringToInteger(photos.Current.GetAttribute("number_of_ratings", "")),

                    PhotoRating = Helpers.ConvertStringToDouble(photos.Current.GetAttribute("photo_rating", "")),

                    IsVideo      = (photos.Current.GetAttribute("video_p", "") == "1"),
                    IsAudio      = (photos.Current.GetAttribute("audio_p", "") == "1"),
                    VideoEncoded = (photos.Current.GetAttribute("video_encoded_p", "") == "1"),
                    TextOnly     = (photos.Current.GetAttribute("text_only_p", "") == "1"),

                    VideoLength = Helpers.ConvertStringToDouble(photos.Current.GetAttribute("video_length", "")),

                    UserId      = Helpers.ConvertStringToInteger(photos.Current.GetAttribute("user_id", "")),
                    Username    = photos.Current.GetAttribute("username", ""),
                    DisplayName = photos.Current.GetAttribute("display_name", ""),
                    UserURL     = photos.Current.GetAttribute("user_url", ""),

                    Original = new Domain.PhotoBlock(
                        photos.Current.GetAttribute("original_width", ""),
                        photos.Current.GetAttribute("original_height", ""),
                        photos.Current.GetAttribute("original_size", ""),
                        photos.Current.GetAttribute("original_download", "")
                        ),

                    Quad16 = new Domain.PhotoBlock(
                        "16",
                        "16",
                        "0",
                        photos.Current.GetAttribute("quad16_download", "")
                        ),
                    Quad50 = new Domain.PhotoBlock(
                        photos.Current.GetAttribute("quad50_width", ""),
                        photos.Current.GetAttribute("quad50_height", ""),
                        photos.Current.GetAttribute("quad50_size", ""),
                        photos.Current.GetAttribute("quad50_download", "")
                        ),
                    Quad75 = new Domain.PhotoBlock(
                        photos.Current.GetAttribute("quad75_width", ""),
                        photos.Current.GetAttribute("quad75_height", ""),
                        photos.Current.GetAttribute("quad75_size", ""),
                        photos.Current.GetAttribute("quad75_download", "")
                        ),
                    Quad100 = new Domain.PhotoBlock(
                        photos.Current.GetAttribute("quad100_width", ""),
                        photos.Current.GetAttribute("quad100_height", ""),
                        photos.Current.GetAttribute("quad100_size", ""),
                        photos.Current.GetAttribute("quad100_download", "")
                        ),

                    Small = new Domain.PhotoBlock(
                        photos.Current.GetAttribute("small_width", ""),
                        photos.Current.GetAttribute("small_height", ""),
                        photos.Current.GetAttribute("small_size", ""),
                        photos.Current.GetAttribute("small_download", "")
                        ),
                    Medium = new Domain.PhotoBlock(
                        photos.Current.GetAttribute("medium_width", ""),
                        photos.Current.GetAttribute("medium_height", ""),
                        photos.Current.GetAttribute("medium_size", ""),
                        photos.Current.GetAttribute("medium_download", "")
                        ),
                    Portrait = new Domain.PhotoBlock(
                        photos.Current.GetAttribute("portrait_width", ""),
                        photos.Current.GetAttribute("portrait_height", ""),
                        photos.Current.GetAttribute("portrait_size", ""),
                        photos.Current.GetAttribute("portrait_download", "")
                        ),
                    Standard = new Domain.PhotoBlock(
                        photos.Current.GetAttribute("standard_width", ""),
                        photos.Current.GetAttribute("standard_height", ""),
                        photos.Current.GetAttribute("standard_size", ""),
                        photos.Current.GetAttribute("standard_download", "")
                        ),
                    Large = new Domain.PhotoBlock(
                        photos.Current.GetAttribute("large_width", ""),
                        photos.Current.GetAttribute("large_height", ""),
                        photos.Current.GetAttribute("large_size", ""),
                        photos.Current.GetAttribute("large_download", "")
                        ),

                    VideoSmall = new Domain.PhotoBlock(
                        photos.Current.GetAttribute("video_small_width", ""),
                        photos.Current.GetAttribute("video_small_height", ""),
                        photos.Current.GetAttribute("video_small_size", ""),
                        photos.Current.GetAttribute("video_small_download", "")
                        ),
                    VideoMedium = new Domain.PhotoBlock(
                        photos.Current.GetAttribute("video_medium_width", ""),
                        photos.Current.GetAttribute("video_medium_height", ""),
                        photos.Current.GetAttribute("video_medium_size", ""),
                        photos.Current.GetAttribute("video_medium_download", "")
                        ),
                    VideoHD = new Domain.PhotoBlock(
                        photos.Current.GetAttribute("video_hd_width", ""),
                        photos.Current.GetAttribute("video_hd_height", ""),
                        photos.Current.GetAttribute("video_hd_size", ""),
                        photos.Current.GetAttribute("video_hd_download", "")
                        ),
                    Video1080p = new Domain.PhotoBlock(
                        photos.Current.GetAttribute("video_1080p_width", ""),
                        photos.Current.GetAttribute("video_1080p_height", ""),
                        photos.Current.GetAttribute("video_1080p_size", ""),
                        photos.Current.GetAttribute("video_1080p_download", "")
                        ),
                    VideoMobileH263AMR = new Domain.PhotoBlock(
                        photos.Current.GetAttribute("video_mobile_h263_amr_width", ""),
                        photos.Current.GetAttribute("video_mobile_h263_amr_height", ""),
                        photos.Current.GetAttribute("video_mobile_h263_amr_size", ""),
                        photos.Current.GetAttribute("video_mobile_h263_amr_download", "")
                        ),
                    VideoMobileH263AAC = new Domain.PhotoBlock(
                        photos.Current.GetAttribute("video_mobile_h263_aac_width", ""),
                        photos.Current.GetAttribute("video_mobile_h263_aac_height", ""),
                        photos.Current.GetAttribute("video_mobile_h263_aac_size", ""),
                        photos.Current.GetAttribute("video_mobile_h263_aac_download", "")
                        ),
                    VideoMobileMPEGE4AMR = new Domain.PhotoBlock(
                        photos.Current.GetAttribute("video_mobile_mpeg4_amr_width", ""),
                        photos.Current.GetAttribute("video_mobile_mpeg4_amr_height", ""),
                        photos.Current.GetAttribute("video_mobile_mpeg4_amr_size", ""),
                        photos.Current.GetAttribute("video_mobile_mpeg4_amr_download", "")
                        ),

                    Audio = new Domain.PhotoBlock(
                        photos.Current.GetAttribute("audio_width", ""),
                        photos.Current.GetAttribute("audio_height", ""),
                        photos.Current.GetAttribute("audio_size", ""),
                        photos.Current.GetAttribute("audio_download", "")
                        ),

                    Content     = Helpers.GetNodeChildValue(photos.Current, "content"),
                    ContentText = Helpers.GetNodeChildValue(photos.Current, "content_text"),

                    BeforeDownloadType = Helpers.GetNodeChildValue(photos.Current, "before_download_type"),
                    BeforeDownloadURL  = Helpers.GetNodeChildValue(photos.Current, "before_download_url"),
                    AfterDownloadType  = Helpers.GetNodeChildValue(photos.Current, "after_download_type"),
                    AfterDownloadURL   = Helpers.GetNodeChildValue(photos.Current, "after_download_url"),

                    AfterText   = Helpers.GetNodeChildValue(photos.Current, "after_text"),
                    AbsoluteUrl = photos.Current.GetAttribute("absolute_url", ""),

                    Tags      = new List <string>(Helpers.GetNodeChildValue(photos.Current, "tags").Split(',')),
                    Variables = new Dictionary <string, string>()
                };

                // Read out custom variables.
                XPathNavigator variableNavigator = photos.Current.Clone();
                if (variableNavigator.MoveToFirstAttribute())
                {
                    if (!_defaultAttributes.Contains(variableNavigator.Name))
                    {
                        photoModel.Variables.Add(variableNavigator.Name,
                                                 variableNavigator.Value);
                    }

                    while (variableNavigator.MoveToNextAttribute())
                    {
                        if (!_defaultAttributes.Contains(variableNavigator.Name))
                        {
                            photoModel.Variables.Add(variableNavigator.Name,
                                                     variableNavigator.Value);
                        }
                    }
                }

                result.Add(photoModel);
            }

            return(result);
        }
        /// <summary>
        /// Returns a list of users by specific parameters
        /// </summary>
        public List <Domain.User> GetList(UserListParameters requestParameters)
        {
            // Build request URL
            List <string> requestUrlParameters = new List <string>();

            if (requestParameters.UserId != null)
            {
                requestUrlParameters.Add("user_id=" + requestParameters.UserId);
            }

            if (requestParameters.Search != null)
            {
                requestUrlParameters.Add("search=" + HttpUtility.UrlEncode(requestParameters.Search));
            }

            if (requestParameters.OrderBy != UserListSort.DisplayName)
            {
                requestUrlParameters.Add("orderby=" + RequestValues.Get(requestParameters.OrderBy));
            }
            if (requestParameters.Order != GenericSort.Descending)
            {
                requestUrlParameters.Add("order=" + RequestValues.Get(requestParameters.Order));
            }

            if (requestParameters.PageOffset != null)
            {
                requestUrlParameters.Add("p=" + requestParameters.PageOffset);
            }
            if (requestParameters.Size != null)
            {
                requestUrlParameters.Add("size=" + requestParameters.Size);
            }

            // Do the request
            MessageReceivingEndpoint requestMessage = new MessageReceivingEndpoint(_provider.GetRequestUrl("/api/user/list", requestUrlParameters), HttpDeliveryMethods.GetRequest);

            XPathNavigator responseMessage = _provider.DoRequest(requestMessage);

            if (responseMessage == null)
            {
                return(null);
            }

            // List all the videos
            XPathNodeIterator  users  = responseMessage.Select("/response/user");
            List <Domain.User> result = new List <Domain.User>();

            while (users.MoveNext())
            {
                if (users.Current == null)
                {
                    return(null);
                }

                // Create the domain User
                Domain.User userModel = new Domain.User
                {
                    UserId        = Helpers.ConvertStringToInteger(users.Current.GetAttribute("user_id", "")),
                    Username      = users.Current.GetAttribute("username", ""),
                    DisplayName   = users.Current.GetAttribute("display_name", ""),
                    URL           = users.Current.GetAttribute("url", ""),
                    FullName      = users.Current.GetAttribute("full_name", ""),
                    Email         = users.Current.GetAttribute("email", ""),
                    SiteAdmin     = (users.Current.GetAttribute("site_admin", "") != "f"),
                    AboutAbstract = Helpers.GetNodeChildValue(users.Current, "about_abstract")
                };

                result.Add(userModel);
            }

            return(result);
        }
        /// <summary>
        /// Returns a list of comments by specific parameters
        /// </summary>
        public List <Domain.Comment> GetList(CommentListParameters requestParameters)
        {
            // Build request URL
            List <string> requestUrlParameters = new List <string>();

            if (requestParameters.ObjectId != null)
            {
                requestUrlParameters.Add("object_id=" + requestParameters.ObjectId);
            }
            if (requestParameters.ObjectType != CommentObjectType.Empty)
            {
                requestUrlParameters.Add("order=" + RequestValues.Get(requestParameters.ObjectType));
            }

            if (requestParameters.CommentId != null)
            {
                requestUrlParameters.Add("comment_id=" + requestParameters.CommentId);
            }
            if (requestParameters.CommentUserId != null)
            {
                requestUrlParameters.Add("comment_user_id=" + requestParameters.CommentUserId);
            }

            if (requestParameters.Search != null)
            {
                requestUrlParameters.Add("search=" + HttpUtility.UrlEncode(requestParameters.Search));
            }

            if (requestParameters.Order != GenericSort.Descending)
            {
                requestUrlParameters.Add("order=" + RequestValues.Get(requestParameters.Order));
            }

            if (requestParameters.PageOffset != null)
            {
                requestUrlParameters.Add("p=" + requestParameters.PageOffset);
            }
            if (requestParameters.Size != null)
            {
                requestUrlParameters.Add("size=" + requestParameters.Size);
            }

            // Do the request
            MessageReceivingEndpoint requestMessage = new MessageReceivingEndpoint(_provider.GetRequestUrl("/api/comment/list", requestUrlParameters), HttpDeliveryMethods.GetRequest);

            XPathNavigator responseMessage = _provider.DoRequest(requestMessage);

            if (responseMessage == null)
            {
                return(null);
            }

            // List all the videos
            XPathNodeIterator     comments = responseMessage.Select("/response/comment");
            List <Domain.Comment> result   = new List <Domain.Comment>();

            while (comments.MoveNext())
            {
                if (comments.Current == null)
                {
                    return(null);
                }

                // Create the domain album
                Domain.Comment commentModel = new Domain.Comment();

                commentModel.CommentId = Helpers.ConvertStringToInteger(comments.Current.GetAttribute("comment_id", ""));

                commentModel.ObjectId = Helpers.ConvertStringToInteger(comments.Current.GetAttribute("object_id", ""));
                switch (comments.Current.GetAttribute("object_type", ""))
                {
                case "album":
                    commentModel.ObjectType = CommentObjectType.Album;
                    break;

                case "photo":
                    commentModel.ObjectType = CommentObjectType.Photo;
                    break;

                default:
                    commentModel.ObjectType = CommentObjectType.Empty;
                    break;
                }

                commentModel.PrettyDate = comments.Current.GetAttribute("pretty_date", "");
                commentModel.PrettyTime = comments.Current.GetAttribute("pretty_time", "");

                commentModel.ShortDate        = comments.Current.GetAttribute("short_date", "");
                commentModel.CreationDateANSI = comments.Current.GetAttribute("creation_date_ansi", "");

                commentModel.UserId        = (!String.IsNullOrEmpty(comments.Current.GetAttribute("user_id", "")) ? (int?)Helpers.ConvertStringToInteger(comments.Current.GetAttribute("user_id", "")) : null);
                commentModel.Name          = comments.Current.GetAttribute("name", "");
                commentModel.Email         = comments.Current.GetAttribute("email", "");
                commentModel.TruncatedName = comments.Current.GetAttribute("truncated_name", "");

                commentModel.Content     = Helpers.GetNodeChildValue(comments.Current, "content");
                commentModel.ContentText = Helpers.GetNodeChildValue(comments.Current, "content_text");

                result.Add(commentModel);
            }

            return(result);
        }
Beispiel #5
0
        /// <summary>
        /// Returns a list of albums by specific parameters
        /// </summary>
        public List <Domain.Album> GetList(AlbumListParameters requestParameters)
        {
            // Build request URL
            List <string> requestUrlParameters = new List <string>();

            if (requestParameters.AlbumId != null)
            {
                requestUrlParameters.Add("album_id=" + requestParameters.AlbumId);
            }
            if (requestParameters.UserId != null)
            {
                requestUrlParameters.Add("user_id=" + requestParameters.UserId);
            }
            if (requestParameters.PhotoId != null)
            {
                requestUrlParameters.Add("photo_id=" + requestParameters.PhotoId);
            }

            if (requestParameters.Search != null)
            {
                requestUrlParameters.Add("search=" + HttpUtility.UrlEncode(requestParameters.Search));
            }

            if (requestParameters.IncludeHidden)
            {
                requestUrlParameters.Add("include_hidden_p=1");
            }

            if (requestParameters.OrderBy != AlbumListSort.CreationDate)
            {
                requestUrlParameters.Add("orderby=" + RequestValues.Get(requestParameters.OrderBy));
            }
            if (requestParameters.Order != GenericSort.Descending)
            {
                requestUrlParameters.Add("order=" + RequestValues.Get(requestParameters.Order));
            }

            if (requestParameters.PageOffset != null)
            {
                requestUrlParameters.Add("p=" + requestParameters.PageOffset);
            }
            if (requestParameters.Size != null)
            {
                requestUrlParameters.Add("size=" + requestParameters.Size);
            }

            // Do the request
            MessageReceivingEndpoint requestMessage = new MessageReceivingEndpoint(_provider.GetRequestUrl("/api/album/list", requestUrlParameters), HttpDeliveryMethods.GetRequest);

            XPathNavigator responseMessage = _provider.DoRequest(requestMessage);

            if (responseMessage == null)
            {
                return(null);
            }

            // List all the videos
            XPathNodeIterator   albums = responseMessage.Select("/response/album");
            List <Domain.Album> result = new List <Domain.Album>();

            while (albums.MoveNext())
            {
                if (albums.Current == null)
                {
                    return(null);
                }

                // Create the domain album
                Domain.Album albumModel = new Domain.Album
                {
                    AlbumId = Helpers.ConvertStringToInteger(albums.Current.GetAttribute("album_id", "")),

                    Title = albums.Current.GetAttribute("title", ""),

                    PrettyDate = albums.Current.GetAttribute("pretty_date", ""),
                    PrettyTime = albums.Current.GetAttribute("pretty_time", ""),

                    One = albums.Current.GetAttribute("one", ""),
                    CreationDateANSI = albums.Current.GetAttribute("creation_date_ansi", ""),

                    UserId      = Helpers.ConvertStringToInteger(albums.Current.GetAttribute("user_id", "")),
                    UserUrl     = albums.Current.GetAttribute("user_url", ""),
                    Username    = albums.Current.GetAttribute("username", ""),
                    DisplayName = albums.Current.GetAttribute("display_name", ""),

                    Token = albums.Current.GetAttribute("token", ""),
                    Hide  = (albums.Current.GetAttribute("hide_p", "") == "1"),

                    Content     = Helpers.GetNodeChildValue(albums.Current, "content"),
                    ContentText = Helpers.GetNodeChildValue(albums.Current, "content_text")
                };

                result.Add(albumModel);
            }

            return(result);
        }