-- | Interaction endpoints
module Calamity.HTTP.Interaction (
  InteractionRequest (..),
  InteractionCallbackMessageOptions (..),
  InteractionCallbackAutocomplete (..),
  InteractionCallbackAutocompleteChoice (..),
  InteractionCallbackModal (..),
) where

import Calamity.HTTP.Channel (AllowedMentions, CreateMessageAttachment (..))
import Calamity.HTTP.Internal.Request
import Calamity.HTTP.Internal.Route
import Calamity.Internal.AesonThings
import Calamity.Types.Model.Channel.Component (Component, CustomID)
import Calamity.Types.Model.Channel.Embed (Embed)
import Calamity.Types.Model.Channel.Message (Message)
import Calamity.Types.Model.Interaction
import Calamity.Types.Snowflake
import Control.Lens hiding ((.=))
import Data.Aeson
import Data.Bits (shiftL, (.|.))
import Data.Default.Class
import qualified Data.HashMap.Strict as H
import Data.Maybe (fromMaybe)
import Data.Monoid (First (First, getFirst))
import Data.Text (Text)
import qualified Data.Text as T
import GHC.Generics
import Network.HTTP.Client.MultipartFormData
import Network.HTTP.Req
import Network.Mime
import PyF
import TextShow
import qualified TextShow.Generic as TSG

data InteractionCallback = InteractionCallback
  { InteractionCallback -> InteractionCallbackType
type_ :: InteractionCallbackType
  , InteractionCallback -> Maybe Value
data_ :: Maybe Value
  }
  deriving (Int -> InteractionCallback -> ShowS
[InteractionCallback] -> ShowS
InteractionCallback -> String
(Int -> InteractionCallback -> ShowS)
-> (InteractionCallback -> String)
-> ([InteractionCallback] -> ShowS)
-> Show InteractionCallback
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [InteractionCallback] -> ShowS
$cshowList :: [InteractionCallback] -> ShowS
show :: InteractionCallback -> String
$cshow :: InteractionCallback -> String
showsPrec :: Int -> InteractionCallback -> ShowS
$cshowsPrec :: Int -> InteractionCallback -> ShowS
Show, (forall x. InteractionCallback -> Rep InteractionCallback x)
-> (forall x. Rep InteractionCallback x -> InteractionCallback)
-> Generic InteractionCallback
forall x. Rep InteractionCallback x -> InteractionCallback
forall x. InteractionCallback -> Rep InteractionCallback x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep InteractionCallback x -> InteractionCallback
$cfrom :: forall x. InteractionCallback -> Rep InteractionCallback x
Generic)
  deriving ([InteractionCallback] -> Encoding
[InteractionCallback] -> Value
InteractionCallback -> Encoding
InteractionCallback -> Value
(InteractionCallback -> Value)
-> (InteractionCallback -> Encoding)
-> ([InteractionCallback] -> Value)
-> ([InteractionCallback] -> Encoding)
-> ToJSON InteractionCallback
forall a.
(a -> Value)
-> (a -> Encoding)
-> ([a] -> Value)
-> ([a] -> Encoding)
-> ToJSON a
toEncodingList :: [InteractionCallback] -> Encoding
$ctoEncodingList :: [InteractionCallback] -> Encoding
toJSONList :: [InteractionCallback] -> Value
$ctoJSONList :: [InteractionCallback] -> Value
toEncoding :: InteractionCallback -> Encoding
$ctoEncoding :: InteractionCallback -> Encoding
toJSON :: InteractionCallback -> Value
$ctoJSON :: InteractionCallback -> Value
ToJSON) via CalamityJSON InteractionCallback

data InteractionCallbackMessageOptions = InteractionCallbackMessageOptions
  { InteractionCallbackMessageOptions -> Maybe Bool
tts :: Maybe Bool
  , InteractionCallbackMessageOptions -> Maybe Text
content :: Maybe Text
  , InteractionCallbackMessageOptions -> Maybe [Embed]
embeds :: Maybe [Embed]
  , InteractionCallbackMessageOptions -> Maybe AllowedMentions
allowedMentions :: Maybe AllowedMentions
  , InteractionCallbackMessageOptions -> Maybe Bool
ephemeral :: Maybe Bool
  , InteractionCallbackMessageOptions -> Maybe Bool
suppressEmbeds :: Maybe Bool
  , InteractionCallbackMessageOptions -> Maybe [Component]
components :: Maybe [Component]
  , InteractionCallbackMessageOptions
-> Maybe [CreateMessageAttachment]
attachments :: Maybe [CreateMessageAttachment]
  }
  deriving (Int -> InteractionCallbackMessageOptions -> ShowS
[InteractionCallbackMessageOptions] -> ShowS
InteractionCallbackMessageOptions -> String
(Int -> InteractionCallbackMessageOptions -> ShowS)
-> (InteractionCallbackMessageOptions -> String)
-> ([InteractionCallbackMessageOptions] -> ShowS)
-> Show InteractionCallbackMessageOptions
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [InteractionCallbackMessageOptions] -> ShowS
$cshowList :: [InteractionCallbackMessageOptions] -> ShowS
show :: InteractionCallbackMessageOptions -> String
$cshow :: InteractionCallbackMessageOptions -> String
showsPrec :: Int -> InteractionCallbackMessageOptions -> ShowS
$cshowsPrec :: Int -> InteractionCallbackMessageOptions -> ShowS
Show, (forall x.
 InteractionCallbackMessageOptions
 -> Rep InteractionCallbackMessageOptions x)
-> (forall x.
    Rep InteractionCallbackMessageOptions x
    -> InteractionCallbackMessageOptions)
-> Generic InteractionCallbackMessageOptions
forall x.
Rep InteractionCallbackMessageOptions x
-> InteractionCallbackMessageOptions
forall x.
InteractionCallbackMessageOptions
-> Rep InteractionCallbackMessageOptions x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep InteractionCallbackMessageOptions x
-> InteractionCallbackMessageOptions
$cfrom :: forall x.
InteractionCallbackMessageOptions
-> Rep InteractionCallbackMessageOptions x
Generic, InteractionCallbackMessageOptions
InteractionCallbackMessageOptions
-> Default InteractionCallbackMessageOptions
forall a. a -> Default a
def :: InteractionCallbackMessageOptions
$cdef :: InteractionCallbackMessageOptions
Default)

data CreateMessageAttachmentJson = CreateMessageAttachmentJson
  { CreateMessageAttachmentJson -> Int
id :: Int
  , CreateMessageAttachmentJson -> Text
filename :: Text
  , CreateMessageAttachmentJson -> Maybe Text
description :: Maybe Text
  }
  deriving (Int -> CreateMessageAttachmentJson -> ShowS
[CreateMessageAttachmentJson] -> ShowS
CreateMessageAttachmentJson -> String
(Int -> CreateMessageAttachmentJson -> ShowS)
-> (CreateMessageAttachmentJson -> String)
-> ([CreateMessageAttachmentJson] -> ShowS)
-> Show CreateMessageAttachmentJson
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateMessageAttachmentJson] -> ShowS
$cshowList :: [CreateMessageAttachmentJson] -> ShowS
show :: CreateMessageAttachmentJson -> String
$cshow :: CreateMessageAttachmentJson -> String
showsPrec :: Int -> CreateMessageAttachmentJson -> ShowS
$cshowsPrec :: Int -> CreateMessageAttachmentJson -> ShowS
Show, (forall x.
 CreateMessageAttachmentJson -> Rep CreateMessageAttachmentJson x)
-> (forall x.
    Rep CreateMessageAttachmentJson x -> CreateMessageAttachmentJson)
-> Generic CreateMessageAttachmentJson
forall x.
Rep CreateMessageAttachmentJson x -> CreateMessageAttachmentJson
forall x.
CreateMessageAttachmentJson -> Rep CreateMessageAttachmentJson x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateMessageAttachmentJson x -> CreateMessageAttachmentJson
$cfrom :: forall x.
CreateMessageAttachmentJson -> Rep CreateMessageAttachmentJson x
Generic)
  deriving ([CreateMessageAttachmentJson] -> Encoding
[CreateMessageAttachmentJson] -> Value
CreateMessageAttachmentJson -> Encoding
CreateMessageAttachmentJson -> Value
(CreateMessageAttachmentJson -> Value)
-> (CreateMessageAttachmentJson -> Encoding)
-> ([CreateMessageAttachmentJson] -> Value)
-> ([CreateMessageAttachmentJson] -> Encoding)
-> ToJSON CreateMessageAttachmentJson
forall a.
(a -> Value)
-> (a -> Encoding)
-> ([a] -> Value)
-> ([a] -> Encoding)
-> ToJSON a
toEncodingList :: [CreateMessageAttachmentJson] -> Encoding
$ctoEncodingList :: [CreateMessageAttachmentJson] -> Encoding
toJSONList :: [CreateMessageAttachmentJson] -> Value
$ctoJSONList :: [CreateMessageAttachmentJson] -> Value
toEncoding :: CreateMessageAttachmentJson -> Encoding
$ctoEncoding :: CreateMessageAttachmentJson -> Encoding
toJSON :: CreateMessageAttachmentJson -> Value
$ctoJSON :: CreateMessageAttachmentJson -> Value
ToJSON) via CalamityJSON CreateMessageAttachmentJson

data CreateResponseMessageJson = CreateResponseMessageJson
  { CreateResponseMessageJson -> Maybe Bool
tts :: Maybe Bool
  , CreateResponseMessageJson -> Maybe Text
content :: Maybe Text
  , CreateResponseMessageJson -> Maybe [Embed]
embeds :: Maybe [Embed]
  , CreateResponseMessageJson -> Maybe AllowedMentions
allowedMentions :: Maybe AllowedMentions
  , CreateResponseMessageJson -> Maybe Int
flags :: Maybe Int
  , CreateResponseMessageJson -> Maybe [Component]
components :: Maybe [Component]
  , CreateResponseMessageJson -> Maybe [CreateMessageAttachmentJson]
attachments :: Maybe [CreateMessageAttachmentJson]
  }
  deriving (Int -> CreateResponseMessageJson -> ShowS
[CreateResponseMessageJson] -> ShowS
CreateResponseMessageJson -> String
(Int -> CreateResponseMessageJson -> ShowS)
-> (CreateResponseMessageJson -> String)
-> ([CreateResponseMessageJson] -> ShowS)
-> Show CreateResponseMessageJson
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateResponseMessageJson] -> ShowS
$cshowList :: [CreateResponseMessageJson] -> ShowS
show :: CreateResponseMessageJson -> String
$cshow :: CreateResponseMessageJson -> String
showsPrec :: Int -> CreateResponseMessageJson -> ShowS
$cshowsPrec :: Int -> CreateResponseMessageJson -> ShowS
Show, (forall x.
 CreateResponseMessageJson -> Rep CreateResponseMessageJson x)
-> (forall x.
    Rep CreateResponseMessageJson x -> CreateResponseMessageJson)
-> Generic CreateResponseMessageJson
forall x.
Rep CreateResponseMessageJson x -> CreateResponseMessageJson
forall x.
CreateResponseMessageJson -> Rep CreateResponseMessageJson x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateResponseMessageJson x -> CreateResponseMessageJson
$cfrom :: forall x.
CreateResponseMessageJson -> Rep CreateResponseMessageJson x
Generic)
  deriving ([CreateResponseMessageJson] -> Encoding
[CreateResponseMessageJson] -> Value
CreateResponseMessageJson -> Encoding
CreateResponseMessageJson -> Value
(CreateResponseMessageJson -> Value)
-> (CreateResponseMessageJson -> Encoding)
-> ([CreateResponseMessageJson] -> Value)
-> ([CreateResponseMessageJson] -> Encoding)
-> ToJSON CreateResponseMessageJson
forall a.
(a -> Value)
-> (a -> Encoding)
-> ([a] -> Value)
-> ([a] -> Encoding)
-> ToJSON a
toEncodingList :: [CreateResponseMessageJson] -> Encoding
$ctoEncodingList :: [CreateResponseMessageJson] -> Encoding
toJSONList :: [CreateResponseMessageJson] -> Value
$ctoJSONList :: [CreateResponseMessageJson] -> Value
toEncoding :: CreateResponseMessageJson -> Encoding
$ctoEncoding :: CreateResponseMessageJson -> Encoding
toJSON :: CreateResponseMessageJson -> Value
$ctoJSON :: CreateResponseMessageJson -> Value
ToJSON) via CalamityJSON CreateResponseMessageJson

newtype InteractionCallbackAutocomplete = InteractionCallbackAutocomplete
  { InteractionCallbackAutocomplete
-> [InteractionCallbackAutocompleteChoice]
choices :: [InteractionCallbackAutocompleteChoice]
  }
  deriving stock (Int -> InteractionCallbackAutocomplete -> ShowS
[InteractionCallbackAutocomplete] -> ShowS
InteractionCallbackAutocomplete -> String
(Int -> InteractionCallbackAutocomplete -> ShowS)
-> (InteractionCallbackAutocomplete -> String)
-> ([InteractionCallbackAutocomplete] -> ShowS)
-> Show InteractionCallbackAutocomplete
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [InteractionCallbackAutocomplete] -> ShowS
$cshowList :: [InteractionCallbackAutocomplete] -> ShowS
show :: InteractionCallbackAutocomplete -> String
$cshow :: InteractionCallbackAutocomplete -> String
showsPrec :: Int -> InteractionCallbackAutocomplete -> ShowS
$cshowsPrec :: Int -> InteractionCallbackAutocomplete -> ShowS
Show, (forall x.
 InteractionCallbackAutocomplete
 -> Rep InteractionCallbackAutocomplete x)
-> (forall x.
    Rep InteractionCallbackAutocomplete x
    -> InteractionCallbackAutocomplete)
-> Generic InteractionCallbackAutocomplete
forall x.
Rep InteractionCallbackAutocomplete x
-> InteractionCallbackAutocomplete
forall x.
InteractionCallbackAutocomplete
-> Rep InteractionCallbackAutocomplete x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep InteractionCallbackAutocomplete x
-> InteractionCallbackAutocomplete
$cfrom :: forall x.
InteractionCallbackAutocomplete
-> Rep InteractionCallbackAutocomplete x
Generic)
  deriving ([InteractionCallbackAutocomplete] -> Encoding
[InteractionCallbackAutocomplete] -> Value
InteractionCallbackAutocomplete -> Encoding
InteractionCallbackAutocomplete -> Value
(InteractionCallbackAutocomplete -> Value)
-> (InteractionCallbackAutocomplete -> Encoding)
-> ([InteractionCallbackAutocomplete] -> Value)
-> ([InteractionCallbackAutocomplete] -> Encoding)
-> ToJSON InteractionCallbackAutocomplete
forall a.
(a -> Value)
-> (a -> Encoding)
-> ([a] -> Value)
-> ([a] -> Encoding)
-> ToJSON a
toEncodingList :: [InteractionCallbackAutocomplete] -> Encoding
$ctoEncodingList :: [InteractionCallbackAutocomplete] -> Encoding
toJSONList :: [InteractionCallbackAutocomplete] -> Value
$ctoJSONList :: [InteractionCallbackAutocomplete] -> Value
toEncoding :: InteractionCallbackAutocomplete -> Encoding
$ctoEncoding :: InteractionCallbackAutocomplete -> Encoding
toJSON :: InteractionCallbackAutocomplete -> Value
$ctoJSON :: InteractionCallbackAutocomplete -> Value
ToJSON) via CalamityJSON InteractionCallbackAutocomplete

