module TD.Data.GroupCallVideoSourceGroup
(GroupCallVideoSourceGroup(..)) where
import qualified Data.Aeson as A
import qualified Data.Aeson.Types as AT
import qualified TD.Lib.Internal as I
import qualified Data.Text as T
data GroupCallVideoSourceGroup
= GroupCallVideoSourceGroup
{ GroupCallVideoSourceGroup -> Maybe Text
semantics :: Maybe T.Text
, GroupCallVideoSourceGroup -> Maybe [Int]
source_ids :: Maybe [Int]
}
deriving (GroupCallVideoSourceGroup -> GroupCallVideoSourceGroup -> Bool
(GroupCallVideoSourceGroup -> GroupCallVideoSourceGroup -> Bool)
-> (GroupCallVideoSourceGroup -> GroupCallVideoSourceGroup -> Bool)
-> Eq GroupCallVideoSourceGroup
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: GroupCallVideoSourceGroup -> GroupCallVideoSourceGroup -> Bool
== :: GroupCallVideoSourceGroup -> GroupCallVideoSourceGroup -> Bool
$c/= :: GroupCallVideoSourceGroup -> GroupCallVideoSourceGroup -> Bool
/= :: GroupCallVideoSourceGroup -> GroupCallVideoSourceGroup -> Bool
Eq, Int -> GroupCallVideoSourceGroup -> ShowS
[GroupCallVideoSourceGroup] -> ShowS
GroupCallVideoSourceGroup -> String
(Int -> GroupCallVideoSourceGroup -> ShowS)
-> (GroupCallVideoSourceGroup -> String)
-> ([GroupCallVideoSourceGroup] -> ShowS)
-> Show GroupCallVideoSourceGroup
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> GroupCallVideoSourceGroup -> ShowS
showsPrec :: Int -> GroupCallVideoSourceGroup -> ShowS
$cshow :: GroupCallVideoSourceGroup -> String
show :: GroupCallVideoSourceGroup -> String
$cshowList :: [GroupCallVideoSourceGroup] -> ShowS
showList :: [GroupCallVideoSourceGroup] -> ShowS
Show)
instance I.ShortShow GroupCallVideoSourceGroup where
shortShow :: GroupCallVideoSourceGroup -> String
shortShow GroupCallVideoSourceGroup
{ semantics :: GroupCallVideoSourceGroup -> Maybe Text
semantics = Maybe Text
semantics_
, source_ids :: GroupCallVideoSourceGroup -> Maybe [Int]
source_ids = Maybe [Int]
source_ids_
}
= String
"GroupCallVideoSourceGroup"
String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
[ String
"semantics" String -> Maybe Text -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Text
semantics_
, String
"source_ids" String -> Maybe [Int] -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe [Int]
source_ids_
]
instance AT.FromJSON GroupCallVideoSourceGroup where
parseJSON :: Value -> Parser GroupCallVideoSourceGroup
parseJSON v :: Value
v@(AT.Object Object
obj) = do
String
t <- Object
obj Object -> Key -> Parser String
forall a. FromJSON a => Object -> Key -> Parser a
A..: Key
"@type" :: AT.Parser String
case String
t of
String
"groupCallVideoSourceGroup" -> Value -> Parser GroupCallVideoSourceGroup
parseGroupCallVideoSourceGroup Value
v
String
_ -> Parser GroupCallVideoSourceGroup
forall a. Monoid a => a
mempty
where
parseGroupCallVideoSourceGroup :: A.Value -> AT.Parser GroupCallVideoSourceGroup
parseGroupCallVideoSourceGroup :: Value -> Parser GroupCallVideoSourceGroup
parseGroupCallVideoSourceGroup = String
-> (Object -> Parser GroupCallVideoSourceGroup)
-> Value
-> Parser GroupCallVideoSourceGroup
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"GroupCallVideoSourceGroup" ((Object -> Parser GroupCallVideoSourceGroup)
-> Value -> Parser GroupCallVideoSourceGroup)
-> (Object -> Parser GroupCallVideoSourceGroup)
-> Value
-> Parser GroupCallVideoSourceGroup
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
Maybe Text
semantics_ <- Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"semantics"
Maybe [Int]
source_ids_ <- Object
o Object -> Key -> Parser (Maybe [Int])
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"source_ids"
GroupCallVideoSourceGroup -> Parser GroupCallVideoSourceGroup
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (GroupCallVideoSourceGroup -> Parser GroupCallVideoSourceGroup)
-> GroupCallVideoSourceGroup -> Parser GroupCallVideoSourceGroup
forall a b. (a -> b) -> a -> b
$ GroupCallVideoSourceGroup
{ semantics :: Maybe Text
semantics = Maybe Text
semantics_
, source_ids :: Maybe [Int]
source_ids = Maybe [Int]
source_ids_
}
parseJSON Value
_ = Parser GroupCallVideoSourceGroup
forall a. Monoid a => a
mempty