{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE TemplateHaskell #-}

----------------------------------------------------------------------

----------------------------------------------------------------------

-- |
-- Module: Web.Slack.Api
-- Description:
module Web.Slack.Api
  ( TestReq (..),
    mkTestReq,
    TestRsp (..),
  )
where

-- FIXME: Web.Slack.Prelude

-- aeson

-- base

-- deepseq
import Control.DeepSeq (NFData)
import Data.Aeson.TH
-- http-api-data

-- slack-web

-- text
import Data.Text (Text)
import GHC.Generics (Generic)
import Web.FormUrlEncoded
import Web.Slack.Util
import Prelude

data TestReq = TestReq
  { TestReq -> Maybe Text
testReqError :: Maybe Text
  , TestReq -> Maybe Text
testReqFoo :: Maybe Text
  }
  deriving stock (TestReq -> TestReq -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TestReq -> TestReq -> Bool
$c/= :: TestReq -> TestReq -> Bool
== :: TestReq -> TestReq -> Bool
$c== :: TestReq -> TestReq -> Bool
Eq, forall x. Rep TestReq x -> TestReq
forall x. TestReq -> Rep TestReq x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep TestReq x -> TestReq
$cfrom :: forall x. TestReq -> Rep TestReq x
Generic, Int -> TestReq -> ShowS
[TestReq] -> ShowS
TestReq -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TestReq] -> ShowS
$cshowList :: [TestReq] -> ShowS
show :: TestReq -> String
$cshow :: TestReq -> String
showsPrec :: Int -> TestReq -> ShowS
$cshowsPrec :: Int -> TestReq -> ShowS
Show)

instance NFData TestReq

$(deriveJSON (jsonOpts "testReq") ''TestReq)

instance ToForm TestReq where
  toForm :: TestReq -> Form
toForm =
    forall a.
(Generic a, GToForm a (Rep a)) =>
FormOptions -> a -> Form
genericToForm (Text -> FormOptions
formOpts Text
"testReq")

mkTestReq :: TestReq
mkTestReq :: TestReq
mkTestReq =
  TestReq
    { testReqError :: Maybe Text
testReqError = forall a. Maybe a
Nothing
    , testReqFoo :: Maybe Text
testReqFoo = forall a. Maybe a
Nothing
    }

data TestRsp = TestRsp
  { TestRsp -> Maybe TestReq
testRspArgs :: Maybe TestReq
  }
  deriving stock (TestRsp -> TestRsp -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TestRsp -> TestRsp -> Bool
$c/= :: TestRsp -> TestRsp -> Bool
== :: TestRsp -> TestRsp -> Bool
$c== :: TestRsp -> TestRsp -> Bool
Eq, forall x. Rep TestRsp x -> TestRsp
forall x. TestRsp -> Rep TestRsp x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep TestRsp x -> TestRsp
$cfrom :: forall x. TestRsp -> Rep TestRsp x
Generic, Int -> TestRsp -> ShowS
[TestRsp] -> ShowS
TestRsp -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TestRsp] -> ShowS
$cshowList :: [TestRsp] -> ShowS
show :: TestRsp -> String
$cshow :: TestRsp -> String
showsPrec :: Int -> TestRsp -> ShowS
$cshowsPrec :: Int -> TestRsp -> ShowS
Show)

instance NFData TestRsp

$(deriveFromJSON (jsonOpts "testRsp") ''TestRsp)