data InteractionCallbackAutocompleteChoice = InteractionCallbackAutocompleteChoice
  { InteractionCallbackAutocompleteChoice -> Text
name :: Text
  , InteractionCallbackAutocompleteChoice -> HashMap Text Text
nameLocalizations :: H.HashMap Text Text
  , -- | Either text or numeric
    InteractionCallbackAutocompleteChoice -> Value
value :: Value
  }
  deriving stock (Int -> InteractionCallbackAutocompleteChoice -> ShowS
[InteractionCallbackAutocompleteChoice] -> ShowS
InteractionCallbackAutocompleteChoice -> String
(Int -> InteractionCallbackAutocompleteChoice -> ShowS)
-> (InteractionCallbackAutocompleteChoice -> String)
-> ([InteractionCallbackAutocompleteChoice] -> ShowS)
-> Show InteractionCallbackAutocompleteChoice
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [InteractionCallbackAutocompleteChoice] -> ShowS
$cshowList :: [InteractionCallbackAutocompleteChoice] -> ShowS
show :: InteractionCallbackAutocompleteChoice -> String
$cshow :: InteractionCallbackAutocompleteChoice -> String
showsPrec :: Int -> InteractionCallbackAutocompleteChoice -> ShowS
$cshowsPrec :: Int -> InteractionCallbackAutocompleteChoice -> ShowS
Show, (forall x.
 InteractionCallbackAutocompleteChoice
 -> Rep InteractionCallbackAutocompleteChoice x)
-> (forall x.
    Rep InteractionCallbackAutocompleteChoice x
    -> InteractionCallbackAutocompleteChoice)
-> Generic InteractionCallbackAutocompleteChoice
forall x.
Rep InteractionCallbackAutocompleteChoice x
-> InteractionCallbackAutocompleteChoice
forall x.
InteractionCallbackAutocompleteChoice
-> Rep InteractionCallbackAutocompleteChoice x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep InteractionCallbackAutocompleteChoice x
-> InteractionCallbackAutocompleteChoice
$cfrom :: forall x.
InteractionCallbackAutocompleteChoice
-> Rep InteractionCallbackAutocompleteChoice x
Generic)
  deriving ([InteractionCallbackAutocompleteChoice] -> Encoding
[InteractionCallbackAutocompleteChoice] -> Value
InteractionCallbackAutocompleteChoice -> Encoding
InteractionCallbackAutocompleteChoice -> Value
(InteractionCallbackAutocompleteChoice -> Value)
-> (InteractionCallbackAutocompleteChoice -> Encoding)
-> ([InteractionCallbackAutocompleteChoice] -> Value)
-> ([InteractionCallbackAutocompleteChoice] -> Encoding)
-> ToJSON InteractionCallbackAutocompleteChoice
forall a.
(a -> Value)
-> (a -> Encoding)
-> ([a] -> Value)
-> ([a] -> Encoding)
-> ToJSON a
toEncodingList :: [InteractionCallbackAutocompleteChoice] -> Encoding
$ctoEncodingList :: [InteractionCallbackAutocompleteChoice] -> Encoding
toJSONList :: [InteractionCallbackAutocompleteChoice] -> Value
$ctoJSONList :: [InteractionCallbackAutocompleteChoice] -> Value
toEncoding :: InteractionCallbackAutocompleteChoice -> Encoding
$ctoEncoding :: InteractionCallbackAutocompleteChoice -> Encoding
toJSON :: InteractionCallbackAutocompleteChoice -> Value
$ctoJSON :: InteractionCallbackAutocompleteChoice -> Value
ToJSON) via CalamityJSON InteractionCallbackAutocompleteChoice

data InteractionCallbackModal = InteractionCallbackModal
  { InteractionCallbackModal -> CustomID
customID :: CustomID
  , InteractionCallbackModal -> Text
title :: Text
  , InteractionCallbackModal -> [Component]
components :: [Component]
  }
  deriving stock (Int -> InteractionCallbackModal -> ShowS
[InteractionCallbackModal] -> ShowS
InteractionCallbackModal -> String
(Int -> InteractionCallbackModal -> ShowS)
-> (InteractionCallbackModal -> String)
-> ([InteractionCallbackModal] -> ShowS)
-> Show InteractionCallbackModal
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [InteractionCallbackModal] -> ShowS
$cshowList :: [InteractionCallbackModal] -> ShowS
show :: InteractionCallbackModal -> String
$cshow :: InteractionCallbackModal -> String
showsPrec :: Int -> InteractionCallbackModal -> ShowS
$cshowsPrec :: Int -> InteractionCallbackModal -> ShowS
Show, (forall x.
 InteractionCallbackModal -> Rep InteractionCallbackModal x)
-> (forall x.
    Rep InteractionCallbackModal x -> InteractionCallbackModal)
-> Generic InteractionCallbackModal
forall x.
Rep InteractionCallbackModal x -> InteractionCallbackModal
forall x.
InteractionCallbackModal -> Rep InteractionCallbackModal x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep InteractionCallbackModal x -> InteractionCallbackModal
$cfrom :: forall x.
InteractionCallbackModal -> Rep InteractionCallbackModal x
Generic)
  deriving ([InteractionCallbackModal] -> Encoding
[InteractionCallbackModal] -> Value
InteractionCallbackModal -> Encoding
InteractionCallbackModal -> Value
(InteractionCallbackModal -> Value)
-> (InteractionCallbackModal -> Encoding)
-> ([InteractionCallbackModal] -> Value)
-> ([InteractionCallbackModal] -> Encoding)
-> ToJSON InteractionCallbackModal
forall a.
(a -> Value)
-> (a -> Encoding)
-> ([a] -> Value)
-> ([a] -> Encoding)
-> ToJSON a
toEncodingList :: [InteractionCallbackModal] -> Encoding
$ctoEncodingList :: [InteractionCallbackModal] -> Encoding
toJSONList :: [InteractionCallbackModal] -> Value
$ctoJSONList :: [InteractionCallbackModal] -> Value
toEncoding :: InteractionCallbackModal -> Encoding
$ctoEncoding :: InteractionCallbackModal -> Encoding
toJSON :: InteractionCallbackModal -> Value
$ctoJSON :: InteractionCallbackModal -> Value
ToJSON) via CalamityJSON InteractionCallbackModal

data InteractionCallbackType
  = PongType
  | ChannelMessageWithSourceType
  | DeferredChannelMessageWithSourceType
  | DeferredUpdateMessageType
  | UpdateMessageType
  | ApplicationCommandAutocompleteResultType
  | ModalType
  deriving (Int -> InteractionCallbackType -> ShowS
[InteractionCallbackType] -> ShowS
InteractionCallbackType -> String
(Int -> InteractionCallbackType -> ShowS)
-> (InteractionCallbackType -> String)
-> ([InteractionCallbackType] -> ShowS)
-> Show InteractionCallbackType
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [InteractionCallbackType] -> ShowS
$cshowList :: [InteractionCallbackType] -> ShowS
show :: InteractionCallbackType -> String
$cshow :: InteractionCallbackType -> String
showsPrec :: Int -> InteractionCallbackType -> ShowS
$cshowsPrec :: Int -> InteractionCallbackType -> ShowS
Show, (forall x.
 InteractionCallbackType -> Rep InteractionCallbackType x)
-> (forall x.
    Rep InteractionCallbackType x -> InteractionCallbackType)
-> Generic InteractionCallbackType
forall x. Rep InteractionCallbackType x -> InteractionCallbackType
forall x. InteractionCallbackType -> Rep InteractionCallbackType x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep InteractionCallbackType x -> InteractionCallbackType
$cfrom :: forall x. InteractionCallbackType -> Rep InteractionCallbackType x
Generic)
  deriving (Int -> InteractionCallbackType -> Builder
Int -> InteractionCallbackType -> Text
Int -> InteractionCallbackType -> Text
[InteractionCallbackType] -> Builder
[InteractionCallbackType] -> Text
[InteractionCallbackType] -> Text
InteractionCallbackType -> Builder
InteractionCallbackType -> Text
InteractionCallbackType -> Text
(Int -> InteractionCallbackType -> Builder)
-> (InteractionCallbackType -> Builder)
-> ([InteractionCallbackType] -> Builder)
-> (Int -> InteractionCallbackType -> Text)
-> (InteractionCallbackType -> Text)
-> ([InteractionCallbackType] -> Text)
-> (Int -> InteractionCallbackType -> Text)
-> (InteractionCallbackType -> Text)
-> ([InteractionCallbackType] -> Text)
-> TextShow InteractionCallbackType
forall a.
(Int -> a -> Builder)
-> (a -> Builder)
-> ([a] -> Builder)
-> (Int -> a -> Text)
-> (a -> Text)
-> ([a] -> Text)
-> (Int -> a -> Text)
-> (a -> Text)
-> ([a] -> Text)
-> TextShow a
showtlList :: [InteractionCallbackType] -> Text
$cshowtlList :: [InteractionCallbackType] -> Text
showtl :: InteractionCallbackType -> Text
$cshowtl :: InteractionCallbackType -> Text
showtlPrec :: Int -> InteractionCallbackType -> Text
$cshowtlPrec :: Int -> InteractionCallbackType -> Text
showtList :: [InteractionCallbackType] -> Text
$cshowtList :: [InteractionCallbackType] -> Text
showt :: InteractionCallbackType -> Text
$cshowt :: InteractionCallbackType -> Text
showtPrec :: Int -> InteractionCallbackType -> Text
$cshowtPrec :: Int -> InteractionCallbackType -> Text
showbList :: [InteractionCallbackType] -> Builder
$cshowbList :: [InteractionCallbackType] -> Builder
showb :: InteractionCallbackType -> Builder
$cshowb :: InteractionCallbackType -> Builder
showbPrec :: Int -> InteractionCallbackType -> Builder
$cshowbPrec :: Int -> InteractionCallbackType -> Builder
TextShow) via TSG.FromGeneric InteractionCallbackType

instance ToJSON InteractionCallbackType where
  toEncoding :: InteractionCallbackType -> Encoding
toEncoding InteractionCallbackType
ty = ToJSON Int => Int -> Encoding
forall a. ToJSON a => a -> Encoding
toEncoding @Int (Int -> Encoding) -> Int -> Encoding
forall a b. (a -> b) -> a -> b
$ case InteractionCallbackType
ty of
    InteractionCallbackType
PongType -> Int
1
    InteractionCallbackType
ChannelMessageWithSourceType -> Int
4
    InteractionCallbackType
DeferredChannelMessageWithSourceType -> Int
5
    InteractionCallbackType
DeferredUpdateMessageType -> Int
6
    InteractionCallbackType
UpdateMessageType -> Int
7
    InteractionCallbackType
ApplicationCommandAutocompleteResultType -> Int
8
    InteractionCallbackType
ModalType -> Int
9

data InteractionRequest a where
  CreateResponseMessage ::
    (HasID Interaction i) =>
    i ->
    InteractionToken ->
    InteractionCallbackMessageOptions ->
    InteractionRequest ()
  -- | Ack an interaction and defer the response
  --
  -- This route triggers the 'thinking' message
  CreateResponseDefer ::
    (HasID Interaction i) =>
    i ->
    InteractionToken ->
    -- | Ephemeral
    Bool ->
    InteractionRequest ()
  -- | Ack an interaction and defer the response
  --
  -- This route is only usable by component interactions, and doesn't trigger a
  -- 'thinking' message
  CreateResponseDeferComponent ::
    (HasID Interaction i) =>
    i ->
    InteractionToken ->
    InteractionRequest ()
  CreateResponseUpdate ::
    (HasID Interaction i) =>
    i ->
    InteractionToken ->
    InteractionCallbackMessageOptions ->
    InteractionRequest ()
  CreateResponseAutocomplete ::
    (HasID Interaction i) =>
    i ->
    InteractionToken ->
    InteractionCallbackAutocomplete ->
    InteractionRequest ()
  CreateResponseModal ::
    (HasID Interaction i) =>
    i ->
    InteractionToken ->
    InteractionCallbackModal ->
    InteractionRequest ()
  GetOriginalInteractionResponse ::
    (HasID Application i) =>
    i ->
    InteractionToken ->
    InteractionRequest Message
  EditOriginalInteractionResponse ::
    (HasID Application i) =>
    i ->
    InteractionToken ->
    InteractionCallbackMessageOptions ->
    InteractionRequest Message
  DeleteOriginalInteractionResponse ::
    (HasID Application i) =>
    i ->
    InteractionToken ->
    InteractionRequest ()
  CreateFollowupMessage ::
    (HasID Application i) =>
    i ->
    InteractionToken ->
    InteractionCallbackMessageOptions ->
    InteractionRequest ()
  GetFollowupMessage ::
    (HasID Application i, HasID Message m) =>
    i ->
    m ->
    InteractionToken ->
    InteractionRequest Message
  EditFollowupMessage ::
    (HasID Application i, HasID Message m) =>
    i ->
    m ->
    InteractionToken ->
    InteractionCallbackMessageOptions ->
    InteractionRequest ()
  DeleteFollowupMessage ::
    (HasID Application i, HasID Message m) =>
    i ->
    m ->
    InteractionToken ->
    InteractionRequest ()

baseRoute :: Snowflake Application -> InteractionToken -> RouteBuilder _
baseRoute :: Snowflake Application
-> InteractionToken
-> RouteBuilder
     '[ '( 'IDRequirement Application, 'Satisfied),
        '( 'IDRequirement Application, 'Required)]
baseRoute Snowflake Application
id (InteractionToken Text
token) =
  RouteBuilder '[]
mkRouteBuilder RouteBuilder '[] -> S -> ConsRes S '[]
forall a (reqs :: [(RequirementType, RouteRequirement)]).
RouteFragmentable a reqs =>
RouteBuilder reqs -> a -> ConsRes a reqs
// Text -> S
S Text
"webhooks" RouteBuilder '[] -> ID Application -> ConsRes (ID Application) '[]
forall a (reqs :: [(RequirementType, RouteRequirement)]).
RouteFragmentable a reqs =>
RouteBuilder reqs -> a -> ConsRes a reqs
// ID Application
forall k (a :: k). ID a
ID @Application RouteBuilder '[ '( 'IDRequirement Application, 'Required)]
-> S -> ConsRes S '[ '( 'IDRequirement Application, 'Required)]
forall a (reqs :: [(RequirementType, RouteRequirement)]).
RouteFragmentable a reqs =>
RouteBuilder reqs -> a -> ConsRes a reqs
// Text -> S
S Text
token
    RouteBuilder '[ '( 'IDRequirement Application, 'Required)]
-> (RouteBuilder '[ '( 'IDRequirement Application, 'Required)]
    -> RouteBuilder
         '[ '( 'IDRequirement Application, 'Satisfied),
            '( 'IDRequirement Application, 'Required)])
-> RouteBuilder
     '[ '( 'IDRequirement Application, 'Satisfied),
        '( 'IDRequirement Application, 'Required)]
forall a b. a -> (a -> b) -> b
& Snowflake Application
-> RouteBuilder '[ '( 'IDRequirement Application, 'Required)]
-> RouteBuilder
     '[ '( 'IDRequirement Application, 'Satisfied),
        '( 'IDRequirement Application, 'Required)]
forall t (reqs :: [(RequirementType, RouteRequirement)]).
Typeable t =>
Snowflake t
-> RouteBuilder reqs
-> RouteBuilder ('( 'IDRequirement t, 'Satisfied) : reqs)
giveID Snowflake Application
id

foo :: Maybe a -> Maybe a -> (a -> a -> a) -> Maybe a
foo :: Maybe a -> Maybe a -> (a -> a -> a) -> Maybe a
foo (Just a
x) (Just a
y) a -> a -> a
f = a -> Maybe a
forall a. a -> Maybe a
Just (a -> a -> a
f a
x a
y)
foo Maybe a
x Maybe a
y a -> a -> a
_ = First a -> Maybe a
forall a. First a -> Maybe a
getFirst (First a -> Maybe a) -> First a -> Maybe a
forall a b. (a -> b) -> a -> b
$ Maybe a -> First a
forall a. Maybe a -> First a
First Maybe a
x First a -> First a -> First a
forall a. Semigroup a => a -> a -> a
<> Maybe a -> First a
forall a. Maybe a -> First a
First Maybe a
y

instance Request (InteractionRequest a) where
  type Result (InteractionRequest a) = a

  route :: InteractionRequest a -> Route
route (CreateResponseDefer (forall a. HasID Interaction a => a -> Snowflake Interaction
forall b a. HasID b a => a -> Snowflake b
getID @Interaction -> Snowflake Interaction
iid) (InteractionToken Text
token) Bool
_) =
    RouteBuilder '[]
mkRouteBuilder RouteBuilder '[] -> S -> ConsRes S '[]
forall a (reqs :: [(RequirementType, RouteRequirement)]).
RouteFragmentable a reqs =>
RouteBuilder reqs -> a -> ConsRes a reqs
// Text -> S
S Text
"interactions" RouteBuilder '[] -> ID Interaction -> ConsRes (ID Interaction) '[]
forall a (reqs :: [(RequirementType, RouteRequirement)]).
RouteFragmentable a reqs =>
RouteBuilder reqs -> a -> ConsRes a reqs
// ID Interaction
forall k (a :: k). ID a
ID @Interaction RouteBuilder '[ '( 'IDRequirement Interaction, 'Required)]
-> S -> ConsRes S '[ '( 'IDRequirement Interaction, 'Required)]
forall a (reqs :: [(RequirementType, RouteRequirement)]).
RouteFragmentable a reqs =>
RouteBuilder reqs -> a -> ConsRes a reqs
// Text -> S
S Text
token RouteBuilder '[ '( 'IDRequirement Interaction, 'Required)]
-> S -> ConsRes S '[ '( 'IDRequirement Interaction, 'Required)]
forall a (reqs :: [(RequirementType, RouteRequirement)]).
RouteFragmentable a reqs =>
RouteBuilder reqs -> a -> ConsRes a reqs
// Text -> S
S Text
"callback"
      RouteBuilder '[ '( 'IDRequirement Interaction, 'Required)]
-> (RouteBuilder '[ '( 'IDRequirement Interaction, 'Required)]
    -> RouteBuilder
         '[ '( 'IDRequirement Interaction, 'Satisfied),
            '( 'IDRequirement Interaction, 'Required)])
-> RouteBuilder
     '[ '( 'IDRequirement Interaction, 'Satisfied),
        '( 'IDRequirement Interaction, 'Required)]
