-- | Miscellaneous routes
module Calamity.HTTP.MiscRoutes where

import Calamity.HTTP.Internal.Request
import Calamity.HTTP.Internal.Route
import Calamity.HTTP.Internal.Types
import Data.Function ((&))

data MiscRequest a where
  GetGateway :: MiscRequest GatewayResponse
  GetGatewayBot :: MiscRequest BotGatewayResponse

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

  route :: MiscRequest a -> Route
route MiscRequest a
GetGateway =
    RouteBuilder '[]
mkRouteBuilder RouteBuilder '[] -> S -> ConsRes S '[]
forall a (reqs :: [(RequirementType, RouteRequirement)]).
RouteFragmentable a reqs =>
RouteBuilder reqs -> a -> ConsRes a reqs
// Text -> S
S Text
"gateway"
      RouteBuilder '[] -> (RouteBuilder '[] -> Route) -> Route
forall a b. a -> (a -> b) -> b
& RouteBuilder '[] -> Route
forall (reqs :: [(RequirementType, RouteRequirement)]).
EnsureFulfilled reqs =>
RouteBuilder reqs -> Route
buildRoute
  route MiscRequest a
GetGatewayBot =
    RouteBuilder '[]
mkRouteBuilder RouteBuilder '[] -> S -> ConsRes S '[]
forall a (reqs :: [(RequirementType, RouteRequirement)]).
RouteFragmentable a reqs =>
RouteBuilder reqs -> a -> ConsRes a reqs
// Text -> S
S Text
"gateway" RouteBuilder '[] -> S -> ConsRes S '[]
forall a (reqs :: [(RequirementType, RouteRequirement)]).
RouteFragmentable a reqs =>
RouteBuilder reqs -> a -> ConsRes a reqs
// Text -> S
S Text
"bot"
      RouteBuilder '[] -> (RouteBuilder '[] -> Route) -> Route
forall a b. a -> (a -> b) -> b
& RouteBuilder '[] -> Route
forall (reqs :: [(RequirementType, RouteRequirement)]).
EnsureFulfilled reqs =>
RouteBuilder reqs -> Route
buildRoute

  action :: MiscRequest a -> Url 'Https -> Option 'Https -> Req LbsResponse
action MiscRequest a
GetGateway = Url 'Https -> Option 'Https -> Req LbsResponse
getWith
  action MiscRequest a
GetGatewayBot = Url 'Https -> Option 'Https -> Req LbsResponse
getWith