FeedHive/twitter-api-client

Trend functionality not working as expected

shaun-hume opened this issue · 3 comments

Describe the bug
When using the Trends api functions - the documentation appears to suggest that you need to pass through the WOEID, or IDs in general as integers into the functions, however if you pass in just the value, the URL is malformed:
https://api.twitter.com/1.1/trends/place.json?
instead of https://api.twitter.com/1.1/trends/place.json?id=1

To reproduce
Steps to reproduce the behavior:

  1. Run await twitterClient.trends.trendsPlace(1);
  2. You will receive a 404 error
  3. Call function again as await twitterClient.trends.trendsPlace({id: 1});
  4. Function will run successfully

Expected behavior
I would expect the documentation to clearly express what payload it was expecting, or that the function runs successfully when passing through the integer by itself

Package Manager:
To install Twitter API Client, I used npm

Thanks a lot for creating this issue.
I will investigate very soon.

All good Simon :) I've been using it more and I think I can see why you've done it this way - for some of the functions you need to push through multiple different parameters (eg. id, name, query, etc.)

If I read your documentation you can figure out what key you need to include, (eg. {id: idValue}). And as I've written this out I guess this is the way of implementing named parameters so you might have done this purposefully.

Feel free to close this off if you intentionally did it this way!

Ahh, yes.
If you only refer to the fact that all parameters are given by name, like {id: 1}, then yes - that's a deliberate design choice 😁

Sorry, I missed step 4, where it actually runs successfully.
I will close this issue again.