forall a b. a -> (a -> b) -> b
& Snowflake Interaction
-> RouteBuilder '[ '( 'IDRequirement Interaction, 'Required)]
-> RouteBuilder
     '[ '( 'IDRequirement Interaction, 'Satisfied),
        '( 'IDRequirement Interaction, 'Required)]
forall t (reqs :: [(RequirementType, RouteRequirement)]).
Typeable t =>
Snowflake t
-> RouteBuilder reqs
-> RouteBuilder ('( 'IDRequirement t, 'Satisfied) : reqs)
giveID Snowflake Interaction
iid
      RouteBuilder
  '[ '( 'IDRequirement Interaction, 'Satisfied),
     '( 'IDRequirement Interaction, 'Required)]
-> (RouteBuilder
      '[ '( 'IDRequirement Interaction, 'Satisfied),
         '( 'IDRequirement Interaction, 'Required)]
    -> Route)
-> Route
forall a b. a -> (a -> b) -> b
& RouteBuilder
  '[ '( 'IDRequirement Interaction, 'Satisfied),
     '( 'IDRequirement Interaction, 'Required)]
-> Route
forall (reqs :: [(RequirementType, RouteRequirement)]).
EnsureFulfilled reqs =>
RouteBuilder reqs -> Route
buildRoute
  route (CreateResponseDeferComponent (forall a. HasID Interaction a => a -> Snowflake Interaction
forall b a. HasID b a => a -> Snowflake b
getID @Interaction -> Snowflake Interaction
iid) (InteractionToken Text
token)) =
    RouteBuilder '[]
mkRouteBuilder RouteBuilder '[] -> S -> ConsRes S '[]
forall a (reqs :: [(RequirementType, RouteRequirement)]).
RouteFragmentable a reqs =>
RouteBuilder reqs -> a -> ConsRes a reqs
// Text -> S
S Text
"interactions" RouteBuilder '[] -> ID Interaction -> ConsRes (ID Interaction) '[]
forall a (reqs :: [(RequirementType, RouteRequirement)]).
RouteFragmentable a reqs =>
RouteBuilder reqs -> a -> ConsRes a reqs
// ID Interaction
forall k (a :: k). ID a
ID @Interaction RouteBuilder '[ '( 'IDRequirement Interaction, 'Required)]
-> S -> ConsRes S '[ '( 'IDRequirement Interaction, 'Required)]
forall a (reqs :: [(RequirementType, RouteRequirement)]).
RouteFragmentable a reqs =>
RouteBuilder reqs -> a -> ConsRes a reqs
// Text -> S
S Text
token RouteBuilder '[ '( 'IDRequirement Interaction, 'Required)]
-> S -> ConsRes S '[ '( 'IDRequirement Interaction, 'Required)]
forall a (reqs :: [(RequirementType, RouteRequirement)]).
RouteFragmentable a reqs =>
RouteBuilder reqs -> a -> ConsRes a reqs
// Text -> S
S Text
"callback"
      RouteBuilder '[ '( 'IDRequirement Interaction, 'Required)]
-> (RouteBuilder '[ '( 'IDRequirement Interaction, 'Required)]
    -> RouteBuilder
         '[ '( 'IDRequirement Interaction, 'Satisfied),
            '( 'IDRequirement Interaction, 'Required)])
-> RouteBuilder
     '[ '( 'IDRequirement Interaction, 'Satisfied),
        '( 'IDRequirement Interaction, 'Required)]
forall a b. a -> (a -> b) -> b
& Snowflake Interaction
-> RouteBuilder '[ '( 'IDRequirement Interaction, 'Required)]
-> RouteBuilder
     '[ '( 'IDRequirement Interaction, 'Satisfied),
        '( 'IDRequirement Interaction, 'Required)]
forall t (reqs :: [(RequirementType, RouteRequirement)]).
Typeable t =>
Snowflake t
-> RouteBuilder reqs
-> RouteBuilder ('( 'IDRequirement t, 'Satisfied) : reqs)
giveID Snowflake Interaction
iid
      RouteBuilder
  '[ '( 'IDRequirement Interaction, 'Satisfied),
     '( 'IDRequirement Interaction, 'Required)]
-> (RouteBuilder
      '[ '( 'IDRequirement Interaction, 'Satisfied),
         '( 'IDRequirement Interaction, 'Required)]
    -> Route)
-> Route
forall a b. a -> (a -> b) -> b
& RouteBuilder
  '[ '( 'IDRequirement Interaction, 'Satisfied),
     '( 'IDRequirement Interaction, 'Required)]
-> Route
forall (reqs :: [(RequirementType, RouteRequirement)]).
EnsureFulfilled reqs =>
RouteBuilder reqs -> Route
buildRoute
  route (CreateResponseMessage (forall a. HasID Interaction a => a -> Snowflake Interaction
forall b a. HasID b a => a -> Snowflake b
getID @Interaction -> Snowflake Interaction
iid) (InteractionToken Text
token) InteractionCallbackMessageOptions
_) =
    RouteBuilder '[]
mkRouteBuilder RouteBuilder '[] -> S -> ConsRes S '[]
forall a (reqs :: [(RequirementType, RouteRequirement)]).
RouteFragmentable a reqs =>
RouteBuilder reqs -> a -> ConsRes a reqs
// Text -> S
S Text
"interactions" RouteBuilder '[] -> ID Interaction -> ConsRes (ID Interaction) '[]
forall a (reqs :: [(RequirementType, RouteRequirement)]).
RouteFragmentable a reqs =>
RouteBuilder reqs -> a -> ConsRes a reqs
// ID Interaction
forall k (a :: k). ID a
ID @Interaction RouteBuilder '[ '( 'IDRequirement Interaction, 'Required)]
-> S -> ConsRes S '[ '( 'IDRequirement Interaction, 'Required)]
forall a (reqs :: [(RequirementType, RouteRequirement)]).
RouteFragmentable a reqs =>
RouteBuilder reqs -> a -> ConsRes a reqs
// Text -> S
S Text
token RouteBuilder '[ '( 'IDRequirement Interaction, 'Required)]
-> S -> ConsRes S '[ '( 'IDRequirement Interaction, 'Required)]
forall a (reqs :: [(RequirementType, RouteRequirement)]).
RouteFragmentable a reqs =>
RouteBuilder reqs -> a -> ConsRes a reqs
// Text -> S
S Text
"callback"
      RouteBuilder '[ '( 'IDRequirement Interaction, 'Required)]
-> (RouteBuilder '[ '( 'IDRequirement Interaction, 'Required)]
    -> RouteBuilder
         '[ '( 'IDRequirement Interaction, 'Satisfied),
            '( 'IDRequirement Interaction, 'Required)])
-> RouteBuilder
     '[ '( 'IDRequirement Interaction, 'Satisfied),
        '( 'IDRequirement Interaction, 'Required)]
forall a b. a -> (a -> b) -> b
& Snowflake Interaction
-> RouteBuilder '[ '( 'IDRequirement Interaction, 'Required)]
-> RouteBuilder
     '[ '( 'IDRequirement Interaction, 'Satisfied),
        '( 'IDRequirement Interaction, 'Required)]
forall t (reqs :: [(RequirementType, RouteRequirement)]).
Typeable t =>
Snowflake t
-> RouteBuilder reqs
-> RouteBuilder ('( 'IDRequirement t, 'Satisfied) : reqs)
giveID Snowflake Interaction
iid
      RouteBuilder
  '[ '( 'IDRequirement Interaction, 'Satisfied),
     '( 'IDRequirement Interaction, 'Required)]
-> (RouteBuilder
      '[ '( 'IDRequirement Interaction, 'Satisfied),
         '( 'IDRequirement Interaction, 'Required)]
    -> Route)
-> Route
forall a b. a -> (a -> b) -> b
& RouteBuilder
  '[ '( 'IDRequirement Interaction, 'Satisfied),
     '( 'IDRequirement Interaction, 'Required)]
-> Route
forall (reqs :: [(RequirementType, RouteRequirement)]).
EnsureFulfilled reqs =>
RouteBuilder reqs -> Route
buildRoute
  route (CreateResponseUpdate (forall a. HasID Interaction a => a -> Snowflake Interaction
forall b a. HasID b a => a -> Snowflake b
getID @Interaction -> Snowflake Interaction
iid) (InteractionToken Text
token) InteractionCallbackMessageOptions
_) =
    RouteBuilder '[]
mkRouteBuilder RouteBuilder '[] -> S -> ConsRes S '[]
forall a (reqs :: [(RequirementType, RouteRequirement)]).
RouteFragmentable a reqs =>
RouteBuilder reqs -> a -> ConsRes a reqs
// Text -> S
S Text
"interactions" RouteBuilder '[] -> ID Interaction -> ConsRes (ID Interaction) '[]
forall a (reqs :: [(RequirementType, RouteRequirement)]).
RouteFragmentable a reqs =>
RouteBuilder reqs -> a -> ConsRes a reqs
// ID Interaction
forall k (a :: k). ID a
ID @Interaction RouteBuilder '[ '( 'IDRequirement Interaction, 'Required)]
-> S -> ConsRes S '[ '( 'IDRequirement Interaction, 'Required)]
forall a (reqs :: [(RequirementType, RouteRequirement)]).
RouteFragmentable a reqs =>
RouteBuilder reqs -> a -> ConsRes a reqs
// Text -> S
S Text
token RouteBuilder '[ '( 'IDRequirement Interaction, 'Required)]
-> S -> ConsRes S '[ '( 'IDRequirement Interaction, 'Required)]
forall a (reqs :: [(RequirementType, RouteRequirement)]).
RouteFragmentable a reqs =>
RouteBuilder reqs -> a -> ConsRes a reqs
// Text -> S
S Text
"callback"
      RouteBuilder '[ '( 'IDRequirement Interaction, 'Required)]
-> (RouteBuilder '[ '( 'IDRequirement Interaction, 'Required)]
    -> RouteBuilder
         '[ '( 'IDRequirement Interaction, 'Satisfied),
            '( 'IDRequirement Interaction, 'Required)])
-> RouteBuilder
     '[ '( 'IDRequirement Interaction, 'Satisfied),
        '( 'IDRequirement Interaction, 'Required)]
forall a b. a -> (a -> b) -> b
& Snowflake Interaction
-> RouteBuilder '[ '( 'IDRequirement Interaction, 'Required)]
-> RouteBuilder
     '[ '( 'IDRequirement Interaction, 'Satisfied),
        '( 'IDRequirement Interaction, 'Required)]
forall t (reqs :: [(RequirementType, RouteRequirement)]).
Typeable t =>
Snowflake t
-> RouteBuilder reqs
-> RouteBuilder ('( 'IDRequirement t, 'Satisfied) : reqs)
giveID Snowflake Interaction
iid
      RouteBuilder
  '[ '( 'IDRequirement Interaction, 'Satisfied),
     '( 'IDRequirement Interaction, 'Required)]
-> (RouteBuilder
      '[ '( 'IDRequirement Interaction, 'Satisfied),
         '( 'IDRequirement Interaction, 'Required)]
    -> Route)
-> Route
forall a b. a -> (a -> b) -> b
& RouteBuilder
  '[ '( 'IDRequirement Interaction, 'Satisfied),
     '( 'IDRequirement Interaction, 'Required)]
-> Route
forall (reqs :: [(RequirementType, RouteRequirement)]).
EnsureFulfilled reqs =>
RouteBuilder reqs -> Route
buildRoute
  route (CreateResponseAutocomplete (forall a. HasID Interaction a => a -> Snowflake Interaction
forall b a. HasID b a => a -> Snowflake b
getID @Interaction -> Snowflake Interaction
iid) (InteractionToken Text
token) InteractionCallbackAutocomplete
_) =
    RouteBuilder '[]
mkRouteBuilder RouteBuilder '[] -> S -> ConsRes S '[]
forall a (reqs :: [(RequirementType, RouteRequirement)]).
RouteFragmentable a reqs =>
RouteBuilder reqs -> a -> ConsRes a reqs
// Text -> S
S Text
"interactions" RouteBuilder '[] -> ID Interaction -> ConsRes (ID Interaction) '[]
forall a (reqs :: [(RequirementType, RouteRequirement)]).
RouteFragmentable a reqs =>
RouteBuilder reqs -> a -> ConsRes a reqs
// ID Interaction
forall k (a :: k). ID a
ID @Interaction RouteBuilder '[ '( 'IDRequirement Interaction, 'Required)]
-> S -> ConsRes S '[ '( 'IDRequirement Interaction, 'Required)]
forall a (reqs :: [(RequirementType, RouteRequirement)]).
RouteFragmentable a reqs =>
RouteBuilder reqs -> a -> ConsRes a reqs
// Text -> S
S Text
token RouteBuilder '[ '( 'IDRequirement Interaction, 'Required)]
-> S -> ConsRes S '[ '( 'IDRequirement Interaction, 'Required)]
forall a (reqs :: [(RequirementType, RouteRequirement)]).
RouteFragmentable a reqs =>
RouteBuilder reqs -> a -> ConsRes a reqs
// Text -> S
S Text
"callback"
      RouteBuilder '[ '( 'IDRequirement Interaction, 'Required)]
-> (RouteBuilder '[ '( 'IDRequirement Interaction, 'Required)]
    -> RouteBuilder
         '[ '( 'IDRequirement Interaction, 'Satisfied),
            '( 'IDRequirement Interaction, 'Required)])
-> RouteBuilder
     '[ '( 'IDRequirement Interaction, 'Satisfied),
        '( 'IDRequirement Interaction, 'Required)]
forall a b. a -> (a -> b) -> b
& Snowflake Interaction
-> RouteBuilder '[ '( 'IDRequirement Interaction, 'Required)]
-> RouteBuilder
     '[ '( 'IDRequirement Interaction, 'Satisfied),
        '( 'IDRequirement Interaction, 'Required)]
forall t (reqs :: [(RequirementType, RouteRequirement)]).
Typeable t =>
Snowflake t
-> RouteBuilder reqs
-> RouteBuilder ('( 'IDRequirement t, 'Satisfied) : reqs)
giveID Snowflake Interaction
iid
      RouteBuilder
  '[ '( 'IDRequirement Interaction, 'Satisfied),
     '( 'IDRequirement Interaction, 'Required)]
-> (RouteBuilder
      '[ '( 'IDRequirement Interaction, 'Satisfied),
         '( 'IDRequirement Interaction, 'Required)]
    -> Route)
-> Route
forall a b. a -> (a -> b) -> b
& RouteBuilder
  '[ '( 'IDRequirement Interaction, 'Satisfied),
     '( 'IDRequirement Interaction, 'Required)]
-> Route
forall (reqs :: [(RequirementType, RouteRequirement)]).
EnsureFulfilled reqs =>
RouteBuilder reqs -> Route
buildRoute
  route (CreateResponseModal (forall a. HasID Interaction a => a -> Snowflake Interaction
forall b a. HasID b a => a -> Snowflake b
getID @Interaction -> Snowflake Interaction
iid) (InteractionToken Text
token) InteractionCallbackModal
_) =
    RouteBuilder '[]
mkRouteBuilder RouteBuilder '[] -> S -> ConsRes S '[]
forall a (reqs :: [(RequirementType, RouteRequirement)]).
RouteFragmentable a reqs =>
RouteBuilder reqs -> a -> ConsRes a reqs
// Text -> S
S Text
"interactions" RouteBuilder '[] -> ID Interaction -> ConsRes (ID Interaction) '[]
forall a (reqs :: [(RequirementType, RouteRequirement)]).
RouteFragmentable a reqs =>
RouteBuilder reqs -> a -> ConsRes a reqs
// ID Interaction
forall k (a :: k). ID a
ID @Interaction RouteBuilder '[ '( 'IDRequirement Interaction, 'Required)]
-> S -> ConsRes S '[ '( 'IDRequirement Interaction, 'Required)]
forall a (reqs :: [(RequirementType, RouteRequirement)]).
RouteFragmentable a reqs =>
RouteBuilder reqs -> a -> ConsRes a reqs
// Text -> S
S Text
token RouteBuilder '[ '( 'IDRequirement Interaction, 'Required)]
-> S -> ConsRes S '[ '( 'IDRequirement Interaction, 'Required)]
forall a (reqs :: [(RequirementType, RouteRequirement)]).
RouteFragmentable a reqs =>
RouteBuilder reqs -> a -> ConsRes a reqs
// Text -> S
S Text
"callback"
      RouteBuilder '[ '( 'IDRequirement Interaction, 'Required)]
-> (RouteBuilder '[ '( 'IDRequirement Interaction, 'Required)]
    -> RouteBuilder
         '[ '( 'IDRequirement Interaction, 'Satisfied),
            '( 'IDRequirement Interaction, 'Required)])
-> RouteBuilder
     '[ '( 'IDRequirement Interaction, 'Satisfied),
        '( 'IDRequirement Interaction, 'Required)]
forall a b. a -> (a -> b) -> b
& Snowflake Interaction
-> RouteBuilder '[ '( 'IDRequirement Interaction, 'Required)]
-> RouteBuilder
     '[ '( 'IDRequirement Interaction, 'Satisfied),
        '( 'IDRequirement Interaction, 'Required)]
forall t (reqs :: [(RequirementType, RouteRequirement)]).
Typeable t =>
Snowflake t
-> RouteBuilder reqs
-> RouteBuilder ('( 'IDRequirement t, 'Satisfied) : reqs)
giveID Snowflake Interaction
iid
      RouteBuilder
  '[ '( 'IDRequirement Interaction, 'Satisfied),
     '( 'IDRequirement Interaction, 'Required)]
-> (RouteBuilder
      '[ '( 'IDRequirement Interaction, 'Satisfied),
         '( 'IDRequirement Interaction, 'Required)]
    -> Route)
-> Route
forall a b. a -> (a -> b) -> b
& RouteBuilder
  '[ '( 'IDRequirement Interaction, 'Satisfied),
     '( 'IDRequirement Interaction, 'Required)]
-> Route
forall (reqs :: [(RequirementType, RouteRequirement)]).
EnsureFulfilled reqs =>
RouteBuilder reqs -> Route
buildRoute
  route (GetOriginalInteractionResponse (forall a. HasID Application a => a -> Snowflake Application
forall b a. HasID b a => a -> Snowflake b
getID @Application -> Snowflake Application
aid) InteractionToken
token) =
    Snowflake Application
-> InteractionToken
-> RouteBuilder
     '[ '( 'IDRequirement Application, 'Satisfied),
        '( 'IDRequirement Application, 'Required)]
baseRoute Snowflake Application
aid InteractionToken
token RouteBuilder
  '[ '( 'IDRequirement Application, 'Satisfied),
     '( 'IDRequirement Application, 'Required)]
-> S
-> ConsRes
     S
     '[ '( 'IDRequirement Application, 'Satisfied),
        '( 'IDRequirement Application, 'Required)]
forall a (reqs :: [(RequirementType, RouteRequirement)]).
RouteFragmentable a reqs =>
RouteBuilder reqs -> a -> ConsRes a reqs
// Text -> S
S Text
"messages" RouteBuilder
  '[ '( 'IDRequirement Application, 'Satisfied),
     '( 'IDRequirement Application, 'Required)]
-> S
-> ConsRes
     S
     '[ '( 'IDRequirement Application, 'Satisfied),
        '( 'IDRequirement Application, 'Required)]
forall a (reqs :: [(RequirementType, RouteRequirement)]).
RouteFragmentable a reqs =>
RouteBuilder reqs -> a -> ConsRes a reqs
// Text -> S
S Text
"@original" RouteBuilder
  '[ '( 'IDRequirement Application, 'Satisfied),
     '( 'IDRequirement Application, 'Required)]
-> (RouteBuilder
      '[ '( 'IDRequirement Application, 'Satisfied),
         '( 'IDRequirement Application, 'Required)]
    -> Route)
-> Route
forall a b. a -> (a -> b) -> b
& RouteBuilder
  '[ '( 'IDRequirement Application, 'Satisfied),
     '( 'IDRequirement Application, 'Required)]
-> Route
forall (reqs :: [(RequirementType, RouteRequirement)]).
EnsureFulfilled reqs =>
RouteBuilder reqs -> Route
buildRoute
  route (EditOriginalInteractionResponse (forall a. HasID Application a => a -> Snowflake Application
forall b a. HasID b a => a -> Snowflake b
getID @Application -> Snowflake Application
aid) InteractionToken
token InteractionCallbackMessageOptions
_) =
    Snowflake Application
-> InteractionToken
-> RouteBuilder
     '[ '( 'IDRequirement Application, 'Satisfied),
        '( 'IDRequirement Application, 'Required)]
baseRoute Snowflake Application
aid InteractionToken
token RouteBuilder
  '[ '( 'IDRequirement Application, 'Satisfied),
     '( 'IDRequirement Application, 'Required)]
-> S
-> ConsRes
     S
     '[ '( 'IDRequirement Application, 'Satisfied),
        '( 'IDRequirement Application, 'Required)]
forall a (reqs :: [(RequirementType, RouteRequirement)]).
RouteFragmentable a reqs =>
RouteBuilder reqs -> a -> ConsRes a reqs
// Text -> S
S Text
"messages" RouteBuilder
  '[ '( 'IDRequirement Application, 'Satisfied),
     '( 'IDRequirement Application, 'Required)]
-> S
-> ConsRes
     S
     '[ '( 'IDRequirement Application, 'Satisfied),
        '( 'IDRequirement Application, 'Required)]
forall a (reqs :: [(RequirementType, RouteRequirement)]).
RouteFragmentable a reqs =>
RouteBuilder reqs -> a -> ConsRes a reqs
// Text -> S
S Text
"@original" RouteBuilder
  '[ '( 'IDRequirement Application, 'Satisfied),
     '( 'IDRequirement Application, 'Required)]
-> (RouteBuilder
      '[ '( 'IDRequirement Application, 'Satisfied),
         '( 'IDRequirement Application, 'Required)]
    -> Route)
-> Route
forall a b. a -> (a -> b) -> b
& RouteBuilder
  '[ '( 'IDRequirement Application, 'Satisfied),
     '( 'IDRequirement Application, 'Required)]
-> Route
forall (reqs :: [(RequirementType, RouteRequirement)]).
EnsureFulfilled reqs =>
RouteBuilder reqs -> Route
buildRoute
  route (DeleteOriginalInteractionResponse (forall a. HasID Application a => a -> Snowflake Application
forall b a. HasID b a => a -> Snowflake b
getID @Application -> Snowflake Application
aid) InteractionToken
token) =
    Snowflake Application
-> InteractionToken
-> RouteBuilder
     '[ '( 'IDRequirement Application, 'Satisfied),
        '( 'IDRequirement Application, 'Required)]
baseRoute Snowflake Application
aid InteractionToken
token RouteBuilder
  '[ '( 'IDRequirement Application, 'Satisfied),
     '( 'IDRequirement Application, 'Required)]
-> S
-> ConsRes
     S
     '[ '( 'IDRequirement Application, 'Satisfied),
        '( 'IDRequirement Application, 'Required)]
forall a (reqs :: [(RequirementType, RouteRequirement)]).
RouteFragmentable a reqs =>
RouteBuilder reqs -> a -> ConsRes a reqs
// Text -> S
S Text
"messages" RouteBuilder
  '[ '( 'IDRequirement Application, 'Satisfied),
     '( 'IDRequirement Application, 'Required)]
-> S
-> ConsRes
     S
     '[ '( 'IDRequirement Application, 'Satisfied),
        '( 'IDRequirement Application, 'Required)]
forall a (reqs :: [(RequirementType, RouteRequirement)]).
RouteFragmentable a reqs =>
RouteBuilder reqs -> a -> ConsRes a reqs
// Text -> S
S Text
"@original" RouteBuilder
  '[ '( 'IDRequirement Application, 'Satisfied),
     '( 'IDRequirement Application, 'Required)]
-> (RouteBuilder
      '[ '( 'IDRequirement Application, 'Satisfied),
         '( 'IDRequirement Application, 'Required)]
    -> Route)
-> Route
forall a b. a -> (a -> b) -> b
& RouteBuilder
  '[ '( 'IDRequirement Application, 'Satisfied),
     '( 'IDRequirement Application, 'Required)]
-> Route
forall (reqs :: [(RequirementType, RouteRequirement)]).
EnsureFulfilled reqs =>
RouteBuilder reqs -> Route
buildRoute
  route (CreateFollowupMessage (forall a. HasID Application a => a -> Snowflake Application
forall b a. HasID b a => a -> Snowflake b
getID @Application -> Snowflake Application
aid) InteractionToken
token InteractionCallbackMessageOptions
_) =
    Snowflake Application
-> InteractionToken
-> RouteBuilder
     '[ '( 'IDRequirement Application, 'Satisfied),
        '( 'IDRequirement Application, 'Required)]
baseRoute Snowflake Application
aid InteractionToken
token RouteBuilder
  '[ '( 'IDRequirement Application, 'Satisfied),
     '( 'IDRequirement Application, 'Required)]
-> (RouteBuilder
      '[ '( 'IDRequirement Application, 'Satisfied),
         '( 'IDRequirement Application, 'Required)]
    -> Route)
-> Route
forall a b. a -> (a -> b) -> b
& RouteBuilder
  '[ '( 'IDRequirement Application, 'Satisfied),
     '( 'IDRequirement Application, 'Required)]
-> Route
forall (reqs :: [(RequirementType, RouteRequirement)]).
EnsureFulfilled reqs =>
RouteBuilder reqs -> Route
buildRoute
  route (GetFollowupMessage (forall a. HasID Application a => a -> Snowflake Application
forall b a. HasID b a => a -> Snowflake b
getID @Application -> Snowflake Application
aid) (forall a. HasID Message a => a -> Snowflake Message
forall b a. HasID b a => a -> Snowflake b
getID @Message -> Snowflake Message
mid) InteractionToken
token) =
    Snowflake Application
-> InteractionToken
-> RouteBuilder
     '[ '( 'IDRequirement Application, 'Satisfied),
        '( 'IDRequirement Application, 'Required)]
baseRoute Snowflake Application
aid InteractionToken
token RouteBuilder
  '[ '( 'IDRequirement Application, 'Satisfied),
     '( 'IDRequirement Application, 'Required)]
-> S
-> ConsRes
     S
     '[ '( 'IDRequirement Application, 'Satisfied),
        '( 'IDRequirement Application, 'Required)]
forall a (reqs :: [(RequirementType, RouteRequirement)]).
RouteFragmentable a reqs =>
RouteBuilder reqs -> a -> ConsRes a reqs
// Text -> S
S Text
"messages" RouteBuilder
  '[ '( 'IDRequirement Application, 'Satisfied),
     '( 'IDRequirement Application, 'Required)]
-> ID Message
-> ConsRes
     (ID Message)
     '[ '( 'IDRequirement Application, 'Satisfied),
        '( 'IDRequirement Application, 'Required)]
forall a (reqs :: [(RequirementType, RouteRequirement)]).
RouteFragmentable a reqs =>
RouteBuilder reqs -> a -> ConsRes a reqs
// ID Message
forall k (a :: k). ID a
ID @Message RouteBuilder
  '[ '( 'IDRequirement Message, 'Required),
     '( 'IDRequirement Application, 'Satisfied),
     '( 'IDRequirement Application, 'Required)]
-> (RouteBuilder
      '[ '( 'IDRequirement Message, 'Required),
         '( 'IDRequirement Application, 'Satisfied),
         '( 'IDRequirement Application, 'Required)]
    -> RouteBuilder
         '[ '( 'IDRequirement Message, 'Satisfied),
            '( 'IDRequirement Message, 'Required),
            '( 'IDRequirement Application, 'Satisfied),
            '( 'IDRequirement Application, 'Required)])
-> RouteBuilder
     '[ '( 'IDRequirement Message, 'Satisfied),
        '( 'IDRequirement Message, 'Required),
        '( 'IDRequirement Application, 'Satisfied),
        '( 'IDRequirement Application, 'Required)]
forall a b. a -> (a -> b) -> b
& Snowflake Message
-> RouteBuilder
     '[ '( 'IDRequirement Message, 'Required),
        '( 'IDRequirement Application, 'Satisfied),
        '( 'IDRequirement Application, 'Required)]
-> RouteBuilder
     '[ '( 'IDRequirement Message, 'Satisfied),
        '( 'IDRequirement Message, 'Required),
        '( 'IDRequirement Application, 'Satisfied),
        '( 'IDRequirement Application, 'Required)]
forall t (reqs :: [(RequirementType, RouteRequirement)]).
Typeable t =>
Snowflake t
-> RouteBuilder reqs
-> RouteBuilder ('( 'IDRequirement t, 'Satisfied) : reqs)
giveID Snowflake Message
mid RouteBuilder
  '[ '( 'IDRequirement Message, 'Satisfied),
     '( 'IDRequirement Message, 'Required),
     '( 'IDRequirement Application, 'Satisfied),
     '( 'IDRequirement Application, 'Required)]
-> (RouteBuilder
      '[ '( 'IDRequirement Message, 'Satisfied),
         '( 'IDRequirement Message, 'Required),
         '( 'IDRequirement Application, 'Satisfied),
         '( 'IDRequirement Application, 'Required)]
    -> Route)
-> Route
forall a b. a -> (a -> b) -> b
& RouteBuilder
  '[ '( 'IDRequirement Message, 'Satisfied),
     '( 'IDRequirement Message, 'Required),
     '( 'IDRequirement Application, 'Satisfied),
     '( 'IDRequirement Application, 'Required)]
-> Route
forall (reqs :: [(RequirementType, RouteRequirement)]).
EnsureFulfilled reqs =>
RouteBuilder reqs -> Route
buildRoute
  route (EditFollowupMessage (forall a. HasID Application a => a -> Snowflake Application
forall b a. HasID b a => a -> Snowflake b
getID @Application -> Snowflake Application
aid) (forall a. HasID Message a => a -> Snowflake Message
forall b a. HasID b a => a -> Snowflake b
getID @Message -> Snowflake Message
mid) InteractionToken
token InteractionCallbackMessageOptions
_) =
    Snowflake Application
-> InteractionToken
-> RouteBuilder
     '[ '( 'IDRequirement Application, 'Satisfied),
        '( 'IDRequirement Application, 'Required)]
baseRoute Snowflake Application
aid InteractionToken
token RouteBuilder
  '[ '( 'IDRequirement Application, 'Satisfied),
     '( 'IDRequirement Application, 'Required)]
-> S
-> ConsRes
     S
     '[ '( 'IDRequirement Application, 'Satisfied),
        '( 'IDRequirement Application, 'Required)]
forall a (reqs :: [(RequirementType, RouteRequirement)]).
RouteFragmentable a reqs =>
RouteBuilder reqs -> a -> ConsRes a reqs
// Text -> S
S Text
"messages" RouteBuilder
  '[ '( 'IDRequirement Application, 'Satisfied),
     '( 'IDRequirement Application, 'Required)]
-> ID Message
-> ConsRes
     (ID Message)
     '[ '( 'IDRequirement Application, 'Satisfied),
        '( 'IDRequirement Application, 'Required)]
forall a (reqs :: [(RequirementType, RouteRequirement)]).
RouteFragmentable a reqs =>
RouteBuilder reqs -> a -> ConsRes a reqs
// ID Message
forall k (a :: k). ID a
ID @Message RouteBuilder
  '[ '( 'IDRequirement Message, 'Required),
     '( 'IDRequirement Application, 'Satisfied),
     '( 'IDRequirement Application, 'Required)]
-> (RouteBuilder
      '[ '( 'IDRequirement Message, 'Required),
         '( 'IDRequirement Application, 'Satisfied),
         '( 'IDRequirement Application, 'Required)]
    -> RouteBuilder
         '[ '( 'IDRequirement Message, 'Satisfied),
            '( 'IDRequirement Message, 'Required),
            '( 'IDRequirement Application, 'Satisfied),
            '( 'IDRequirement Application, 'Required)])
-> RouteBuilder
     '[ '( 'IDRequirement Message, 'Satisfied),
        '( 'IDRequirement Message, 'Required),
        '( 'IDRequirement Application, 'Satisfied),
        '( 'IDRequirement Application, 'Required)]
forall a b. a -> (a -> b) -> b
& Snowflake Message
-> RouteBuilder
     '[ '( 'IDRequirement Message, 'Required),
        '( 'IDRequirement Application, 'Satisfied),
        '( 'IDRequirement Application, 'Required)]
-> RouteBuilder
     '[ '( 'IDRequirement Message, 'Satisfied),
        '( 'IDRequirement Message, 'Required),
        '( 'IDRequirement Application, 'Satisfied),
        '( 'IDRequirement Application, 'Required)]
forall t (reqs :: [(RequirementType, RouteRequirement)]).
Typeable t =>
Snowflake t
-> RouteBuilder reqs
-> RouteBuilder ('( 'IDRequirement t, 'Satisfied) : reqs)
giveID Snowflake Message
mid RouteBuilder
  '[ '( 'IDRequirement Message, 'Satisfied),
     '( 'IDRequirement Message, 'Required),
     '( 'IDRequirement Application, 'Satisfied),
     '( 'IDRequirement Application, 'Required)]
-> (RouteBuilder
      '[ '( 'IDRequirement Message, 'Satisfied),
         '( 'IDRequirement Message, 'Required),
         '( 'IDRequirement Application, 'Satisfied),
         '( 'IDRequirement Application, 'Required)]
    -> Route)
-> Route
forall a b. a -> (a -> b) -> b
& RouteBuilder
  '[ '( 'IDRequirement Message, 'Satisfied),
     '( 'IDRequirement Message, 'Required),
     '( 'IDRequirement Application, 'Satisfied),
     '( 'IDRequirement Application, 'Required)]
-> Route
forall (reqs :: [(RequirementType, RouteRequirement)]).
EnsureFulfilled reqs =>
RouteBuilder reqs -> Route
buildRoute
  route (DeleteFollowupMessage (forall a. HasID Application a => a -> Snowflake Application
forall b a. HasID b a => a -> Snowflake b
getID @Application -> Snowflake Application
aid) (forall a. HasID Message a => a -> Snowflake Message
forall b a. HasID b a => a -> Snowflake b
getID @Message -> Snowflake Message
mid) InteractionToken
token) =
    Snowflake Application
-> InteractionToken
-> RouteBuilder
     '[ '( 'IDRequirement Application, 'Satisfied),
        '( 'IDRequirement Application, 'Required)]
baseRoute Snowflake Application
aid InteractionToken
token RouteBuilder
  '[ '( 'IDRequirement Application, 'Satisfied),
     '( 'IDRequirement Application, 'Required)]
-> S
-> ConsRes
     S
     '[ '( 'IDRequirement Application, 'Satisfied),
        '( 'IDRequirement Application, 'Required)]
forall a (reqs :: [(RequirementType, RouteRequirement)]).
RouteFragmentable a reqs =>
RouteBuilder reqs -> a -> ConsRes a reqs
// Text -> S
S Text
"messages" RouteBuilder
  '[ '( 'IDRequirement Application, 'Satisfied),
     '( 'IDRequirement Application, 'Required)]
-> ID Message
-> ConsRes
     (ID Message)
     '[ '( 'IDRequirement Application, 'Satisfied),
        '( 'IDRequirement Application, 'Required)]
forall a (reqs :: [(RequirementType, RouteRequirement)]).
RouteFragmentable a reqs =>
RouteBuilder reqs -> a -> ConsRes a reqs
// ID Message
forall k (a :: k). ID a
ID @Message RouteBuilder
  '[ '( 'IDRequirement Message, 'Required),
     '( 'IDRequirement Application, 'Satisfied),
     '( 'IDRequirement Application, 'Required)]
-> (RouteBuilder
      '[ '( 'IDRequirement Message, 'Required),
         '( 'IDRequirement Application, 'Satisfied),
         '( 'IDRequirement Application, 'Required)]
    -> RouteBuilder
         '[ '( 'IDRequirement Message, 'Satisfied),
            '( 'IDRequirement Message, 'Required),
            '( 'IDRequirement Application, 'Satisfied),
            '( 'IDRequirement Application, 'Required)])
-> RouteBuilder
     '[ '( 'IDRequirement Message, 'Satisfied),
        '( 'IDRequirement Message, 'Required),
        '( 'IDRequirement Application, 'Satisfied),
        '( 'IDRequirement Application, 'Required)]
forall a b. a -> (a -> b) -> b
& Snowflake Message
-> RouteBuilder
     '[ '( 'IDRequirement Message, 'Required),
        '( 'IDRequirement Application, 'Satisfied),
        '( 'IDRequirement Application, 'Required)]
-> RouteBuilder
     '[ '( 'IDRequirement Message, 'Satisfied),
        '( 'IDRequirement Message, 'Required),
        '( 'IDRequirement Application, 'Satisfied),
        '( 'IDRequirement Application, 'Required)]
forall t (reqs :: [(RequirementType, RouteRequirement)]).
Typeable t =>
Snowflake t
-> RouteBuilder reqs
-> RouteBuilder ('( 'IDRequirement t, 'Satisfied) : reqs)
giveID Snowflake Message
mid RouteBuilder
  '[ '( 'IDRequirement Message, 'Satisfied),
     '( 'IDRequirement Message, 'Required),
     '( 'IDRequirement Application, 'Satisfied),
     '( 'IDRequirement Application, 'Required)]
-> (RouteBuilder
      '[ '( 'IDRequirement Message, 'Satisfied),
         '( 'IDRequirement Message, 'Required),
         '( 'IDRequirement Application, 'Satisfied),
         '( 'IDRequirement Application, 'Required)]
    -> Route)
-> Route
forall a b. a -> (a -> b) -> b
& RouteBuilder
  '[ '( 'IDRequirement Message, 'Satisfied),
     '( 'IDRequirement Message, 'Required),
     '( 'IDRequirement Application, 'Satisfied),
     '( 'IDRequirement Application, 'Required)]
-> Route
forall (reqs :: [(RequirementType, RouteRequirement)]).
EnsureFulfilled reqs =>
RouteBuilder reqs -> Route
buildRoute

  action :: InteractionRequest a
-> Url 'Https -> Option 'Https -> Req LbsResponse
action (CreateResponseDefer i
_ InteractionToken
_ Bool
ephemeral) =
    let jsonBody :: InteractionCallback
jsonBody =
          InteractionCallback :: InteractionCallbackType -> Maybe Value -> InteractionCallback
InteractionCallback
            { $sel:type_:InteractionCallback :: InteractionCallbackType
type_ = InteractionCallbackType
DeferredChannelMessageWithSourceType
            , $sel:data_:InteractionCallback :: Maybe Value
data_ = if Bool
ephemeral then Value -> Maybe Value
forall a. a -> Maybe a
Just (Value -> Maybe Value)
-> ([Pair] -> Value) -> [Pair] -> Maybe Value
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [Pair] -> Value
object ([Pair] -> Maybe Value) -> [Pair] -> Maybe Value
forall a b. (a -> b) -> a -> b
$ [(Key
"flags", Scientific -> Value
Number Scientific
64)] else Maybe Value
forall a. Maybe a
Nothing
            }
     in ReqBodyJson InteractionCallback
-> Url 'Https -> Option 'Https -> Req LbsResponse
forall a.
HttpBody a =>
a -> Url 'Https -> Option 'Https -> Req LbsResponse
postWith' (InteractionCallback -> ReqBodyJson InteractionCallback
forall a. a -> ReqBodyJson a
ReqBodyJson InteractionCallback
jsonBody)
  action (CreateResponseDeferComponent i
_ InteractionToken
_) =
    let jsonBody :: InteractionCallback
jsonBody =
          InteractionCallback :: InteractionCallbackType -> Maybe Value -> InteractionCallback
InteractionCallback
            { $sel:type_:InteractionCallback :: InteractionCallbackType
type_ = InteractionCallbackType
DeferredUpdateMessageType
            , $sel:data_:InteractionCallback :: Maybe Value
data_ = Maybe Value
forall a. Maybe a
Nothing
            }
     in ReqBodyJson InteractionCallback
-> Url 'Https -> Option 'Https -> Req LbsResponse
forall a.
HttpBody a =>
a -> Url 'Https -> Option 'Https -> Req LbsResponse
postWith' (InteractionCallback -> ReqBodyJson InteractionCallback
forall a. a -> ReqBodyJson a
ReqBodyJson InteractionCallback
jsonBody)
  action (CreateResponseMessage i
_ InteractionToken
_ InteractionCallbackMessageOptions
cm) = \Url 'Https
u Option 'Https
o -> do
    let filePart :: CreateMessageAttachment -> i -> PartM IO
filePart CreateMessageAttachment {Text
$sel:filename:CreateMessageAttachment :: CreateMessageAttachment -> Text
filename :: Text
filename, ByteString
$sel:content:CreateMessageAttachment :: CreateMessageAttachment -> ByteString
content :: ByteString
content} i
n =
          (Text -> ByteString -> PartM IO
forall (m :: * -> *).
Applicative m =>
Text -> ByteString -> PartM m
partLBS @IO [fmt|files[{n}]|] ByteString
content)
            { partFilename :: Maybe String
partFilename = String -> Maybe String
forall a. a -> Maybe a
Just (Text -> String
T.unpack Text
filename)
            , partContentType :: Maybe MimeType
partContentType = MimeType -> Maybe MimeType
forall a. a -> Maybe a
Just (Text -> MimeType
defaultMimeLookup Text
filename)
            }
        attachmentPart :: CreateMessageAttachment -> Int -> CreateMessageAttachmentJson
attachmentPart CreateMessageAttachment {Text
filename :: Text
$sel:filename:CreateMessageAttachment :: CreateMessageAttachment -> Text
filename, Maybe Text
$sel:description:CreateMessageAttachment :: CreateMessageAttachment -> Maybe Text
description :: Maybe Text
description} Int
n =
          Int -> Text -> Maybe Text -> CreateMessageAttachmentJson
CreateMessageAttachmentJson Int
n Text
filename Maybe Text
description
        files :: [PartM IO]
files = (CreateMessageAttachment -> Int -> PartM IO)
-> [CreateMessageAttachment] -> [Int] -> [PartM IO]
forall a b c. (a -> b -> c) -> [a] -> [b] -> [c]
zipWith CreateMessageAttachment -> Int -> PartM IO
forall i.
FormatAny2 (PyFClassify i) i 'AlignAll =>
CreateMessageAttachment -> i -> PartM IO
filePart ([CreateMessageAttachment]
-> Maybe [CreateMessageAttachment] -> [CreateMessageAttachment]
forall a. a -> Maybe a -> a
fromMaybe [] (Maybe [CreateMessageAttachment] -> [CreateMessageAttachment])
-> Maybe [CreateMessageAttachment] -> [CreateMessageAttachment]
forall a b. (a -> b) -> a -> b
$ InteractionCallbackMessageOptions
cm InteractionCallbackMessageOptions
-> Getting
     (Maybe [CreateMessageAttachment])
     InteractionCallbackMessageOptions
     (Maybe [CreateMessageAttachment])
-> Maybe [CreateMessageAttachment]
forall s a. s -> Getting a s a -> a
^. IsLabel
  "attachments"
  (Getting
     (Maybe [CreateMessageAttachment])
     InteractionCallbackMessageOptions
     (Maybe [CreateMessageAttachment]))
Getting
  (Maybe [CreateMessageAttachment])
  InteractionCallbackMessageOptions
  (Maybe [CreateMessageAttachment])
#attachments) [(Int
0 :: Int) ..]
        attachments :: Maybe [CreateMessageAttachmentJson]
attachments = (\[CreateMessageAttachment]
a -> (CreateMessageAttachment -> Int -> CreateMessageAttachmentJson)
-> [CreateMessageAttachment]
-> [Int]
-> [CreateMessageAttachmentJson]
forall a b c. (a -> b -> c) -> [a] -> [b] -> [c]
zipWith CreateMessageAttachment -> Int -> CreateMessageAttachmentJson
attachmentPart [CreateMessageAttachment]
a [Int
0 ..]) ([CreateMessageAttachment] -> [CreateMessageAttachmentJson])
-> Maybe [CreateMessageAttachment]
-> Maybe [CreateMessageAttachmentJson]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> InteractionCallbackMessageOptions
cm InteractionCallbackMessageOptions
-> Getting
     (Maybe [CreateMessageAttachment])
     InteractionCallbackMessageOptions
     (Maybe [CreateMessageAttachment])
-> Maybe [CreateMessageAttachment]
forall s a. s -> Getting a s a -> a
^. IsLabel
  "attachments"
  (Getting
     (Maybe [CreateMessageAttachment])
     InteractionCallbackMessageOptions
     (Maybe [CreateMessageAttachment]))
Getting
  (Maybe [CreateMessageAttachment])
  InteractionCallbackMessageOptions
  (Maybe [CreateMessageAttachment])
#attachments
        ephemeral :: Maybe Int
ephemeral = (\Bool
f -> if Bool
f then Int
1 Int -> Int -> Int
forall a. Bits a => a -> Int -> a
`shiftL` Int
6 else Int
0) (Bool -> Int) -> Maybe Bool -> Maybe Int
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> InteractionCallbackMessageOptions
cm InteractionCallbackMessageOptions
-> Getting
     (Maybe Bool) InteractionCallbackMessageOptions (Maybe Bool)
-> Maybe Bool
forall s a. s -> Getting a s a -> a
^. IsLabel
  "ephemeral"
  (Getting
     (Maybe Bool) InteractionCallbackMessageOptions (Maybe Bool))
Getting (Maybe Bool) InteractionCallbackMessageOptions (Maybe Bool)
#ephemeral
        suppressEmbeds :: Maybe Int
suppressEmbeds = (\Bool
f -> if Bool
f then Int
1 Int -> Int -> Int
forall a. Bits a => a -> Int -> a
`shiftL` Int
2 else Int
0) (Bool -> Int) -> Maybe Bool -> Maybe Int
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> InteractionCallbackMessageOptions
cm InteractionCallbackMessageOptions
-> Getting
     (Maybe Bool) InteractionCallbackMessageOptions (Maybe Bool)
-> Maybe Bool
forall s a. s -> Getting a s a -> a
^. IsLabel
  "suppressEmbeds"
  (Getting
     (Maybe Bool) InteractionCallbackMessageOptions (Maybe Bool))
Getting (Maybe Bool) InteractionCallbackMessageOptions (Maybe Bool)
#suppressEmbeds
        flags :: Maybe Int
flags = Maybe Int -> Maybe Int -> (Int -> Int -> Int) -> Maybe Int
forall a. Maybe a -> Maybe a -> (a -> a -> a) -> Maybe a
foo Maybe Int
ephemeral Maybe Int
suppressEmbeds Int -> Int -> Int
forall a. Bits a => a -> a -> a
(.|.)
        jsonData :: CreateResponseMessageJson
jsonData =
          CreateResponseMessageJson :: Maybe Bool
-> Maybe Text
-> Maybe [Embed]
-> Maybe AllowedMentions
-> Maybe Int
-> Maybe [Component]
-> Maybe [CreateMessageAttachmentJson]
-> CreateResponseMessageJson
CreateResponseMessageJson
            { $sel:content:CreateResponseMessageJson :: Maybe Text
content = InteractionCallbackMessageOptions
cm InteractionCallbackMessageOptions
-> Getting
     (Maybe Text) InteractionCallbackMessageOptions (Maybe Text)
-> Maybe Text
forall s a. s -> Getting a s a -> a
^. IsLabel
  "content"
  (Getting
     (Maybe Text) InteractionCallbackMessageOptions (Maybe Text))
Getting (Maybe Text) InteractionCallbackMessageOptions (Maybe Text)
#content
            , $sel:tts:CreateResponseMessageJson :: Maybe Bool
tts = InteractionCallbackMessageOptions
cm InteractionCallbackMessageOptions
-> Getting
     (Maybe Bool) InteractionCallbackMessageOptions (Maybe Bool)
-> Maybe Bool
forall s a. s -> Getting a s a -> a
^. IsLabel
  "tts"
  (Getting
     (Maybe Bool) InteractionCallbackMessageOptions (Maybe Bool))
Getting (Maybe Bool) InteractionCallbackMessageOptions (Maybe Bool)
#tts
            , $sel:embeds:CreateResponseMessageJson :: Maybe [Embed]
embeds = InteractionCallbackMessageOptions
cm InteractionCallbackMessageOptions
-> Getting
     (Maybe [Embed]) InteractionCallbackMessageOptions (Maybe [Embed])
-> Maybe [Embed]
forall s a. s -> Getting a s a -> a
^. IsLabel
  "embeds"
  (Getting
     (Maybe [Embed]) InteractionCallbackMessageOptions (Maybe [Embed]))
Getting
  (Maybe [Embed]) InteractionCallbackMessageOptions (Maybe [Embed])
#embeds
            , $sel:allowedMentions:CreateResponseMessageJson :: Maybe AllowedMentions
allowedMentions = InteractionCallbackMessageOptions
cm InteractionCallbackMessageOptions
-> Getting
     (Maybe AllowedMentions)
     InteractionCallbackMessageOptions
     (Maybe AllowedMentions)
-> Maybe AllowedMentions
forall s a. s -> Getting a s a -> a
^. IsLabel
  "allowedMentions"
  (Getting
     (Maybe AllowedMentions)
     InteractionCallbackMessageOptions
     (Maybe AllowedMentions))
Getting
  (Maybe AllowedMentions)
  InteractionCallbackMessageOptions
  (Maybe AllowedMentions)
#allowedMentions
            , $sel:components:CreateResponseMessageJson :: Maybe [Component]
components = InteractionCallbackMessageOptions
cm InteractionCallbackMessageOptions
-> Getting
     (Maybe [Component])
     InteractionCallbackMessageOptions
     (Maybe [Component])
-> Maybe [Component]
forall s a. s -> Getting a s a -> a
^. IsLabel
  "components"
  (Getting
     (Maybe [Component])
     InteractionCallbackMessageOptions
     (Maybe [Component]))
Getting
  (Maybe [Component])
  InteractionCallbackMessageOptions
  (Maybe [Component])
#components
            , $sel:attachments:CreateResponseMessageJson :: Maybe [CreateMessageAttachmentJson]
attachments = Maybe [CreateMessageAttachmentJson]
attachments
            , $sel:flags:CreateResponseMessageJson :: Maybe Int
flags = Maybe Int
flags
            }
        jsonBody :: InteractionCallback
jsonBody =
          InteractionCallback :: InteractionCallbackType -> Maybe Value -> InteractionCallback
InteractionCallback
            { $sel:type_:InteractionCallback :: InteractionCallbackType
type_ = InteractionCallbackType
ChannelMessageWithSourceType
            , $sel:data_:InteractionCallback :: Maybe Value
data_ = Value -> Maybe Value
forall a. a -> Maybe a
Just (Value -> Maybe Value)
-> (CreateResponseMessageJson -> Value)
-> CreateResponseMessageJson
-> Maybe Value
forall b c a. (b -> c) -> (a -> b) -> a -> c
. CreateResponseMessageJson -> Value
forall a. ToJSON a => a -> Value
toJSON (CreateResponseMessageJson -> Maybe Value)
-> CreateResponseMessageJson -> Maybe Value
forall a b. (a -> b) -> a -> b
$ CreateResponseMessageJson
jsonData
            }
    ReqBodyMultipart
body <- [PartM IO] -> Req ReqBodyMultipart
forall (m :: * -> *). MonadIO m => [PartM IO] -> m ReqBodyMultipart
reqBodyMultipart (Text -> ByteString -> PartM IO
forall (m :: * -> *).
Applicative m =>
Text -> ByteString -> PartM m
partLBS Text
"payload_json" (InteractionCallback -> ByteString
forall a. ToJSON a => a -> ByteString
encode InteractionCallback
jsonBody) PartM IO -> [PartM IO] -> [PartM IO]
forall a. a -> [a] -> [a]
: [PartM IO]
files)
    ReqBodyMultipart -> Url 'Https -> Option 'Https -> Req LbsResponse
forall a.
HttpBody a =>
a -> Url 'Https -> Option 'Https -> Req LbsResponse
postWith' ReqBodyMultipart
body Url 'Https
u Option 'Https
o
  action (CreateResponseUpdate i
_ InteractionToken
_ InteractionCallbackMessageOptions
cm) = \Url 'Https
u Option 'Https
o -> do
    let filePart :: CreateMessageAttachment -> i -> PartM IO
filePart CreateMessageAttachment {Text
filename :: Text
$sel:filename:CreateMessageAttachment :: CreateMessageAttachment -> Text
filename, ByteString
content :: ByteString
$sel:content:CreateMessageAttachment :: CreateMessageAttachment -> ByteString
content} i
n =
          (Text -> ByteString -> PartM IO
forall (m :: * -> *).
Applicative m =>
Text -> ByteString -> PartM m
partLBS @IO [fmt|files[{n}]|] ByteString
content)
            { partFilename :: Maybe String
partFilename = String -> Maybe String
forall a. a -> Maybe a
Just (Text -> String
T.unpack Text
filename)
            , partContentType :: Maybe MimeType
partContentType = MimeType -> Maybe MimeType
forall a. a -> Maybe a
Just (Text -> MimeType
defaultMimeLookup Text
filename)
            }
        attachmentPart :: CreateMessageAttachment -> Int -> CreateMessageAttachmentJson
attachmentPart CreateMessageAttachment {Text
filename :: Text
$sel:filename:CreateMessageAttachment :: CreateMessageAttachment -> Text
filename, Maybe Text
description :: Maybe Text
$sel:description:CreateMessageAttachment :: CreateMessageAttachment -> Maybe Text
description} Int
n =
          Int -> Text -> Maybe Text -> CreateMessageAttachmentJson
CreateMessageAttachmentJson Int
n Text
filename Maybe Text
description
        files :: [PartM IO]
files = (CreateMessageAttachment -> Int -> PartM IO)
-> [CreateMessageAttachment] -> [Int] -> [PartM IO]
forall a b c. (a -> b -> c) -> [a] -> [b] -> [c]
zipWith CreateMessageAttachment -> Int -> PartM IO
forall i.
FormatAny2 (PyFClassify i) i 'AlignAll =>
CreateMessageAttachment -> i -> PartM IO
filePart ([CreateMessageAttachment]
-> Maybe [CreateMessageAttachment] -> [CreateMessageAttachment]
forall a. a -> Maybe a -> a
fromMaybe [] (Maybe [CreateMessageAttachment] -> [CreateMessageAttachment])
-> Maybe [CreateMessageAttachment] -> [CreateMessageAttachment]
forall a b. (a -> b) -> a -> b
$ InteractionCallbackMessageOptions
cm InteractionCallbackMessageOptions
-> Getting
     (Maybe [CreateMessageAttachment])
     InteractionCallbackMessageOptions
     (Maybe [CreateMessageAttachment])
-> Maybe [CreateMessageAttachment]
forall s a. s -> Getting a s a -> a
^. IsLabel
  "attachments"
  (Getting
     (Maybe [CreateMessageAttachment])
     InteractionCallbackMessageOptions
     (Maybe [CreateMessageAttachment]))
Getting
  (Maybe [CreateMessageAttachment])
  InteractionCallbackMessageOptions
  (Maybe [CreateMessageAttachment])
#attachments) [(Int
0 :: Int) ..]
        attachments :: Maybe [CreateMessageAttachmentJson]
attachments = (\[CreateMessageAttachment]
a -> (CreateMessageAttachment -> Int -> CreateMessageAttachmentJson)
-> [CreateMessageAttachment]
-> [Int]
-> [CreateMessageAttachmentJson]
forall a b c. (a -> b -> c) -> [a] -> [b] -> [c]
zipWith CreateMessageAttachment -> Int -> CreateMessageAttachmentJson
attachmentPart [CreateMessageAttachment]
a [Int
0 ..]) ([CreateMessageAttachment] -> [CreateMessageAttachmentJson])
-> Maybe [CreateMessageAttachment]
-> Maybe [CreateMessageAttachmentJson]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> InteractionCallbackMessageOptions
cm InteractionCallbackMessageOptions
-> Getting
     (Maybe [CreateMessageAttachment])
     InteractionCallbackMessageOptions
     (Maybe [CreateMessageAttachment])
-> Maybe [CreateMessageAttachment]
forall s a. s -> Getting a s a -> a
^. IsLabel
  "attachments"
  (Getting
     (Maybe [CreateMessageAttachment])
     InteractionCallbackMessageOptions
     (Maybe [CreateMessageAttachment]))
Getting
  (Maybe [CreateMessageAttachment])
  InteractionCallbackMessageOptions
  (Maybe [CreateMessageAttachment])
#attachments
        ephemeral :: Maybe Int
ephemeral = (\Bool
f -> if Bool
f then Int
1 Int -> Int -> Int
forall a. Bits a => a -> Int -> a
`shiftL` Int
6 else Int
0) (Bool -> Int) -> Maybe Bool -> Maybe Int
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> InteractionCallbackMessageOptions
cm InteractionCallbackMessageOptions
-> Getting
     (Maybe Bool) InteractionCallbackMessageOptions (Maybe Bool)
-> Maybe Bool
forall s a. s -> Getting a s a -> a
^. IsLabel
  "ephemeral"
  (Getting
     (Maybe Bool) InteractionCallbackMessageOptions (Maybe Bool))
Getting (Maybe Bool) InteractionCallbackMessageOptions (Maybe Bool)
#ephemeral
        suppressEmbeds :: Maybe Int
suppressEmbeds = (\Bool
f -> if Bool
f then Int
1 Int -> Int -> Int
forall a. Bits a => a -> Int -> a
`shiftL` Int
2 else Int
0) (Bool -> Int) -> Maybe Bool -> Maybe Int
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> InteractionCallbackMessageOptions
cm InteractionCallbackMessageOptions
-> Getting
     (Maybe Bool) InteractionCallbackMessageOptions (Maybe Bool)
-> Maybe Bool
forall s a. s -> Getting a s a -> a
^. IsLabel
  "suppressEmbeds"
  (Getting
     (Maybe Bool) InteractionCallbackMessageOptions (Maybe Bool))
Getting (Maybe Bool) InteractionCallbackMessageOptions (Maybe Bool)
#suppressEmbeds
        flags :: Maybe Int
flags = Maybe Int -> Maybe Int -> (Int -> Int -> Int) -> Maybe Int
forall a. Maybe a -> Maybe a -> (a -> a -> a) -> Maybe a
foo Maybe Int
ephemeral Maybe Int
suppressEmbeds Int -> Int -> Int
forall a. Bits a => a -> a -> a
(.|.)
        jsonData :: CreateResponseMessageJson
jsonData =
          CreateResponseMessageJson :: Maybe Bool
-> Maybe Text
-> Maybe [Embed]
-> Maybe AllowedMentions
-> Maybe Int
-> Maybe [Component]
-> Maybe [CreateMessageAttachmentJson]
-> CreateResponseMessageJson
CreateResponseMessageJson
            { $sel:content:CreateResponseMessageJson :: Maybe Text
content = InteractionCallbackMessageOptions
cm InteractionCallbackMessageOptions
-> Getting
     (Maybe Text) InteractionCallbackMessageOptions (Maybe Text)
-> Maybe Text
forall s a. s -> Getting a s a -> a
^. IsLabel
  "content"
  (Getting
     (Maybe Text) InteractionCallbackMessageOptions (Maybe Text))
Getting (Maybe Text) InteractionCallbackMessageOptions (Maybe Text)
#content
            , $sel:tts:CreateResponseMessageJson :: Maybe Bool
tts = InteractionCallbackMessageOptions
cm InteractionCallbackMessageOptions
-> Getting
     (Maybe Bool) InteractionCallbackMessageOptions (Maybe Bool)
-> Maybe Bool
forall s a. s -> Getting a s a -> a
^. IsLabel
  "tts"
  (Getting
     (Maybe Bool) InteractionCallbackMessageOptions (Maybe Bool))
Getting (Maybe Bool) InteractionCallbackMessageOptions (Maybe Bool)
#tts
            , $sel:embeds:CreateResponseMessageJson :: Maybe [Embed]
embeds = InteractionCallbackMessageOptions
cm InteractionCallbackMessageOptions
-> Getting
     (Maybe [Embed]) InteractionCallbackMessageOptions (Maybe [Embed])
-> Maybe [Embed]
forall s a. s -> Getting a s a -> a
^. IsLabel
  "embeds"
  (Getting
     (Maybe [Embed]) InteractionCallbackMessageOptions (Maybe [Embed]))
Getting
  (Maybe [Embed]) InteractionCallbackMessageOptions (Maybe [Embed])
#embeds
            , $sel:allowedMentions:CreateResponseMessageJson :: Maybe AllowedMentions
allowedMentions = InteractionCallbackMessageOptions
cm InteractionCallbackMessageOptions
-> Getting
     (Maybe AllowedMentions)
     InteractionCallbackMessageOptions
     (Maybe AllowedMentions)
-> Maybe AllowedMentions
forall s a. s -> Getting a s a -> a
^. IsLabel
  "allowedMentions"
  (Getting
     (Maybe AllowedMentions)
     InteractionCallbackMessageOptions
     (Maybe AllowedMentions))
Getting
  (Maybe AllowedMentions)
  InteractionCallbackMessageOptions
  (Maybe AllowedMentions)
#allowedMentions
            , $sel:components:CreateResponseMessageJson :: Maybe [Component]
components = InteractionCallbackMessageOptions
cm InteractionCallbackMessageOptions
-> Getting
     (Maybe [Component])
     InteractionCallbackMessageOptions
     (Maybe [Component])
-> Maybe [Component]
forall s a. s -> Getting a s a -> a
^. IsLabel
  "components"
  (Getting
     (Maybe [Component])
     InteractionCallbackMessageOptions
     (Maybe [Component]))
Getting
  (Maybe [Component])
  InteractionCallbackMessageOptions
  (Maybe [Component])
#components
            , $sel:attachments:CreateResponseMessageJson :: Maybe [CreateMessageAttachmentJson]
attachments = Maybe [CreateMessageAttachmentJson]
attachments
            , $sel:flags:CreateResponseMessageJson :: Maybe Int
flags = Maybe Int
flags
            }
        jsonBody :: InteractionCallback
jsonBody =
          InteractionCallback :: InteractionCallbackType -> Maybe Value -> InteractionCallback
InteractionCallback
            { $sel:type_:InteractionCallback :: InteractionCallbackType
type_ = InteractionCallbackType
UpdateMessageType
            , $sel:data_:InteractionCallback :: Maybe Value
data_ = Value -> Maybe Value
forall a. a -> Maybe a
Just (Value -> Maybe Value)
-> (CreateResponseMessageJson -> Value)
-> CreateResponseMessageJson
-> Maybe Value
forall b c a. (b -> c) -> (a -> b) -> a -> c
. CreateResponseMessageJson -> Value
forall a. ToJSON a => a -> Value
toJSON (CreateResponseMessageJson -> Maybe Value)
-> CreateResponseMessageJson -> Maybe Value
forall a b. (a -> b) -> a -> b
$ CreateResponseMessageJson
jsonData
            }
    ReqBodyMultipart
body <- [PartM IO] -> Req ReqBodyMultipart
forall (m :: * -> *). MonadIO m => [PartM IO] -> m ReqBodyMultipart
reqBodyMultipart (Text -> ByteString -> PartM IO
forall (m :: * -> *).
Applicative m =>
Text -> ByteString -> PartM m
partLBS Text
"payload_json" (InteractionCallback -> ByteString
forall a. ToJSON a => a -> ByteString
encode InteractionCallback
jsonBody) PartM IO -> [PartM IO] -> [PartM IO]
forall a. a -> [a] -> [a]
: [PartM IO]
files)
    ReqBodyMultipart -> Url 'Https -> Option 'Https -> Req LbsResponse
forall a.
HttpBody a =>
a -> Url 'Https -> Option 'Https -> Req LbsResponse
postWith' ReqBodyMultipart
body Url 'Https
u Option 'Https
o
  action (CreateResponseAutocomplete i
_ InteractionToken
_ InteractionCallbackAutocomplete
ao) =
    let jsonBody :: InteractionCallback
jsonBody =
          InteractionCallback :: InteractionCallbackType -> Maybe Value -> InteractionCallback
InteractionCallback
            { $sel:type_:InteractionCallback :: InteractionCallbackType
type_ = InteractionCallbackType
ApplicationCommandAutocompleteResultType
            , $sel:data_:InteractionCallback :: Maybe Value
data_ = Value -> Maybe Value
forall a. a -> Maybe a
Just (Value -> Maybe Value)
-> (InteractionCallbackAutocomplete -> Value)
-> InteractionCallbackAutocomplete
-> Maybe Value
forall b c a. (b -> c) -> (a -> b) -> a -> c
. InteractionCallbackAutocomplete -> Value
forall a. ToJSON a => a -> Value
toJSON (InteractionCallbackAutocomplete -> Maybe Value)
-> InteractionCallbackAutocomplete -> Maybe Value
forall a b. (a -> b) -> a -> b
$ InteractionCallbackAutocomplete
ao
            }
     in ReqBodyJson InteractionCallback
-> Url 'Https -> Option 'Https -> Req LbsResponse
forall a.
HttpBody a =>
a -> Url 'Https -> Option 'Https -> Req LbsResponse
postWith' (InteractionCallback -> ReqBodyJson InteractionCallback
forall a. a -> ReqBodyJson a
ReqBodyJson InteractionCallback
jsonBody)
  action (CreateResponseModal i
_ InteractionToken
_ InteractionCallbackModal
mo) =
    let jsonBody :: InteractionCallback
jsonBody =
          InteractionCallback :: InteractionCallbackType -> Maybe Value -> InteractionCallback
InteractionCallback
            { $sel:type_:InteractionCallback :: InteractionCallbackType
type_ = InteractionCallbackType
ModalType
            , $sel:data_:InteractionCallback :: Maybe Value
data_ = Value -> Maybe Value
forall a. a -> Maybe a
Just (Value -> Maybe Value)
-> (InteractionCallbackModal -> Value)
-> InteractionCallbackModal
-> Maybe Value
forall b c a. (b -> c) -> (a -> b) -> a -> c
. InteractionCallbackModal -> Value
forall a. ToJSON a => a -> Value
toJSON (InteractionCallbackModal -> Maybe Value)
-> InteractionCallbackModal -> Maybe Value
forall a b. (a -> b) -> a -> b
$ InteractionCallbackModal
mo
            }
     in ReqBodyJson InteractionCallback
-> Url 'Https -> Option 'Https -> Req LbsResponse
forall a.
HttpBody a =>
a -> Url 'Https -> Option 'Https -> Req LbsResponse
postWith' (InteractionCallback -> ReqBodyJson InteractionCallback
forall a. a -> ReqBodyJson a
ReqBodyJson InteractionCallback
jsonBody)
  action (GetOriginalInteractionResponse i
_ InteractionToken
_) = Url 'Https -> Option 'Https -> Req LbsResponse
getWith
  action (EditOriginalInteractionResponse i
_ InteractionToken
_ InteractionCallbackMessageOptions
cm) = \Url 'Https
u Option 'Https
o -> do
    let filePart :: CreateMessageAttachment -> i -> PartM IO
filePart CreateMessageAttachment {Text
filename :: Text
$sel:filename:CreateMessageAttachment :: CreateMessageAttachment -> Text
filename, ByteString
content :: ByteString
$sel:content:CreateMessageAttachment :: CreateMessageAttachment -> ByteString
content} i
n =
          (Text -> ByteString -> PartM IO
forall (m :: * -> *).
Applicative m =>
Text -> ByteString -> PartM m
partLBS @IO [fmt|files[{n}]|] ByteString
content)
            { partFilename :: Maybe String
partFilename = String -> Maybe String
forall a. a -> Maybe a
Just (Text -> String
T.unpack Text
filename)
            , partContentType :: Maybe MimeType
partContentType = MimeType -> Maybe MimeType
forall a. a -> Maybe a
Just (Text -> MimeType
defaultMimeLookup Text
filename)
            }
        attachmentPart :: CreateMessageAttachment -> Int -> CreateMessageAttachmentJson
attachmentPart CreateMessageAttachment {Text
filename :: Text
$sel:filename:CreateMessageAttachment :: CreateMessageAttachment -> Text
filename, Maybe Text
description :: Maybe Text
$sel:description:CreateMessageAttachment :: CreateMessageAttachment -> Maybe Text
description} Int
n =
          Int -> Text -> Maybe Text -> CreateMessageAttachmentJson
CreateMessageAttachmentJson Int
n Text
filename Maybe Text
description
        files :: [PartM IO]
files = (CreateMessageAttachment -> Int -> PartM IO)
-> [CreateMessageAttachment] -> [Int] -> [PartM IO]
forall a b c. (a -> b -> c) -> [a] -> [b] -> [c]
zipWith CreateMessageAttachment -> Int -> PartM IO
forall i.
FormatAny2 (PyFClassify i) i 'AlignAll =>
CreateMessageAttachment -> i -> PartM IO
filePart ([CreateMessageAttachment]
-> Maybe [CreateMessageAttachment] -> [CreateMessageAttachment]
forall a. a -> Maybe a -> a
fromMaybe [] (Maybe [CreateMessageAttachment] -> [CreateMessageAttachment])
-> Maybe [CreateMessageAttachment] -> [CreateMessageAttachment]
forall a b. (a -> b) -> a -> b
$ InteractionCallbackMessageOptions
cm InteractionCallbackMessageOptions
-> Getting
     (Maybe [CreateMessageAttachment])
     InteractionCallbackMessageOptions
     (Maybe [CreateMessageAttachment])
-> Maybe [CreateMessageAttachment]
forall s a. s -> Getting a s a -> a
^. IsLabel
  "attachments"
  (Getting
     (Maybe [CreateMessageAttachment])
     InteractionCallbackMessageOptions
     (Maybe [CreateMessageAttachment]))
Getting
  (Maybe [CreateMessageAttachment])
  InteractionCallbackMessageOptions
  (Maybe [CreateMessageAttachment])
#attachments) [(Int
0 :: Int) ..]
        attachments :: Maybe [CreateMessageAttachmentJson]
