Жизнь это - мгновения, промежутки. Ночь ушла, солнце скоро взойдет. Сделайте эти промежутки настолько прекрасными насколько это возможно - наполненными молчанием, наполненными благодарностью к существованию, которое дало вам шанс, благодарностью по отношению ко всем тем, кто вам помог. И ждите.


1 мая 2017 г.

WordPressSharp

A C# client to to interact with the WordPress XML-RPC API 
C#
Latest commit 31d7200 on 28 Nov 2016@abrudtkuhl  committed on GitHub Merge pull request #62 from fradav/master 

 README.md

#WordPressSharp# A C# client to interact with the WordPress XML-RPC API
##Install## I'm working on a Nuget package once I'm done mapping all the WP XML-RPC endpoints.
In the meantime, you'll have to clone, build, and add the DLL the ole fashioned way
##Config## Use your config file to for configuration settings:
xml
version="1.0" encoding="utf-8" ?> <configuration> <appSettings> <add key="WordPressUsername" value="" /> <add key="WordPressPassword" value="" /> <add key="WordPressBaseUrl" value="" /> <add key="WordPressBlogId" value="" /> </appSettings> </configuration>


As an alternative you can use the WordPressSiteConfig class to store configuration settings.
#Examples#
##Create Post##
using (var client = new WordPressClient()) 
{
    var post = new Post
    {
        PostType = "post",
        Title = "My Awesome Post",
        Content = "This is the content
", PublishDateTime = DateTime.Now }; var id = Convert.ToInt32(client.NewPost(post)); }
##Create Post Tag##
using (var client = new WordPressClient())
{
    var termId = client.NewTerm(new Term
    {
        Name = "term test",
        Description = "term description",
        Slug = "term_test",
        Taxonomy = "post_tag"
    });
}
##Add feature image## You can add a feature image by using the Data.CreateFromUrl or Data.CreateFromFilePath:
string url = "https://unsplash.imgix.net/photo-1423683249427-8ca22bd873e0";
using (var client = new WordPressClient()) 
{
    var post = new Post
    {
        PostType = "post",
        Title = "New photo from Unsplash",
        Content = "Check out this new picture from Unsplash.
", PublishDateTime = DateTime.Now }; var featureImage = Data.CreateFromUrl(url); post.FeaturedImageId = client.UploadFile(featureImage).Id; var id = Convert.ToInt32(client.NewPost(post)); }
#Dependencies# XML-RPC.net
#Resources# WordPress XML-RPC API
#Notes# Inspired by the POSSIBLE.WordPress.XmlRpcClient by markeverard

Комментариев нет:

Отправить комментарий