{-# LANGUAGE GADTs #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE MultiWayIf #-}
{-# LANGUAGE InstanceSigs #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE OverloadedStrings #-}
module Discord.Internal.Rest.Invite
( InviteRequest(..)
) where
import Network.HTTP.Req ((/:))
import qualified Network.HTTP.Req as R
import qualified Data.Text as T
import Discord.Internal.Rest.Prelude
import Discord.Internal.Types
instance Request (InviteRequest a) where
majorRoute :: InviteRequest a -> String
majorRoute = forall a. InviteRequest a -> String
inviteMajorRoute
jsonRequest :: InviteRequest a -> JsonRequest
jsonRequest = forall a. InviteRequest a -> JsonRequest
inviteJsonRequest
data InviteRequest a where
GetInvite :: T.Text -> InviteRequest Invite
DeleteInvite :: T.Text -> InviteRequest Invite
inviteMajorRoute :: InviteRequest a -> String
inviteMajorRoute :: forall a. InviteRequest a -> String
inviteMajorRoute InviteRequest a
c = case InviteRequest a
c of
(GetInvite Text
_) -> String
"invite "
(DeleteInvite Text
_) -> String
"invite "
invite :: R.Url 'R.Https
invite :: Url 'Https
invite = Url 'Https
baseUrl forall (scheme :: Scheme). Url scheme -> Text -> Url scheme
/: Text
"invites"
inviteJsonRequest :: InviteRequest r -> JsonRequest
inviteJsonRequest :: forall a. InviteRequest a -> JsonRequest
inviteJsonRequest InviteRequest r
c = case InviteRequest r
c of
(GetInvite Text
g) -> Url 'Https -> Option 'Https -> JsonRequest
Get (Url 'Https
invite forall (scheme :: Scheme). Url scheme -> Text -> Url scheme
R./: Text
g) forall a. Monoid a => a
mempty
(DeleteInvite Text
g) -> Url 'Https -> Option 'Https -> JsonRequest
Delete (Url 'Https
invite forall (scheme :: Scheme). Url scheme -> Text -> Url scheme
R./: Text
g) forall a. Monoid a => a
mempty