Current section
Files
Jump to
Current section
Files
lib/resources/ads/start_commercial.ex
defmodule TwitchApi.Ads.StartCommercial do
@moduledoc """
⛔ This module is autogenerated please do not modify manually.
## Example request from twitch api docs:
### descriptions:
This request starts a commercial.
### requests:
curl -X POST 'https://api.twitch.tv/helix/channels/commercial'
-H'Authorization: Bearer 2gbdx6oar67tqtcmt49t3wpcgycthx'
-H'Client-Id: wbmytr93xzw8zbg0p1izqyzzc5mbiz'
-H'Content-Type: application/json'
--data-raw'{
"broadcaster_id": "41245072",
"length": 60
}'
## Example response from twitch api docs:
### descriptions:
### responses:
{"data":[{"length":60,"message":"","retry_after":480}]}
"""
alias TwitchApi.MyFinch
alias TwitchApi.ApiJson.Template.Method.Headers
@doc """
### Description:
Starts a commercial on a specified channel.
### Required authentication:
OAuth Token required
Required scope: channel:edit:commercial
### Required authorization:
"""
# Map containing the user needed information for the user OAuth access token fetch
@type user_info :: %{user_id: integer | binary} | %{user_name: binary}
# ID of the channel requesting a commercialMinimum => 1 Maximum => 1
@spec call(
%{
required(:broadcaster_id) => String.t(),
# Desired length of the commercial in seconds. Valid options are 30 60 90 120 150 180.
required(:length) => integer
}
| nil,
user_info
) :: {:ok, Finch.Response.t()} | {:error, Exception.t()}
def call(body_params, user_info) do
MyFinch.request(
"POST",
"https://api.twitch.tv/helix/channels/commercial",
Headers.config_oauth_headers(user_info),
body_params
)
end
end