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

api.helix.channels.startChannelCommercial should be a POST and the method is not defined in the request #228

Closed
MikeMayer opened this issue Feb 20, 2021 · 1 comment

Comments

@MikeMayer
Copy link

Hey there-

The helix API startChannelCommercial won't work because the method is defaulting to GET. It [should be a POST].(https://dev.twitch.tv/docs/api/reference#start-commercial). I've also temporarily modified my local copy of the library to include the method parameter in this call.

As seen here: https://github.com/d-fischer/twitch/blob/7721e45cfce2498dc93ac5b914a25c6e9bbf261e/packages/twitch/src/API/Helix/Channel/HelixChannelApi.ts#L90

At the time of issue creation

async startChannelCommercial(broadcaster: UserIdResolvable, length: CommercialLength): Promise<void> {
		await this._client.callApi({
			type: TwitchApiCallType.Helix,
			url: 'channels/commercial',
			scope: 'channel:edit:commercial',
			jsonBody: {
				broadcaster_id: extractUserId(broadcaster),
				length: length
			}
		});
	}

We can easily resolve this by just including the method parameter as well as POST.

Fix

async startChannelCommercial(broadcaster: UserIdResolvable, length: CommercialLength): Promise<void> {
		await this._client.callApi({
			type: TwitchApiCallType.Helix,
			url: 'channels/commercial',
                        method: 'POST',
			scope: 'channel:edit:commercial',
			jsonBody: {
				broadcaster_id: extractUserId(broadcaster),
				length: length
			}
		});
	}
@d-fischer
Copy link
Member

Fixed in 0fee74d but forgot the "closes" statement. Also released with 4.4.12. Thanks for reporting!

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

No branches or pull requests

2 participants