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
Error on call any endpoint #3
Comments
(Sorry for my bad english) |
This is correct. Has it solved your issue? |
How can I see the existing point rewards? |
Which error do you get? |
|
EZTwitch doesn't take care of the needed params given by the Twitch API. Please check out the reference to see which parameters you need. In your case, to add the parameters, just do it like so: ezTwitchClient.api('get', `${endpoints.CHANNEL_POINTS.GET_CUSTOM_REWARD_REDEMPTION}?your_param=xyz&other_param=abc`) Replace your_param and other_param, as it's only a placeholder. I hope I could help you :) |
There's no way to get broadcaster id easily with EZTwitch? |
Not yet. Usually you just fetch the user using the login (reference). I use a chrome extension for that because it's faster, here's a link. If you like, I'll add a feature like that to eztwitch soon. |
I will give it a try, thanks! |
No problem, hope it helps! :) |
it should be const broadcasterId = await ezTwitchClient.api('get', endpoints.USERS.GET.USER + "?name=<name>")
.then(data=>encodeURIComponent(data.user_id))
.catch(console.error);
await ezTwitchClient.api('get', endpoints.CHANNEL_POINTS.GET_CUSTOM_REWARD_REDEMPTION + "?broadcaster_id=" + broadcasterId).then(console.log).catch(console.error) |
Nope, you're putting the user data as a param here 🤔 |
You could simplify it with a helper function: async function getUserId(name, api) {
return api.api('get', endpoints.USERS.GET.USER + "?name=" + encodeURIComponent(name)).then(user=>user.id).then(id=>encodeURIComponent(id));
}
await ezTwitchClient.api('get', endpoints.CHANNEL_POINTS.GET_CUSTOM_REWARD_REDEMPTION + "?broadcaster_id=" + await getUserId('channel_name'))
.then(console.log)
.catch(console.error) |
You don't need to encode the url component as the id is just a set of numbers without spaces etc. |
i know, just good practice |
Good point. |
@ArsDankeZik you might close this if we could help you :) |
@FishingHacks That works better than the solution you posted before that 👍 |
I forgot it back then - I will close this now. |
Client-ID and Authorization removed for obvious reasons.
On calling any endpoint
ezTwitchClient.api('get', endpoints.CHANNEL_POINTS).then(console.log).catch(console.error)
returns next error:utils
is working fine.The text was updated successfully, but these errors were encountered: