module Calamity.HTTP.Invite (InviteRequest (..)) where
import Calamity.HTTP.Internal.Request
import Calamity.HTTP.Internal.Route
import Calamity.Types.Model.Guild
import Control.Lens hiding ((.=))
import Data.Text (Text)
import Network.HTTP.Req
data InviteRequest a where
GetInvite :: Text -> InviteRequest Invite
DeleteInvite :: Text -> InviteRequest ()
baseRoute :: RouteBuilder _
baseRoute :: RouteBuilder '[]
baseRoute = RouteBuilder '[]
mkRouteBuilder RouteBuilder '[] -> S -> ConsRes S '[]
forall a (reqs :: [(RequirementType, RouteRequirement)]).
RouteFragmentable a reqs =>
RouteBuilder reqs -> a -> ConsRes a reqs
// Text -> S
S Text
"invites"
instance Request (InviteRequest a) where
type Result (InviteRequest a) = a
route :: InviteRequest a -> Route
route (GetInvite Text
c) =
RouteBuilder '[]
baseRoute RouteBuilder '[] -> PS "invite" -> ConsRes (PS "invite") '[]
forall a (reqs :: [(RequirementType, RouteRequirement)]).
RouteFragmentable a reqs =>
RouteBuilder reqs -> a -> ConsRes a reqs
// PS "invite"
forall (s :: Symbol). PS s
PS @"invite"
RouteBuilder '[ '( 'PSRequirement "invite", 'Required)]
-> (RouteBuilder '[ '( 'PSRequirement "invite", 'Required)]
-> RouteBuilder
'[ '( 'PSRequirement "invite", 'Satisfied),
'( 'PSRequirement "invite", 'Required)])
-> RouteBuilder
'[ '( 'PSRequirement "invite", 'Satisfied),
'( 'PSRequirement "invite", 'Required)]
forall a b. a -> (a -> b) -> b
& Text
-> RouteBuilder '[ '( 'PSRequirement "invite", 'Required)]
-> RouteBuilder
'[ '( 'PSRequirement "invite", 'Satisfied),
'( 'PSRequirement "invite", 'Required)]
forall (s :: Symbol)
(reqs :: [(RequirementType, RouteRequirement)]).
KnownSymbol s =>
Text
-> RouteBuilder reqs
-> RouteBuilder ('( 'PSRequirement s, 'Satisfied) : reqs)
giveParam @"invite" Text
c
RouteBuilder
'[ '( 'PSRequirement "invite", 'Satisfied),
'( 'PSRequirement "invite", 'Required)]
-> (RouteBuilder
'[ '( 'PSRequirement "invite", 'Satisfied),
'( 'PSRequirement "invite", 'Required)]
-> Route)
-> Route
forall a b. a -> (a -> b) -> b
& RouteBuilder
'[ '( 'PSRequirement "invite", 'Satisfied),
'( 'PSRequirement "invite", 'Required)]
-> Route
forall (reqs :: [(RequirementType, RouteRequirement)]).
EnsureFulfilled reqs =>
RouteBuilder reqs -> Route
buildRoute
route (DeleteInvite Text
c) =
RouteBuilder '[]
baseRoute RouteBuilder '[] -> PS "invite" -> ConsRes (PS "invite") '[]
forall a (reqs :: [(RequirementType, RouteRequirement)]).
RouteFragmentable a reqs =>
RouteBuilder reqs -> a -> ConsRes a reqs
// PS "invite"
forall (s :: Symbol). PS s
PS @"invite"
RouteBuilder '[ '( 'PSRequirement "invite", 'Required)]
-> (RouteBuilder '[ '( 'PSRequirement "invite", 'Required)]
-> RouteBuilder
'[ '( 'PSRequirement "invite", 'Satisfied),
'( 'PSRequirement "invite", 'Required)])
-> RouteBuilder
'[ '( 'PSRequirement "invite", 'Satisfied),
'( 'PSRequirement "invite", 'Required)]
forall a b. a -> (a -> b) -> b
& Text
-> RouteBuilder '[ '( 'PSRequirement "invite", 'Required)]
-> RouteBuilder
'[ '( 'PSRequirement "invite", 'Satisfied),
'( 'PSRequirement "invite", 'Required)]
forall (s :: Symbol)
(reqs :: [(RequirementType, RouteRequirement)]).
KnownSymbol s =>
Text
-> RouteBuilder reqs
-> RouteBuilder ('( 'PSRequirement s, 'Satisfied) : reqs)
giveParam @"invite" Text
c
RouteBuilder
'[ '( 'PSRequirement "invite", 'Satisfied),
'( 'PSRequirement "invite", 'Required)]
-> (RouteBuilder
'[ '( 'PSRequirement "invite", 'Satisfied),
'( 'PSRequirement "invite", 'Required)]
-> Route)
-> Route
forall a b. a -> (a -> b) -> b
& RouteBuilder
'[ '( 'PSRequirement "invite", 'Satisfied),
'( 'PSRequirement "invite", 'Required)]
-> Route
forall (reqs :: [(RequirementType, RouteRequirement)]).
EnsureFulfilled reqs =>
RouteBuilder reqs -> Route
buildRoute
action :: InviteRequest a -> Url 'Https -> Option 'Https -> Req LbsResponse
action (GetInvite Text
_) = Option 'Https -> Url 'Https -> Option 'Https -> Req LbsResponse
getWithP (Text
"with_counts" Text -> Bool -> Option 'Https
forall param a.
(QueryParam param, ToHttpApiData a) =>
Text -> a -> param
=: Bool
True)
action (DeleteInvite Text
_) = Url 'Https -> Option 'Https -> Req LbsResponse
deleteWith