attachments = (\[CreateMessageAttachment]
a -> (CreateMessageAttachment -> Int -> CreateMessageAttachmentJson)
-> [CreateMessageAttachment]
-> [Int]
-> [CreateMessageAttachmentJson]
forall a b c. (a -> b -> c) -> [a] -> [b] -> [c]
zipWith CreateMessageAttachment -> Int -> CreateMessageAttachmentJson
attachmentPart [CreateMessageAttachment]
a [Int
0 ..]) ([CreateMessageAttachment] -> [CreateMessageAttachmentJson])
-> Maybe [CreateMessageAttachment]
-> Maybe [CreateMessageAttachmentJson]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> InteractionCallbackMessageOptions
cm InteractionCallbackMessageOptions
-> Getting
     (Maybe [CreateMessageAttachment])
     InteractionCallbackMessageOptions
     (Maybe [CreateMessageAttachment])
-> Maybe [CreateMessageAttachment]
forall s a. s -> Getting a s a -> a
^. IsLabel
  "attachments"
  (Getting
     (Maybe [CreateMessageAttachment])
     InteractionCallbackMessageOptions
     (Maybe [CreateMessageAttachment]))
Getting
  (Maybe [CreateMessageAttachment])
  InteractionCallbackMessageOptions
  (Maybe [CreateMessageAttachment])
