Current section

Files

Jump to
scrapped_twitch_api lib resources chat send_chat_announcement.ex
Raw

lib/resources/chat/send_chat_announcement.ex

defmodule TwitchApi.Chat.SendChatAnnouncement do
@moduledoc """
⛔ This module is autogenerated please do not modify manually.
## Example request from twitch api docs:
### descriptions:
Sends an announcement to the broadcaster’s chat room.
### requests:
curl -X POST 'https://api.twitch.tv/helix/chat/announcements?broadcaster_id=11111&moderator_id=44444'
-H'Authorization: Bearer kpvy3cjboyptmdkiacwr0c19hotn5s'
-H'Client-Id: hof5gwx0su6owfnys0nyan9c87zr6t'
-H'Content-Type: application/json'
-d'{"message":"Hello chat!","color":"purple"}'
## Example response from twitch api docs:
### descriptions:
### responses:
"""
alias TwitchApi.MyFinch
alias TwitchApi.ApiJson.Template.Method.Headers
@doc """
### Description:
NEW Sends an announcement to the broadcaster’s chat room.
### Required authentication:
### Required authorization:
Requires a user access token that includes the moderator:manage:announcements scope. The ID in the moderator_id query parameter must match the user ID in the access token.
"""
@typedoc """
The ID of the broadcaster that owns the chat room to send the announcement to.
"""
@type broadcaster_id :: %{required(:broadcaster_id) => String.t()}
@typedoc """
The ID of a user who has permission to moderate the broadcaster’s chat room. This ID must match the user ID in the OAuth token, which can be a moderator or the broadcaster.
"""
@type moderator_id :: %{required(:moderator_id) => String.t()}
# The color used to highlight the announcement. Possible case-sensitive values are => bluegreenorangepurpleprimary (default)If color is set to primary or is not set the channel’s accent color is used to highlight the announcement (see Profile Accent Color under profile settings Channel and Videos and Brand).
@typep body_params ::
%{
required(:color) => String.t(),
# The announcement to make in the broadcaster’s chat room. Announcements are limited to a maximum of 500 characters; announcements longer than 500 characters are truncated.
required(:message) => String.t()
}
| nil
@spec call(broadcaster_id | moderator_id, body_params) ::
{:ok, Finch.Response.t()} | {:error, Exception.t()}
def call(%{broadcaster_id: broadcaster_id}, body_params) do
MyFinch.request(
"POST",
"https://api.twitch.tv/helix/chat/announcements?broadcaster_id=#{broadcaster_id}",
Headers.config_headers(),
body_params
)
end
def call(%{moderator_id: moderator_id}, body_params) do
MyFinch.request(
"POST",
"https://api.twitch.tv/helix/chat/announcements?moderator_id=#{moderator_id}",
Headers.config_headers(),
body_params
)
end
end