Current section
Files
Jump to
Current section
Files
lib/resources/whispers/send_whisper.ex
defmodule TwitchApi.Whispers.SendWhisper do
@moduledoc """
⛔ This module is autogenerated please do not modify manually.
## Example request from twitch api docs:
### descriptions:
Send the user a whisper message.
### requests:
curl -X POST 'https://api.twitch.tv/helix/whispers?from_user_id=123&to_user_id=456'
-H'Authorization: Bearer kpvy3cjboyptmdkiacwr0c19hotn5s'
-H'Client-Id: hof5gwx0su6owfnys0nyan9c87zr6t'
-H'Content-Type: application/json'
-d'{"message":"hello"}'
## Example response from twitch api docs:
### descriptions:
### responses:
"""
alias TwitchApi.MyFinch
alias TwitchApi.ApiJson.Template.Method.Headers
@doc """
### Description:
NEW Sends a whisper message to the specified user.
### Required authentication:
### Required authorization:
Requires a user access token that includes the user:manage:whispers scope. The ID in the from_user_id query parameter must match the user ID in the access token.
"""
@typedoc """
The ID of the user sending the whisper. This user must have a verified phone number.
"""
@type from_user_id :: %{required(:from_user_id) => String.t()}
@typedoc """
The ID of the user to receive the whisper.
"""
@type to_user_id :: %{required(:to_user_id) => String.t()}
# The whisper message to send. The message must not be empty.The maximum message lengths are => 500 characters if the user you're sending the message to hasn't whispered you before.10000 characters if the user you're sending the message to has whispered you before.Messages that exceed the maximum length are truncated.
@typep body_params :: %{required(:message) => String.t()} | nil
@spec call(from_user_id | to_user_id, body_params) ::
{:ok, Finch.Response.t()} | {:error, Exception.t()}
def call(%{from_user_id: from_user_id}, body_params) do
MyFinch.request(
"POST",
"https://api.twitch.tv/helix/whispers?from_user_id=#{from_user_id}",
Headers.config_headers(),
body_params
)
end
def call(%{to_user_id: to_user_id}, body_params) do
MyFinch.request(
"POST",
"https://api.twitch.tv/helix/whispers?to_user_id=#{to_user_id}",
Headers.config_headers(),
body_params
)
end
end