module TD.Query.GetUserProfileAudios
  (GetUserProfileAudios(..)
  , defaultGetUserProfileAudios
  ) where

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

-- | Returns the list of profile audio files of a user. Returns 'TD.Data.Audios.Audios'
data GetUserProfileAudios
  = GetUserProfileAudios
    { GetUserProfileAudios -> Maybe Int
user_id :: Maybe Int -- ^ User identifier
    , GetUserProfileAudios -> Maybe Int
offset  :: Maybe Int -- ^ The number of audio files to skip; must be non-negative
    , GetUserProfileAudios -> Maybe Int
limit   :: Maybe Int -- ^ The maximum number of audio files to be returned; up to 100
    }
  deriving (GetUserProfileAudios -> GetUserProfileAudios -> Bool
(GetUserProfileAudios -> GetUserProfileAudios -> Bool)
-> (GetUserProfileAudios -> GetUserProfileAudios -> Bool)
-> Eq GetUserProfileAudios
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: GetUserProfileAudios -> GetUserProfileAudios -> Bool
== :: GetUserProfileAudios -> GetUserProfileAudios -> Bool
$c/= :: GetUserProfileAudios -> GetUserProfileAudios -> Bool
/= :: GetUserProfileAudios -> GetUserProfileAudios -> Bool
Eq, Int -> GetUserProfileAudios -> ShowS
[GetUserProfileAudios] -> ShowS
GetUserProfileAudios -> String
(Int -> GetUserProfileAudios -> ShowS)
-> (GetUserProfileAudios -> String)
-> ([GetUserProfileAudios] -> ShowS)
-> Show GetUserProfileAudios
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> GetUserProfileAudios -> ShowS
showsPrec :: Int -> GetUserProfileAudios -> ShowS
$cshow :: GetUserProfileAudios -> String
show :: GetUserProfileAudios -> String
$cshowList :: [GetUserProfileAudios] -> ShowS
showList :: [GetUserProfileAudios] -> ShowS
Show)

instance I.ShortShow GetUserProfileAudios where
  shortShow :: GetUserProfileAudios -> String
shortShow
    GetUserProfileAudios
      { user_id :: GetUserProfileAudios -> Maybe Int
user_id = Maybe Int
user_id_
      , offset :: GetUserProfileAudios -> Maybe Int
offset  = Maybe Int
offset_
      , limit :: GetUserProfileAudios -> Maybe Int
limit   = Maybe Int
limit_
      }
        = String
"GetUserProfileAudios"
          String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
          [ String
"user_id" String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
user_id_
          , String
"offset"  String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
offset_
          , String
"limit"   String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
limit_
          ]

instance AT.ToJSON GetUserProfileAudios where
  toJSON :: GetUserProfileAudios -> Value
toJSON
    GetUserProfileAudios
      { user_id :: GetUserProfileAudios -> Maybe Int
user_id = Maybe Int
user_id_
      , offset :: GetUserProfileAudios -> Maybe Int
offset  = Maybe Int
offset_
      , limit :: GetUserProfileAudios -> 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
"getUserProfileAudios"
          , Key
"user_id" Key -> Maybe Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Int
user_id_
          , Key
"offset"  Key -> Maybe Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Int
offset_
          , 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_
          ]

defaultGetUserProfileAudios :: GetUserProfileAudios
defaultGetUserProfileAudios :: GetUserProfileAudios
defaultGetUserProfileAudios =
  GetUserProfileAudios
    { user_id :: Maybe Int
user_id = Maybe Int
forall a. Maybe a
Nothing
    , offset :: Maybe Int
offset  = Maybe Int
forall a. Maybe a
Nothing
    , limit :: Maybe Int
limit   = Maybe Int
forall a. Maybe a
Nothing
    }