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

Implemented the 'channel:manage:broadcast' scope #335

Closed
wants to merge 1 commit into from
Closed

Implemented the 'channel:manage:broadcast' scope #335

wants to merge 1 commit into from

Conversation

TheOct0
Copy link

@TheOct0 TheOct0 commented Feb 22, 2022

Type: Improvement

Fixes: #323

As issue #323 states, Twitch updated their API documentation a year ago to state that the "user:edit:broadcast" scope was replaced with the "channel:manage:broadcast". This PR aims at providing the possibility of passing an argument to the ApiClient to use it.

This adds a useNewBroadcastScope boolean to the ApiConfig object that is used in that constructor, which alters the behaviour of the 3 relevant methods (updateChannelInfo, createStreamMarker and replaceStreamTags).

/**
* Whether or not to use the new channel:manage:broadcast scope
*/
useNewBroadcastScope?: boolean;
Copy link
Member

Choose a reason for hiding this comment

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

I would reverse the logic on this, i.e. name it useLegacyBroadcastEditScope and make it default to true.

await this._client.callApi({
type: 'helix',
url: 'channels',
method: 'PATCH',
scope: 'user:edit:broadcast',
scope: scope,
Copy link
Member

Choose a reason for hiding this comment

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

No need to repeat here. You can use the object shorthand in all methods.

try {
const result = await this._client.callApi<HelixResponse<HelixStreamMarkerData>>({
url: 'streams/markers',
method: 'POST',
type: 'helix',
scope: 'user:edit:broadcast',
scope: scope,
Copy link
Member

Choose a reason for hiding this comment

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

Shorthand

await this._client.callApi({
type: 'helix',
url: 'streams/tags',
scope: 'user:edit:broadcast',
scope: scope,
Copy link
Member

Choose a reason for hiding this comment

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

Shorthand

@d-fischer
Copy link
Member

Superseded by #343.

@d-fischer d-fischer closed this Mar 26, 2022
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.

None yet

2 participants