#attachments
        ephemeral :: Maybe Int
ephemeral = (\Bool
f -> if Bool
f then Int
1 Int -> Int -> Int
forall a. Bits a => a -> Int -> a
`shiftL` Int
6 else Int
0) (Bool -> Int) -> Maybe Bool -> Maybe Int
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> InteractionCallbackMessageOptions
cm InteractionCallbackMessageOptions
-> Getting
     (Maybe Bool) InteractionCallbackMessageOptions (Maybe Bool)
-> Maybe Bool
forall s a. s -> Getting a s a -> a
^. IsLabel
  "ephemeral"
  (Getting
     (Maybe Bool) InteractionCallbackMessageOptions (Maybe Bool))
Getting (Maybe Bool) InteractionCallbackMessageOptions (Maybe Bool)
#ephemeral
        suppressEmbeds :: Maybe Int
suppressEmbeds = (\Bool
f -> if Bool
f then Int
1 Int -> Int -> Int
forall a. Bits a => a -> Int -> a
`shiftL` Int
2 else Int
0) (Bool -> Int) -> Maybe Bool -> Maybe Int
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> InteractionCallbackMessageOptions
cm InteractionCallbackMessageOptions
-> Getting
     (Maybe Bool) InteractionCallbackMessageOptions (Maybe Bool)
