Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mapping breaks when wp.getCommentCount returns int if there is a '0' and string if there is an actual number #22

Open
punjabisoul opened this issue Apr 4, 2013 · 1 comment

Comments

@punjabisoul
Copy link
Contributor

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

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

@alexjamesbrown
Copy link
Owner

Hey,
If you could do a pull request on this i'll merge it in,

Thanks

punjabisoul added a commit to punjabisoul/JoeBlogs that referenced this issue Apr 15, 2013
punjabisoul added a commit to punjabisoul/JoeBlogs that referenced this issue Apr 15, 2013
alexjamesbrown added a commit that referenced this issue Apr 26, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants