module TD.Query.GetOwnedStickerSets
  (GetOwnedStickerSets(..)
  , defaultGetOwnedStickerSets
  ) where

import qualified Data.Aeson as A
import qualified Data.Aeson.Types as AT
import qualified TD.Lib.Internal as I

-- | Returns sticker sets owned by the current user. Returns 'TD.Data.StickerSets.StickerSets'
data GetOwnedStickerSets
  = GetOwnedStickerSets
    { GetOwnedStickerSets -> Maybe Int
offset_sticker_set_id :: Maybe Int -- ^ Identifier of the sticker set from which to return owned sticker sets; use 0 to get results from the beginning
    , GetOwnedStickerSets -> Maybe Int
limit                 :: Maybe Int -- ^ The maximum number of sticker sets to be returned; must be positive and can't be greater than 100. For optimal performance, the number of returned objects is chosen by TDLib and can be smaller than the specified limit
    }
  deriving (GetOwnedStickerSets -> GetOwnedStickerSets -> Bool
(GetOwnedStickerSets -> GetOwnedStickerSets -> Bool)
-> (GetOwnedStickerSets -> GetOwnedStickerSets -> Bool)
-> Eq GetOwnedStickerSets
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: GetOwnedStickerSets -> GetOwnedStickerSets -> Bool
== :: GetOwnedStickerSets -> GetOwnedStickerSets -> Bool
$c/= :: GetOwnedStickerSets -> GetOwnedStickerSets -> Bool
/= :: GetOwnedStickerSets -> GetOwnedStickerSets -> Bool
Eq, Int -> GetOwnedStickerSets -> ShowS
[GetOwnedStickerSets] -> ShowS
GetOwnedStickerSets -> String
(Int -> GetOwnedStickerSets -> ShowS)
-> (GetOwnedStickerSets -> String)
-> ([GetOwnedStickerSets] -> ShowS)
-> Show GetOwnedStickerSets
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> GetOwnedStickerSets -> ShowS
showsPrec :: Int -> GetOwnedStickerSets -> ShowS
$cshow :: GetOwnedStickerSets -> String
show :: GetOwnedStickerSets -> String
$cshowList :: [GetOwnedStickerSets] -> ShowS
showList :: [GetOwnedStickerSets] -> ShowS
Show)

instance I.ShortShow GetOwnedStickerSets where
  shortShow :: GetOwnedStickerSets -> String
shortShow
    GetOwnedStickerSets
      { offset_sticker_set_id :: GetOwnedStickerSets -> Maybe Int
offset_sticker_set_id = Maybe Int
offset_sticker_set_id_
      , limit :: GetOwnedStickerSets -> Maybe Int
limit                 = Maybe Int
limit_
      }
        = String
"GetOwnedStickerSets"
          String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
          [ String
"offset_sticker_set_id" String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
offset_sticker_set_id_
          , String
"limit"                 String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
limit_
          ]

instance AT.ToJSON GetOwnedStickerSets where
  toJSON :: GetOwnedStickerSets -> Value
toJSON
    GetOwnedStickerSets
      { offset_sticker_set_id :: GetOwnedStickerSets -> Maybe Int
offset_sticker_set_id = Maybe Int
offset_sticker_set_id_
      , limit :: GetOwnedStickerSets -> Maybe Int
limit                 = Maybe Int
limit_
      }
        = [Pair] -> Value
A.object
          [ Key
"@type"                 Key -> Value -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Text -> Value
AT.String Text
"getOwnedStickerSets"
          , Key
"offset_sticker_set_id" Key -> Maybe Value -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= (Int -> Value) -> Maybe Int -> Maybe Value
forall a b. (a -> b) -> Maybe a -> Maybe b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Int -> Value
I.writeInt64  Maybe Int
offset_sticker_set_id_
          , Key
"limit"                 Key -> Maybe Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Int
limit_
          ]

defaultGetOwnedStickerSets :: GetOwnedStickerSets
defaultGetOwnedStickerSets :: GetOwnedStickerSets
defaultGetOwnedStickerSets =
  GetOwnedStickerSets
    { offset_sticker_set_id :: Maybe Int
offset_sticker_set_id = Maybe Int
forall a. Maybe a
Nothing
    , limit :: Maybe Int
limit                 = Maybe Int
forall a. Maybe a
Nothing
    }