using CookComputing.XmlRpc; namespace MetaWeblogApi { /// /// This class can be used to programmatically interact with a Weblog on /// MSN Spaces using the MetaWeblog API. /// [XmlRpcUrl( "https://storage.msn.com/storageservice/MetaWeblog.rpc" )] public class MsnSpacesMetaWeblog : XmlRpcClientProtocol { /// /// Returns the most recent draft and non-draft blog posts sorted in descending order by publish date. /// /// This should be the string MyBlog, which indicates that the post is being created in the user’s blog. /// The name of the user’s space. /// The user’s secret word. /// The number of posts to return. The maximum value is 20. /// [XmlRpcMethod( "metaWeblog.getRecentPosts" )] public Post[] getRecentPosts( string blogid, string username, string password, int numberOfPosts ) { return ( Post[] )Invoke( "getRecentPosts", new object[] {blogid, username, password, numberOfPosts} ); } /// /// Posts a new entry to a blog. /// /// This should be the string MyBlog, which indicates that the post is being created in the user’s blog. /// The name of the user’s space. /// The user’s secret word. /// A struct representing the content to update. /// If false, this is a draft post. /// The postid of the newly-created post. [XmlRpcMethod( "metaWeblog.newPost" )] public string newPost( string blogid, string username, string password, Post content, bool publish ) { return ( string )Invoke( "newPost", new object[] {blogid, username, password, content, publish} ); } /// /// Edits an existing entry on a blog. /// /// The ID of the post to update. /// The name of the user’s space. /// The user’s secret word. /// A struct representing the content to update. /// If false, this is a draft post. /// Always returns true. [XmlRpcMethod( "metaWeblog.editPost" )] public bool editPost( string postid, string username, string password, Post content, bool publish ) { return ( bool )Invoke( "editPost", new object[] {postid, username, password, content, publish} ); } /// /// Deletes a post from the blog. /// /// This value is ignored. /// The ID of the post to update. /// The name of the user’s space. /// The user’s secret word. /// This value is ignored. /// Always returns true. [XmlRpcMethod( "blogger.deletePost" )] public bool deletePost( string appKey, string postid, string username, string password, bool publish ) { return ( bool )Invoke( "deletePost", new object[] {appKey, postid, username, password, publish} ); } /// /// Returns information about the user’s space. An empty array is returned if the user does not have a space. /// /// This value is ignored. /// The name of the user’s space. /// An array of structs that represents each of the user’s blogs. The array will contain a maximum of one struct, since a user can only have a single space with a single blog. /// [XmlRpcMethod( "blogger.getUsersBlogs" )] public UserBlog[] getUsersBlogs( string appKey, string username, string password ) { return ( UserBlog[] )Invoke( "getUsersBlogs", new object[] {appKey, username, password} ); } /// /// Returns basic user info (name, e-mail, userid, and so on). /// /// This value is ignored. /// The name of the user’s space. /// A struct containing profile information about the user. /// Each struct will contain the following fields: nickname, userid, url, e-mail, /// lastname, and firstname. /// [XmlRpcMethod( "blogger.getUserInfo" )] public UserInfo getUserInfo( string appKey, string username, string password ) { return ( UserInfo )Invoke( "getUserInfo", new object[] {appKey, username, password} ); } /// /// Returns a specific entry from a blog. /// /// The ID of the post to update. /// The name of the user’s space. /// The user’s secret word. /// Always returns true. [XmlRpcMethod( "metaWeblog.getPost" )] public Post getPost( string postid, string username, string password ) { return ( Post )Invoke( "getPost", new object[] {postid, username, password} ); } /// /// Returns the list of categories that have been used in the blog. /// /// This should be the string MyBlog, which indicates that the post is being created in the user’s blog. /// The name of the user’s space. /// The user’s secret word. /// An array of structs that contains one struct for each category. Each category struct will contain a description field that contains the name of the category. [XmlRpcMethod( "metaWeblog.getCategories" )] public Category[] getCategories( string blogid, string username, string password ) { return ( Category[] )Invoke( "getCategories", new object[] {blogid, username, password} ); } } }