{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE TypeOperators #-}
module Telegram.Bot.API.Methods.SetMyDescription where

import Data.Aeson (FromJSON (..), ToJSON (..))
import Data.Proxy
import GHC.Generics (Generic)
import Data.Text (Text)
import Servant.API
import Servant.Client hiding (Response)

import Telegram.Bot.API.Internal.Utils
import Telegram.Bot.API.MakingRequests
import Telegram.Bot.API.Internal.TH

-- ** 'setMyDescription'

data SetMyDescriptionRequest = SetMyDescriptionRequest
  { SetMyDescriptionRequest -> Maybe Text
setMyDescriptionDescription  :: Maybe Text -- ^ New bot description; 0-512 characters. Pass an empty string to remove the dedicated description for the given language.
  , SetMyDescriptionRequest -> Maybe Text
setMyDescriptionLanguageCode :: Maybe Text -- ^ A two-letter ISO 639-1 language code. If empty, the description will be applied to all users for whose language there is no dedicated description.
  }
  deriving (forall x.
 SetMyDescriptionRequest -> Rep SetMyDescriptionRequest x)
-> (forall x.
    Rep SetMyDescriptionRequest x -> SetMyDescriptionRequest)
-> Generic SetMyDescriptionRequest
forall x. Rep SetMyDescriptionRequest x -> SetMyDescriptionRequest
forall x. SetMyDescriptionRequest -> Rep SetMyDescriptionRequest x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SetMyDescriptionRequest x -> SetMyDescriptionRequest
$cfrom :: forall x. SetMyDescriptionRequest -> Rep SetMyDescriptionRequest x
Generic

instance ToJSON   SetMyDescriptionRequest where toJSON :: SetMyDescriptionRequest -> Value
toJSON = SetMyDescriptionRequest -> Value
forall a (d :: Meta) (f :: * -> *).
(Generic a, GToJSON Zero (Rep a), Rep a ~ D1 d f, Datatype d) =>
a -> Value
gtoJSON
instance FromJSON SetMyDescriptionRequest where parseJSON :: Value -> Parser SetMyDescriptionRequest
parseJSON = Value -> Parser SetMyDescriptionRequest
forall a (d :: Meta) (f :: * -> *).
(Generic a, GFromJSON Zero (Rep a), Rep a ~ D1 d f, Datatype d) =>
Value -> Parser a
gparseJSON

type SetMyDescription = "setMyDescription"
  :> ReqBody '[JSON] SetMyDescriptionRequest
  :> Post '[JSON] (Response Bool)

-- | Use this method to change the bot's description,
--   which is shown in the chat with the bot if the chat is empty.
--   Returns 'True' on success.
setMyDescription :: SetMyDescriptionRequest -> ClientM (Response Bool)
setMyDescription :: SetMyDescriptionRequest -> ClientM (Response Bool)
setMyDescription = Proxy SetMyDescription -> Client ClientM SetMyDescription
forall api.
HasClient ClientM api =>
Proxy api -> Client ClientM api
client (Proxy SetMyDescription
forall k (t :: k). Proxy t
Proxy @SetMyDescription)

makeDefault ''SetMyDescriptionRequest