ChimeraCoder / anaconda

A Go client library for the Twitter 1.1 API
MIT License
1.14k stars 247 forks source link

Fix wrong return type of get direct message show function #181

Closed ThanawatP closed 6 years ago

ThanawatP commented 7 years ago

I found an error when I use function GetDirectMessagesShow My code is api.GetDirectMessagesShow(url.Values{"id": []string{direct_message_id}). An error message is

json: cannot unmarshal object into Go value of type []anaconda.DirectMessage

According to twitter api document https://dev.twitter.com/rest/reference/get/direct_messages/show. It returns a single direct message, specified by an id parameter. It's example response shows there is a direct message in an array as show below. [ { "created_at": "Mon Aug 27 17:21:03 +0000 2012","..." } ] But when I use api via twitter api console, it returns only a direct message, not in an array. It should return DirectMessage, not []DirectMessage. Then I change the return data type from []DirectMessage to DirectMessage, it returns data without an error.

muesli commented 7 years ago

Can confirm that's an issue and your fix works fine. Could you please rebase and squash your commits into a single one? Thanks!

@ChimeraCoder: Otherwise LGTM!

ThanawatP commented 6 years ago

@muesli ok. I will work on it. Thanks for reviewing and commenting my merged issue.

muesli commented 6 years ago

@ThanawatP: rebased & squashed that for you. Will merge once the CI confirms everything's fine.

muesli commented 6 years ago

Will manually merge since appveyor/branch is stuck.

muesli commented 6 years ago

Heh, guess I can't do that, since the branch is protected ;-) @ChimeraCoder: can you try to give appveyor a kick? I guess otherwise I could just force push to the branch again.

ChimeraCoder commented 6 years ago

There you go! (Closing and reopening retriggers the webhooks).

muesli commented 6 years ago

@ChimeraCoder: Sadly it still didn't trigger continuous-integration/appveyor/branch, which doesn't even have a Details button next to it. Makes me wonder if there's something broken with the AppVeyor config?

ThanawatP commented 6 years ago

@muesli I apologize for late rebase & squash my commits. It seem you did it already. Can I do anything to help you for now ?

muesli commented 6 years ago

@ThanawatP: No worries! I'm afraid we will have to wait for @ChimeraCoder to look into the appveyor check still being stuck, as I don't have access to the appveyor config. I'm sure he will get to it, soon.

ThanawatP commented 6 years ago

@muesli Ok. Thank you.

ChimeraCoder commented 6 years ago

I've disabled the "branch" check on Appveyor, since it seems to be buggy. We should be good to go here.