-> Maybe Bool
forall s a. s -> Getting a s a -> a
^. IsLabel
  "suppressEmbeds"
  (Getting
     (Maybe Bool) InteractionCallbackMessageOptions (Maybe Bool))
Getting (Maybe Bool) InteractionCallbackMessageOptions (Maybe Bool)
#suppressEmbeds
        flags :: Maybe Int
flags = Maybe Int -> Maybe Int -> (Int -> Int -> Int) -> Maybe Int
forall a. Maybe a -> Maybe a -> (a -> a -> a) -> Maybe a
foo Maybe Int
ephemeral Maybe Int
suppressEmbeds Int -> Int -> Int
forall a. Bits a => a -> a -> a
(.|.)
        jsonData :: CreateResponseMessageJson
jsonData =
          CreateResponseMessageJson :: Maybe Bool
-> Maybe Text
-> Maybe [Embed]
-> Maybe AllowedMentions
-> Maybe Int
-> Maybe [Component]
-> Maybe [CreateMessageAttachmentJson]
-> CreateResponseMessageJson
CreateResponseMessageJson
            { $sel:content:CreateResponseMessageJson :: Maybe Text
content = InteractionCallbackMessageOptions
cm InteractionCallbackMessageOptions
-> Getting
     (Maybe Text) InteractionCallbackMessageOptions (Maybe Text)
-> Maybe Text
forall s a. s -> Getting a s a -> a
^. IsLabel
  "content"
  (Getting
     (Maybe Text) InteractionCallbackMessageOptions (Maybe Text))
Getting (Maybe Text) InteractionCallbackMessageOptions (Maybe Text)
#content
            , $sel:tts:CreateResponseMessageJson :: Maybe Bool
tts = InteractionCallbackMessageOptions
cm InteractionCallbackMessageOptions
-> Getting
     (Maybe Bool) InteractionCallbackMessageOptions (Maybe Bool)
-> Maybe Bool
forall s a. s -> Getting a s a -> a
^. IsLabel
  "tts"
  (Getting
     (Maybe Bool) InteractionCallbackMessageOptions (Maybe Bool))
Getting (Maybe Bool) InteractionCallbackMessageOptions (Maybe Bool)
#tts
            , $sel:embeds:CreateResponseMessageJson :: Maybe [Embed]
embeds = InteractionCallbackMessageOptions
cm InteractionCallbackMessageOptions
-> Getting
     (Maybe [Embed]) InteractionCallbackMessageOptions (Maybe [Embed])
-> Maybe [Embed]
forall s a. s -> Getting a s a -> a
^. IsLabel
  "embeds"
  (Getting
     (Maybe [Embed]) InteractionCallbackMessageOptions (Maybe [Embed]))
Getting
  (Maybe [Embed]) InteractionCallbackMessageOptions (Maybe [Embed])
#embeds
            , $sel:allowedMentions:CreateResponseMessageJson :: Maybe AllowedMentions
allowedMentions = InteractionCallbackMessageOptions
cm InteractionCallbackMessageOptions
-> Getting
     (Maybe AllowedMentions)
     InteractionCallbackMessageOptions
     (Maybe AllowedMentions)
-> Maybe AllowedMentions
forall s a. s -> Getting a s a -> a
^. IsLabel
  "allowedMentions"
  (Getting
     (Maybe AllowedMentions)
     InteractionCallbackMessageOptions
     (Maybe AllowedMentions))
Getting
  (Maybe AllowedMentions)
  InteractionCallbackMessageOptions
  (Maybe AllowedMentions)
#allowedMentions
            , $sel:components:CreateResponseMessageJson :: Maybe [Component]
components = InteractionCallbackMessageOptions
cm InteractionCallbackMessageOptions
-> Getting
     (Maybe [Component])
     InteractionCallbackMessageOptions
     (Maybe [Component])
-> Maybe [Component]
forall s a. s -> Getting a s a -> a
^. IsLabel
  "components"
  (Getting
     (Maybe [Component])
     InteractionCallbackMessageOptions
     (Maybe [Component]))
Getting
  (Maybe [Component])
  InteractionCallbackMessageOptions
  (Maybe [Component])
#components
            , $sel:attachments:CreateResponseMessageJson :: Maybe [CreateMessageAttachmentJson]
attachments = Maybe [CreateMessageAttachmentJson]
attachments
            , $sel:flags:CreateResponseMessageJson :: Maybe Int
flags = Maybe Int
flags
            }
        jsonBody :: InteractionCallback
jsonBody =
          InteractionCallback :: InteractionCallbackType -> Maybe Value -> InteractionCallback
InteractionCallback
            { $sel:type_:InteractionCallback :: InteractionCallbackType
type_ = InteractionCallbackType
UpdateMessageType
            , $sel:data_:InteractionCallback :: Maybe Value
data_ = Value -> Maybe Value
forall a. a -> Maybe a
Just (Value -> Maybe Value)
-> (CreateResponseMessageJson -> Value)
-> CreateResponseMessageJson
-> Maybe Value
forall b c a. (b -> c) -> (a -> b) -> a -> c
. CreateResponseMessageJson -> Value
forall a. ToJSON a => a -> Value
toJSON (CreateResponseMessageJson -> Maybe Value)
-> CreateResponseMessageJson -> Maybe Value
forall a b. (a -> b) -> a -> b
$ CreateResponseMessageJson
jsonData
            }
    ReqBodyMultipart
body <- [PartM IO] -> Req ReqBodyMultipart
forall (m :: * -> *). MonadIO m => [PartM IO] -> m ReqBodyMultipart
reqBodyMultipart (Text -> ByteString -> PartM IO
forall (m :: * -> *).
Applicative m =>
Text -> ByteString -> PartM m
partLBS Text
"payload_json" (InteractionCallback -> ByteString
forall a. ToJSON a => a -> ByteString
encode InteractionCallback
jsonBody) PartM IO -> [PartM IO] -> [PartM IO]
forall a. a -> [a] -> [a]
: [PartM IO]
files)
    ReqBodyMultipart -> Url 'Https -> Option 'Https -> Req LbsResponse
forall a.
HttpBody a =>
a -> Url 'Https -> Option 'Https -> Req LbsResponse
patchWith' ReqBodyMultipart
body Url 'Https
u Option 'Https
o
  action (DeleteOriginalInteractionResponse i
_ InteractionToken
_) = Url 'Https -> Option 'Https -> Req LbsResponse
deleteWith
  action (CreateFollowupMessage i
_ InteractionToken
_ InteractionCallbackMessageOptions
cm) = \Url 'Https
u Option 'Https
o -> do
    let filePart :: CreateMessageAttachment -> i -> PartM IO
filePart CreateMessageAttachment {Text
filename :: Text
$sel:filename:CreateMessageAttachment :: CreateMessageAttachment -> Text
filename, ByteString
content :: ByteString
$sel:content:CreateMessageAttachment :: CreateMessageAttachment -> ByteString
content} i
n =
          (Text -> ByteString -> PartM IO
forall (m :: * -> *).
Applicative m =>
Text -> ByteString -> PartM m
partLBS @IO [fmt|files[{n}]|] ByteString
content)
            { partFilename :: Maybe String
partFilename = String -> Maybe String
forall a. a -> Maybe a
Just (Text -> String
T.unpack Text
filename)
            , partContentType :: Maybe MimeType
partContentType = MimeType -> Maybe MimeType
forall a. a -> Maybe a
Just (Text -> MimeType
defaultMimeLookup Text
filename)
            }
        attachmentPart :: CreateMessageAttachment -> Int -> CreateMessageAttachmentJson
attachmentPart CreateMessageAttachment {Text
filename :: Text
$sel:filename:CreateMessageAttachment :: CreateMessageAttachment -> Text
filename, Maybe Text
description :: Maybe Text
$sel:description:CreateMessageAttachment :: CreateMessageAttachment -> Maybe Text
description} Int
n =
          Int -> Text -> Maybe Text -> CreateMessageAttachmentJson
CreateMessageAttachmentJson Int
n Text
filename Maybe Text
description
        files :: [PartM IO]
files = (CreateMessageAttachment -> Int -> PartM IO)
-> [CreateMessageAttachment] -> [Int] -> [PartM IO]
forall a b c. (a -> b -> c) -> [a] -> [b] -> [c]
zipWith CreateMessageAttachment -> Int -> PartM IO
forall i.
FormatAny2 (PyFClassify i) i 'AlignAll =>
CreateMessageAttachment -> i -> PartM IO
filePart ([CreateMessageAttachment]
-> Maybe [CreateMessageAttachment] -> [CreateMessageAttachment]
forall a. a -> Maybe a -> a
fromMaybe [] (Maybe [CreateMessageAttachment] -> [CreateMessageAttachment])
-> Maybe [CreateMessageAttachment] -> [CreateMessageAttachment]
forall a b. (a -> b) -> a -> b
$ InteractionCallbackMessageOptions
cm InteractionCallbackMessageOptions
-> Getting
     (Maybe [CreateMessageAttachment])
     InteractionCallbackMessageOptions
     (Maybe [CreateMessageAttachment])
-> Maybe [CreateMessageAttachment]
forall s a. s -> Getting a s a -> a
^. IsLabel
  "attachments"
  (Getting
     (Maybe [CreateMessageAttachment])
     InteractionCallbackMessageOptions
     (Maybe [CreateMessageAttachment]))
Getting
  (Maybe [CreateMessageAttachment])
  InteractionCallbackMessageOptions
  (Maybe [CreateMessageAttachment])
#attachments) [(Int
0 :: Int) ..]
        attachments :: Maybe [CreateMessageAttachmentJson]
attachments = (\[CreateMessageAttachment]
a -> (CreateMessageAttachment -> Int -> CreateMessageAttachmentJson)
-> [CreateMessageAttachment]
-> [Int]
-> [CreateMessageAttachmentJson]
forall a b c. (a -> b -> c) -> [a] -> [b] -> [c]
zipWith CreateMessageAttachment -> Int -> CreateMessageAttachmentJson
attachmentPart [CreateMessageAttachment]
a [Int
0 ..]) ([CreateMessageAttachment] -> [CreateMessageAttachmentJson])
-> Maybe [CreateMessageAttachment]
-> Maybe [CreateMessageAttachmentJson]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> InteractionCallbackMessageOptions
cm InteractionCallbackMessageOptions
-> Getting
     (Maybe [CreateMessageAttachment])
     InteractionCallbackMessageOptions
     (Maybe [CreateMessageAttachment])
-> Maybe [CreateMessageAttachment]
forall s a. s -> Getting a s a -> a
^. IsLabel
  "attachments"
  (Getting
     (Maybe [CreateMessageAttachment])
     InteractionCallbackMessageOptions
     (Maybe [CreateMessageAttachment]))
Getting
  (Maybe [CreateMessageAttachment])
  InteractionCallbackMessageOptions
  (Maybe [CreateMessageAttachment])
#attachments
        ephemeral :: Maybe Int
ephemeral = (\Bool
f -> if Bool
f then Int
1 Int -> Int -> Int
forall a. Bits a => a -> Int -> a
`shiftL` Int
6 else Int
0) (Bool -> Int) -> Maybe Bool -> Maybe Int
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> InteractionCallbackMessageOptions
cm InteractionCallbackMessageOptions
-> Getting
     (Maybe Bool) InteractionCallbackMessageOptions (Maybe Bool)
-> Maybe Bool
forall s a. s -> Getting a s a -> a
^. IsLabel
  "ephemeral"
  (Getting
     (Maybe Bool) InteractionCallbackMessageOptions (Maybe Bool))
Getting (Maybe Bool) InteractionCallbackMessageOptions (Maybe Bool)
#ephemeral
        suppressEmbeds :: Maybe Int
