JoeBlogs
JoeBlogs copied to clipboard
Mapping breaks when wp.getCommentCount returns int if there is a '0' and string if there is an actual number
Hi Alex Thanks for writing this awesome API!!
I am trying to download post data from my wordpress blog, but the following happens: Call var commentcount = wordPressWrapper.GetCommentCount(post.PostID.ToString()); in a try/catch block
- with the current bindings in stuct CommentCount as int and zero comments the code works
- but when there are comments the binding throws an exception that the response contains string where int is expected.
FIX: Looking at the XML-RPC documentation
- http://xml-rpc.net/faq/xmlrpcnetfaq-2-5-0.html
- 1.16 How do I specify data whose type is not known until runtime? it suggests to use System.Object, this works for me.
CHANGE: In the /classes/CommentCount.cs and /xmlRpcStructs/CommentCount.cs change all the types from int to object and then handle actual conversion outside the API i.e. in my project like: commentcount.Approved.ToString()
Hope this helps
Hey, If you could do a pull request on this i'll merge it in,
Thanks