Beispiel #1
0
        /// <summary>
        /// Update a page.
        /// Documentation https://developers.google.com/blogger/v3/reference/pages/update
        /// Generation Note: This does not always build corectly.  Google needs to standardise things I need to figuer out which ones are wrong.
        /// </summary>
        /// <param name="service">Authenticated blogger service.</param>
        /// <param name="blogId">The ID of the Blog.</param>
        /// <param name="pageId">The ID of the Page.</param>
        /// <param name="body">A valid blogger v3 body.</param>
        /// <param name="optional">Optional paramaters.</param>        /// <returns>PageResponse</returns>
        public static Page Update(bloggerService service, string blogId, string pageId, Page body, PagesUpdateOptionalParms optional = null)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (body == null)
                {
                    throw new ArgumentNullException("body");
                }
                if (blogId == null)
                {
                    throw new ArgumentNullException(blogId);
                }
                if (pageId == null)
                {
                    throw new ArgumentNullException(pageId);
                }

                // Building the initial request.
                var request = service.Pages.Update(body, blogId, pageId);

                // Applying optional parameters to the request.
                request = (PagesResource.UpdateRequest)SampleHelpers.ApplyOptionalParms(request, optional);

                // Requesting data.
                return(request.Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Pages.Update failed.", ex);
            }
        }
        /// <summary>
        /// Gets one comment by ID.
        /// Documentation https://developers.google.com/blogger/v3/reference/comments/get
        /// Generation Note: This does not always build corectly.  Google needs to standardise things I need to figuer out which ones are wrong.
        /// </summary>
        /// <param name="service">Authenticated blogger service.</param>
        /// <param name="blogId">ID of the blog to containing the comment.</param>
        /// <param name="postId">ID of the post to fetch posts from.</param>
        /// <param name="commentId">The ID of the comment to get.</param>
        /// <param name="optional">Optional paramaters.</param>        /// <returns>CommentResponse</returns>
        public static Comment Get(bloggerService service, string blogId, string postId, string commentId, CommentsGetOptionalParms optional = null)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (blogId == null)
                {
                    throw new ArgumentNullException(blogId);
                }
                if (postId == null)
                {
                    throw new ArgumentNullException(postId);
                }
                if (commentId == null)
                {
                    throw new ArgumentNullException(commentId);
                }

                // Building the initial request.
                var request = service.Comments.Get(blogId, postId, commentId);

                // Applying optional parameters to the request.
                request = (CommentsResource.GetRequest)SampleHelpers.ApplyOptionalParms(request, optional);

                // Requesting data.
                return(request.Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Comments.Get failed.", ex);
            }
        }