ChimeraCoder / anaconda

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

Add GetUsersSuggestions #219

Closed DylanGraham closed 6 years ago

DylanGraham commented 6 years ago

Add /users/suggestions.json endpoint. Not sure if you are after contributions, let me know if not!

muesli commented 6 years ago

Looks good to me! Will reopen to trigger a new CI build.

muesli commented 6 years ago

@DylanGraham: Please always gofmt your code before committing! You can simply do that and push the fix to your fork. This will update this pull request automatically and should hopefully make the CI happy.

DylanGraham commented 6 years ago

Wow, so sorry! IntelliJ is meant to do that automatically :joy:

muesli commented 6 years ago

No worries, thanks for your contribution!

muesli commented 6 years ago

Actually, this isn't quite doing what I was expecting it to do. Unlike the docs suggest at first glance, it's not returning a list of suggested users, but a list of suggested categories. This will need some further wrapping to decode it properly: it just happens to JSON decode the name value into the User struct's name.

Instead of reverting this, I'll look into finishing this up myself.

DylanGraham commented 6 years ago

I was thinking the output list of name would be used in another function to get the list of users from each category. Or would you prefer both the /users/suggestions and /users/suggestions/:slug were called in the one function?

muesli commented 6 years ago

The existing GetUsersSuggestions should then return the categories along with their slugs, which we'll have to add a new struct for. I'd recommend following anaconda's style by adding a GetUsersSuggestionsBySlug method, which then really returns the list of users.