suppressEmbeds = (\Bool
f -> if Bool
f then Int
1 Int -> Int -> Int
forall a. Bits a => a -> Int -> a
`shiftL` Int
2 else Int
0) (Bool -> Int) -> Maybe Bool -> Maybe Int
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> InteractionCallbackMessageOptions
cm InteractionCallbackMessageOptions
-> Getting
     (Maybe Bool) InteractionCallbackMessageOptions (Maybe Bool)
-> Maybe Bool
forall s a. s -> Getting a s a -> a
^. IsLabel
  "suppressEmbeds"
  (Getting
     (Maybe Bool) InteractionCallbackMessageOptions (Maybe Bool))
Getting (Maybe Bool) InteractionCallbackMessageOptions (Maybe Bool)
#suppressEmbeds
        flags :: Maybe Int
flags = Maybe Int -> Maybe Int -> (Int -> Int -> Int) -> Maybe Int
forall a. Maybe a -> Maybe a -> (a -> a -> a) -> Maybe a
foo Maybe Int
ephemeral Maybe Int
suppressEmbeds Int -> Int -> Int
forall a. Bits a => a -> a -> a
(.|.)
        jsonData :: CreateResponseMessageJson
jsonData =
          CreateResponseMessageJson :: Maybe Bool
-> Maybe Text
-> Maybe [Embed]
-> Maybe AllowedMentions
-> Maybe Int
-> Maybe [Component]
-> Maybe [CreateMessageAttachmentJson]
-> CreateResponseMessageJson
CreateResponseMessageJson
            { $sel:content:CreateResponseMessageJson :: Maybe Text
content = InteractionCallbackMessageOptions
cm InteractionCallbackMessageOptions
-> Getting
     (Maybe Text) InteractionCallbackMessageOptions (Maybe Text)
-> Maybe Text
forall s a. s -> Getting a s a -> a
^. IsLabel
  "content"
  (Getting
     (Maybe Text) InteractionCallbackMessageOptions (Maybe Text))
Getting (Maybe Text) InteractionCallbackMessageOptions (Maybe Text)
#content
            , $sel:tts:CreateResponseMessageJson :: Maybe Bool
tts = InteractionCallbackMessageOptions
cm InteractionCallbackMessageOptions
-> Getting
     (Maybe Bool) InteractionCallbackMessageOptions (Maybe Bool)
-> Maybe Bool
forall s a. s -> Getting a s a -> a
^. IsLabel
  "tts"
  (Getting
     (Maybe Bool) InteractionCallbackMessageOptions (Maybe Bool))
Getting (Maybe Bool) InteractionCallbackMessageOptions (Maybe Bool)
#tts
            , $sel:embeds:CreateResponseMessageJson :: Maybe [Embed]
embeds = InteractionCallbackMessageOptions
cm InteractionCallbackMessageOptions
-> Getting
     (Maybe [Embed]) InteractionCallbackMessageOptions (Maybe [Embed])
-> Maybe [Embed]
forall s a. s -> Getting a s a -> a
^. IsLabel
  "embeds"
  (Getting
     (Maybe [Embed]) InteractionCallbackMessageOptions (Maybe [Embed]))
Getting
  (Maybe [Embed]) InteractionCallbackMessageOptions (Maybe [Embed])
#embeds
            , $sel:allowedMentions:CreateResponseMessageJson :: Maybe AllowedMentions
allowedMentions = InteractionCallbackMessageOptions
cm InteractionCallbackMessageOptions
-> Getting
     (Maybe AllowedMentions)
     InteractionCallbackMessageOptions
     (Maybe AllowedMentions)
-> Maybe AllowedMentions
forall s a. s -> Getting a s a -> a
^. IsLabel
  "allowedMentions"
  (Getting
     (Maybe AllowedMentions)
     InteractionCallbackMessageOptions
     (Maybe AllowedMentions))
Getting
  (Maybe AllowedMentions)
  InteractionCallbackMessageOptions
  (Maybe AllowedMentions)
#allowedMentions
            , $sel:components:CreateResponseMessageJson :: Maybe [Component]
components = InteractionCallbackMessageOptions
cm InteractionCallbackMessageOptions
-> Getting
     (Maybe [Component])
     InteractionCallbackMessageOptions
     (Maybe [Component])
-> Maybe [Component]
forall s a. s -> Getting a s a -> a
^. IsLabel
  "components"
  (Getting
     (Maybe [Component])
     InteractionCallbackMessageOptions
     (Maybe [Component]))
Getting
  (Maybe [Component])
  InteractionCallbackMessageOptions
  (Maybe [Component])
#components
            , $sel:attachments:CreateResponseMessageJson :: Maybe [CreateMessageAttachmentJson]
attachments = Maybe [CreateMessageAttachmentJson]
attachments
            , $sel:flags:CreateResponseMessageJson :: Maybe Int
flags = Maybe Int
flags
            }
    ReqBodyMultipart
body <- [PartM IO] -> Req ReqBodyMultipart
forall (m :: * -> *). MonadIO m => [PartM IO] -> m ReqBodyMultipart
reqBodyMultipart (Text -> ByteString -> PartM IO
forall (m :: * -> *).
Applicative m =>
Text -> ByteString -> PartM m
partLBS Text
"payload_json" (CreateResponseMessageJson -> ByteString
forall a. ToJSON a => a -> ByteString
encode CreateResponseMessageJson
jsonData) PartM IO -> [PartM IO] -> [PartM IO]
forall a. a -> [a] -> [a]
: [PartM IO]
files)
    ReqBodyMultipart -> Url 'Https -> Option 'Https -> Req LbsResponse
forall a.
HttpBody a =>
a -> Url 'Https -> Option 'Https -> Req LbsResponse
postWith' ReqBodyMultipart
body Url 'Https
u Option 'Https
o
  action GetFollowupMessage {} = Url 'Https -> Option 'Https -> Req LbsResponse
getWith
  action (EditFollowupMessage i
_ m
_ InteractionToken
_ InteractionCallbackMessageOptions
cm) = \Url 'Https
u Option 'Https
o -> do
    let filePart :: CreateMessageAttachment -> i -> PartM IO
filePart CreateMessageAttachment {Text
filename :: Text
$sel:filename:CreateMessageAttachment :: CreateMessageAttachment -> Text
filename, ByteString
content :: ByteString
$sel:content:CreateMessageAttachment :: CreateMessageAttachment -> ByteString
content} i
n =
          (Text -> ByteString -> PartM IO
forall (m :: * -> *).
Applicative m =>
Text -> ByteString -> PartM m
partLBS @IO [fmt|files[{n}]|] ByteString
content)
            { partFilename :: Maybe String
partFilename = String -> Maybe String
forall a. a -> Maybe a
Just (Text -> String
T.unpack Text
filename)
            , partContentType :: Maybe MimeType
partContentType = MimeType -> Maybe MimeType
forall a. a -> Maybe a
Just (Text -> MimeType
defaultMimeLookup Text
filename)
            }
        attachmentPart :: CreateMessageAttachment -> Int -> CreateMessageAttachmentJson
attachmentPart CreateMessageAttachment {Text
filename :: Text
$sel:filename:CreateMessageAttachment :: CreateMessageAttachment -> Text
filename, Maybe Text
description :: Maybe Text
$sel:description:CreateMessageAttachment :: CreateMessageAttachment -> Maybe Text
description} Int
n =
          Int -> Text -> Maybe Text -> CreateMessageAttachmentJson
CreateMessageAttachmentJson Int
n Text
filename Maybe Text
description
        files :: [PartM IO]
files = (CreateMessageAttachment -> Int -> PartM IO)
-> [CreateMessageAttachment] -> [Int] -> [PartM IO]
forall a b c. (a -> b -> c) -> [a] -> [b] -> [c]
zipWith CreateMessageAttachment -> Int -> PartM IO
forall i.
FormatAny2 (PyFClassify i) i 'AlignAll =>
CreateMessageAttachment -> i -> PartM IO
filePart ([CreateMessageAttachment]
-> Maybe [CreateMessageAttachment] -> [CreateMessageAttachment]
forall a. a -> Maybe a -> a
fromMaybe [] (Maybe [CreateMessageAttachment] -> [CreateMessageAttachment])
-> Maybe [CreateMessageAttachment] -> [CreateMessageAttachment]
forall a b. (a -> b) -> a -> b
$ InteractionCallbackMessageOptions
cm InteractionCallbackMessageOptions
-> Getting
     (Maybe [CreateMessageAttachment])
     InteractionCallbackMessageOptions
     (Maybe [CreateMessageAttachment])
-> Maybe [CreateMessageAttachment]
forall s a. s -> Getting a s a -> a
^. IsLabel
  "attachments"
  (Getting
     (Maybe [CreateMessageAttachment])
     InteractionCallbackMessageOptions
     (Maybe [CreateMessageAttachment]))
Getting
  (Maybe [CreateMessageAttachment])
  InteractionCallbackMessageOptions
  (Maybe [CreateMessageAttachment])
#attachments) [(Int
0 :: Int) ..]
        attachments :: Maybe [CreateMessageAttachmentJson]
attachments = (\[CreateMessageAttachment]
a -> (CreateMessageAttachment -> Int -> CreateMessageAttachmentJson)
-> [CreateMessageAttachment]
-> [Int]
-> [CreateMessageAttachmentJson]
forall a b c. (a -> b -> c) -> [a] -> [b] -> [c]
zipWith CreateMessageAttachment -> Int -> CreateMessageAttachmentJson
attachmentPart [CreateMessageAttachment]
a [Int
0 ..]) ([CreateMessageAttachment] -> [CreateMessageAttachmentJson])
-> Maybe [CreateMessageAttachment]
-> Maybe [CreateMessageAttachmentJson]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> InteractionCallbackMessageOptions
cm InteractionCallbackMessageOptions
-> Getting
     (Maybe [CreateMessageAttachment])
     InteractionCallbackMessageOptions
     (Maybe [CreateMessageAttachment])
-> Maybe [CreateMessageAttachment]
forall s a. s -> Getting a s a -> a
^. IsLabel
  "attachments"
  (Getting
     (Maybe [CreateMessageAttachment])
     InteractionCallbackMessageOptions
     (Maybe [CreateMessageAttachment]))
Getting
  (Maybe [CreateMessageAttachment])
  InteractionCallbackMessageOptions
  (Maybe [CreateMessageAttachment])
#attachments
        ephemeral :: Maybe Int
ephemeral = (\Bool
f -> if Bool
f then Int
1 Int -> Int -> Int
forall a. Bits a => a -> Int -> a
`shiftL` Int
6 else Int
0) (Bool -> Int) -> Maybe Bool -> Maybe Int
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> InteractionCallbackMessageOptions
cm InteractionCallbackMessageOptions
-> Getting
     (Maybe Bool) InteractionCallbackMessageOptions (Maybe Bool)
-> Maybe Bool
forall s a. s -> Getting a s a -> a
^. IsLabel
  "ephemeral"
  (Getting
     (Maybe Bool) InteractionCallbackMessageOptions (Maybe Bool))
Getting (Maybe Bool) InteractionCallbackMessageOptions (Maybe Bool)
#ephemeral
        suppressEmbeds :: Maybe Int
suppressEmbeds = (\Bool
f -> if Bool
f then Int
1 Int -> Int -> Int
forall a. Bits a => a -> Int -> a
`shiftL` Int
2 else Int
0) (Bool -> Int) -> Maybe Bool -> Maybe Int
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> InteractionCallbackMessageOptions
cm InteractionCallbackMessageOptions
-> Getting
     (Maybe Bool) InteractionCallbackMessageOptions (Maybe Bool)
-> Maybe Bool
forall s a. s -> Getting a s a -> a
^. IsLabel
  "suppressEmbeds"
  (Getting
     (Maybe Bool) InteractionCallbackMessageOptions (Maybe Bool))
Getting (Maybe Bool) InteractionCallbackMessageOptions (Maybe Bool)
#suppressEmbeds
        flags :: Maybe Int
flags = Maybe Int -> Maybe Int -> (Int -> Int -> Int) -> Maybe Int
forall a. Maybe a -> Maybe a -> (a -> a -> a) -> Maybe a
foo Maybe Int
ephemeral Maybe Int
suppressEmbeds Int -> Int -> Int
forall a. Bits a => a -> a -> a
(.|.)
        jsonData :: CreateResponseMessageJson
jsonData =
          CreateResponseMessageJson :: Maybe Bool
-> Maybe Text
-> Maybe [Embed]
-> Maybe AllowedMentions
-> Maybe Int
-> Maybe [Component]
-> Maybe [CreateMessageAttachmentJson]
-> CreateResponseMessageJson
CreateResponseMessageJson
            { $sel:content:CreateResponseMessageJson :: Maybe Text
content = InteractionCallbackMessageOptions
cm InteractionCallbackMessageOptions
-> Getting
     (Maybe Text) InteractionCallbackMessageOptions (Maybe Text)
-> Maybe Text
forall s a. s -> Getting a s a -> a
^. IsLabel
  "content"
  (Getting
     (Maybe Text) InteractionCallbackMessageOptions (Maybe Text))
Getting (Maybe Text) InteractionCallbackMessageOptions (Maybe Text)
#content
            , $sel:tts:CreateResponseMessageJson :: Maybe Bool
tts = InteractionCallbackMessageOptions
cm InteractionCallbackMessageOptions
-> Getting
     (Maybe Bool) InteractionCallbackMessageOptions (Maybe Bool)
-> Maybe Bool
forall s a. s -> Getting a s a -> a
^. IsLabel
  "tts"
  (Getting
     (Maybe Bool) InteractionCallbackMessageOptions (Maybe Bool))
Getting (Maybe Bool) InteractionCallbackMessageOptions (Maybe Bool)
#tts
            , $sel:embeds:CreateResponseMessageJson :: Maybe [Embed]
embeds = InteractionCallbackMessageOptions
cm InteractionCallbackMessageOptions
-> Getting
     (Maybe [Embed]) InteractionCallbackMessageOptions (Maybe [Embed])
-> Maybe [Embed]
forall s a. s -> Getting a s a -> a
^. IsLabel
  "embeds"
  (Getting
     (Maybe [Embed]) InteractionCallbackMessageOptions (Maybe [Embed]))
Getting
  (Maybe [Embed]) InteractionCallbackMessageOptions (Maybe [Embed])
#embeds
            , $sel:allowedMentions:CreateResponseMessageJson :: Maybe AllowedMentions
allowedMentions = InteractionCallbackMessageOptions
cm InteractionCallbackMessageOptions
-> Getting
     (Maybe AllowedMentions)
     InteractionCallbackMessageOptions
     (Maybe AllowedMentions)
-> Maybe AllowedMentions
forall s a. s -> Getting a s a -> a
^. IsLabel
  "allowedMentions"
  (Getting
     (Maybe AllowedMentions)
     InteractionCallbackMessageOptions
     (Maybe AllowedMentions))
Getting
  (Maybe AllowedMentions)
  InteractionCallbackMessageOptions
  (Maybe AllowedMentions)
#allowedMentions
            , $sel:components:CreateResponseMessageJson :: Maybe [Component]
components = InteractionCallbackMessageOptions
cm InteractionCallbackMessageOptions
-> Getting
     (Maybe [Component])
     InteractionCallbackMessageOptions
     (Maybe [Component])
-> Maybe [Component]
forall s a. s -> Getting a s a -> a
^. IsLabel
  "components"
  (Getting
     (Maybe [Component])
     InteractionCallbackMessageOptions
     (Maybe [Component]))
Getting
  (Maybe [Component])
  InteractionCallbackMessageOptions
  (Maybe [Component])
#components
            , $sel:attachments:CreateResponseMessageJson :: Maybe [CreateMessageAttachmentJson]
attachments = Maybe [CreateMessageAttachmentJson]
attachments
            , $sel:flags:CreateResponseMessageJson :: Maybe Int
flags = Maybe Int
flags
            }
    ReqBodyMultipart
body <- [PartM IO] -> Req ReqBodyMultipart
forall (m :: * -> *). MonadIO m => [PartM IO] -> m ReqBodyMultipart
reqBodyMultipart (Text -> ByteString -> PartM IO
forall (m :: * -> *).
Applicative m =>
Text -> ByteString -> PartM m
partLBS Text
"payload_json" (CreateResponseMessageJson -> ByteString
forall a. ToJSON a => a -> ByteString
encode CreateResponseMessageJson
jsonData) PartM IO -> [PartM IO] -> [PartM IO]
forall a. a -> [a] -> [a]
: [PartM IO]
files)
    ReqBodyMultipart -> Url 'Https -> Option 'Https -> Req LbsResponse
forall a.
HttpBody a =>
a -> Url 'Https -> Option 'Https -> Req LbsResponse
patchWith' ReqBodyMultipart
body Url 'Https
u Option 'Https
o
  action DeleteFollowupMessage {} = Url 'Https -> Option 'Https -> Req LbsResponse
deleteWith