コード例 #1
0
ファイル: Mapper.cs プロジェクト: ericdellis17/JoeBlogs
 internal static XmlRpcCategoryNew CategoryNew(CategoryNew input)
 {
     return new XmlRpcCategoryNew
     {
         description = input.Description,
         name = input.Name,
         parentId = input.ParentCategoryID,
         slug = input.Slug
     };
 }
コード例 #2
0
 internal static XmlRpcCategoryNew CategoryNew(CategoryNew input)
 {
     return(new XmlRpcCategoryNew
     {
         description = input.Description,
         name = input.Name,
         parentId = input.ParentCategoryID,
         slug = input.Slug
     });
 }
コード例 #3
0
        /// <summary>
        /// News the category.
        /// </summary>
        /// <param name="name">The name.</param>
        /// <param name="slug">The slug.</param>
        /// <param name="parentId">The parent id.</param>
        /// <param name="description">The description.</param>
        /// <returns></returns>
        public int NewCategory(string name, string slug, int parentId, string description)
        {
            var catNew = new CategoryNew
            {
                Description      = description,
                Slug             = slug,
                ParentCategoryID = parentId
            };

            return(NewCategory(catNew));
        }
コード例 #4
0
 /// <summary>
 /// News the category.
 /// </summary>
 /// <param name="category">The category.</param>
 /// <returns></returns>
 public int NewCategory(CategoryNew category)
 {
     return _wrapper.NewCategory(this.BlogID, Username, Password, Map.From.Category(category));
 }
コード例 #5
0
        /// <summary>
        /// News the category.
        /// </summary>
        /// <param name="name">The name.</param>
        /// <param name="slug">The slug.</param>
        /// <param name="parentId">The parent id.</param>
        /// <param name="description">The description.</param>
        /// <returns></returns>
        public int NewCategory(string name, string slug, int parentId, string description)
        {
            var catNew = new CategoryNew
            {
                Description = description,
                Slug = slug,
                ParentCategoryID = parentId
            };

            return NewCategory(catNew);
        }
コード例 #6
0
 /// <summary>
 /// News the category.
 /// </summary>
 /// <param name="category">The category.</param>
 /// <returns></returns>
 public int NewCategory(CategoryNew category)
 {
     return(_wrapper.NewCategory(this.BlogID, Username, Password, Map.From.Category(category)));
 }
コード例 #7
0
ファイル: Program.cs プロジェクト: ericdellis17/JoeBlogs
    static void Main(string[] args)
    {
        //remember to include the http://
        string Url = "http://joeblogstest.alexjamesbrown.com/xmlrpc.php"; //change this to the location of your xmlrpc.php file
        //typically http://www.yourdomain.com/xmlrpc.php (if your wordpress blog is installed in root dir)

        string User = "******"; //enter your username
        string Password = "******"; //enter your password

        _wpWrapper = new WordPressWrapper(Url, User, Password);

        #region Posts
        //create a new post
        var newPostID = createNewPost();

        //edit the post created above
        editPost(newPostID);

        //delete post created above
        _wpWrapper.DeletePost(newPostID);

        //get list of post status'
        var statusList = _wpWrapper.GetPostStatusList();
        #endregion

        #region Authors
        _wpWrapper.GetAuthors();
        #endregion

        #region Pages
        //create new page
        var newpageID = createPage();

        //get list of pages
        var pageList = _wpWrapper.GetPageList();

        //delete page
        var pageHasBeenDeleted = _wpWrapper.DeletePage(newpageID);

        //get page (using the ID from the page created above)
        var page = _wpWrapper.GetPage(newpageID);

        //todo: edit page
        #endregion

        #region Category

        //create a category
        var category = new CategoryNew
        {
            Description = "This is a test description",
            Name = "Alex Cat",
            Slug = "testSlug"
        };

        var catID = _wpWrapper.NewCategory(category);

        var cats = _wpWrapper.GetCategories();

        var deletedCat = _wpWrapper.DeleteCategory(catID);
        #endregion

        #region Comments
        //create a new post
        var newPostForComment = createNewPost();

        var comment = new Comment(newPostForComment)
        {
            AuthorEmail = "*****@*****.**",
            AuthorName = "Joe Blogs",
            Content = "This is a bit of text for the comment",
            AuthorUrl = "www.alexjamesbrown.com"
        };

        //add a comment to this post
        _wpWrapper.NewComment(newPostForComment, comment);
        #endregion
    }