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

adds template field to api response #91

Merged
merged 2 commits into from
Aug 14, 2021

Conversation

aidenwallis
Copy link
Contributor

@aidenwallis aidenwallis commented Aug 13, 2021

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

Problem/Feature

With the addition of the template field on /chat/emotes?broadcaster_id=, there is a template field added to the API response, but isn't shown in twitch api calls. This adds it to the model so that it can unmarshal it.

Description of Changes:

  • Adds template response

Checklist

  • My code follows the Contribution Guide
  • I have self-reviewed the changes being requested
  • I have made comments on pieces of code that may be difficult to understand for other editors
  • I have updated the documentation (if applicable)

Copy link
Contributor

@zneix zneix left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't fix the issue, because inside internal/api/api.go full response from apiResponse variable is assigned to data only on non-2xx codes:

if resp.StatusCode > 299 || resp.StatusCode < 200 {
data = apiResponse
break
}

In all other scenarios, only data.Data is set and thus only content of the "data" array from the actual Helix call is returned and shown.
Given that, fields other than the "data" array will never be shown. I believe Twitch just didn't expect any other fields than data be returned on 2xx responses (unlike it was done in Kraken).

So anyway, a fix that makes it, so other fields than data can be returned would have to be made for this PR to work properly ;)

@aidenwallis
Copy link
Contributor Author

fixed, ty @zneix

@lleadbet lleadbet merged commit de5d1ff into twitchdev:main Aug 14, 2021
@lleadbet
Copy link
Contributor

Thanks for the fix, @aidenwallis! Will cut a release next week to include this.

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

Successfully merging this pull request may close these issues.

3 participants