Current section

Files

Jump to
scrapped_twitch_api lib resources moderation delete_chat_messages.ex
Raw

lib/resources/moderation/delete_chat_messages.ex

defmodule TwitchApi.Moderation.DeleteChatMessages do
@moduledoc """
⛔ This module is autogenerated please do not modify manually.
## Example request from twitch api docs:
### descriptions:
Removes all messages from the broadcaster’s chat room (doesn’t include the message_id query parameter).
Removes the specified message from the broadcaster’s chat room.
### requests:
curl -X DELETE 'https://api.twitch.tv/helix/moderation/chat?broadcaster_id=11111&moderator_id=44444&message_id=abc-123-def'\ -H'Authorization: Bearer f4otqljtpbpg24v41v9gechs4yvwy'
-H'Client-Id: t214nt8z1rdtbj69hyarjvh5mi6fh'
curl -X DELETE 'https://api.twitch.tv/helix/moderation/chat?broadcaster_id=11111&moderator_id=44444'
-H'Authorization: Bearer f4otqljtpbpg24v41v9gechs4yvwy'
-H'Client-Id: t214nt8z1rdtbj69hyarjvh5mi6fh'
## Example response from twitch api docs:
### descriptions:
### responses:
"""
alias TwitchApi.MyFinch
alias TwitchApi.ApiJson.Template.Method.Headers
@doc """
### Description:
NEW Removes a single chat message or all chat messages from the broadcaster’s chat room.
### Required authentication:
Requires a user access token that includes the
moderator:manage:chat_messages
scope. The ID in the
moderator_id
query parameter must match the user ID in the access token.
### Required authorization:
"""
@typedoc """
The ID of the broadcaster that owns the chat room to remove messages from.
"""
@type broadcaster_id :: %{required(:broadcaster_id) => String.t()}
@typedoc """
The ID of a user that has permission to moderate the broadcaster’s chat room. This ID must match the user ID in the OAuth token. If the broadcaster wants to remove messages themselves, set this parameter to the broadcaster’s ID, too.
"""
@type moderator_id :: %{required(:moderator_id) => String.t()}
@typedoc """
The ID of the message to remove. The id tag in the PRIVMSG contains the message’s ID (see PRIVMSG Tags). Restrictions:The message must have been created within the last 6 hours.The message must not belong to the broadcaster.The message must not belong to another moderator.If not specified, the request removes all messages in the broadcaster’s chat room.
"""
@type message_id :: %{required(:message_id) => String.t()}
@typedoc """
Map containing the user needed information for the fetch of the required user OAuth access token.
You will be able to choose from one way or the other for fetching previously OAuth access tokens.
:user_id field contains the user ID from twitch, e.g. 61425548 or "61425548"
:user_name field constains the user name from twitch, e.g. "hiimkamiyuzu"
"""
@type user_info :: %{user_id: integer | binary} | %{user_name: binary}
@spec call(broadcaster_id | moderator_id | message_id, user_info) ::
{:ok, Finch.Response.t()} | {:error, Exception.t()}
def call(%{broadcaster_id: broadcaster_id}, user_info) do
MyFinch.request(
"DELETE",
"https://api.twitch.tv/helix/moderation/chat?broadcaster_id=#{broadcaster_id}",
Headers.config_oauth_headers(user_info),
nil
)
end
def call(%{moderator_id: moderator_id}, user_info) do
MyFinch.request(
"DELETE",
"https://api.twitch.tv/helix/moderation/chat?moderator_id=#{moderator_id}",
Headers.config_oauth_headers(user_info),
nil
)
end
def call(%{message_id: message_id}, user_info) do
MyFinch.request(
"DELETE",
"https://api.twitch.tv/helix/moderation/chat?message_id=#{message_id}",
Headers.config_oauth_headers(user_info),
nil
)
end
end