module TD.Data.GroupCall
(GroupCall(..)) 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
import qualified TD.Data.GroupCallRecentSpeaker as GroupCallRecentSpeaker
data GroupCall
= GroupCall
{ GroupCall -> Maybe Int
_id :: Maybe Int
, GroupCall -> Maybe Text
title :: Maybe T.Text
, GroupCall -> Maybe Int
scheduled_start_date :: Maybe Int
, GroupCall -> Maybe Bool
enabled_start_notification :: Maybe Bool
, GroupCall -> Maybe Bool
is_active :: Maybe Bool
, GroupCall -> Maybe Bool
is_rtmp_stream :: Maybe Bool
, GroupCall -> Maybe Bool
is_joined :: Maybe Bool
, GroupCall -> Maybe Bool
need_rejoin :: Maybe Bool
, GroupCall -> Maybe Bool
can_be_managed :: Maybe Bool
, GroupCall -> Maybe Int
participant_count :: Maybe Int
, GroupCall -> Maybe Bool
has_hidden_listeners :: Maybe Bool
, GroupCall -> Maybe Bool
loaded_all_participants :: Maybe Bool
, GroupCall -> Maybe [GroupCallRecentSpeaker]
recent_speakers :: Maybe [GroupCallRecentSpeaker.GroupCallRecentSpeaker]
, GroupCall -> Maybe Bool
is_my_video_enabled :: Maybe Bool
, GroupCall -> Maybe Bool
is_my_video_paused :: Maybe Bool
, GroupCall -> Maybe Bool
can_enable_video :: Maybe Bool
, GroupCall -> Maybe Bool
mute_new_participants :: Maybe Bool
, GroupCall -> Maybe Bool
can_toggle_mute_new_participants :: Maybe Bool
, GroupCall -> Maybe Int
record_duration :: Maybe Int
, GroupCall -> Maybe Bool
is_video_recorded :: Maybe Bool
, GroupCall -> Maybe Int
duration :: Maybe Int
}
deriving (GroupCall -> GroupCall -> Bool
(GroupCall -> GroupCall -> Bool)
-> (GroupCall -> GroupCall -> Bool) -> Eq GroupCall
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: GroupCall -> GroupCall -> Bool
== :: GroupCall -> GroupCall -> Bool
$c/= :: GroupCall -> GroupCall -> Bool
/= :: GroupCall -> GroupCall -> Bool
Eq, Int -> GroupCall -> ShowS
[GroupCall] -> ShowS
GroupCall -> String
(Int -> GroupCall -> ShowS)
-> (GroupCall -> String)
-> ([GroupCall] -> ShowS)
-> Show GroupCall
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> GroupCall -> ShowS
showsPrec :: Int -> GroupCall -> ShowS
$cshow :: GroupCall -> String
show :: GroupCall -> String
$cshowList :: [GroupCall] -> ShowS
showList :: [GroupCall] -> ShowS
Show)
instance I.ShortShow GroupCall where
shortShow :: GroupCall -> String
shortShow GroupCall
{ _id :: GroupCall -> Maybe Int
_id = Maybe Int
_id_
, title :: GroupCall -> Maybe Text
title = Maybe Text
title_
, scheduled_start_date :: GroupCall -> Maybe Int
scheduled_start_date = Maybe Int
scheduled_start_date_
, enabled_start_notification :: GroupCall -> Maybe Bool
enabled_start_notification = Maybe Bool
enabled_start_notification_
, is_active :: GroupCall -> Maybe Bool
is_active = Maybe Bool
is_active_
, is_rtmp_stream :: GroupCall -> Maybe Bool
is_rtmp_stream = Maybe Bool
is_rtmp_stream_
, is_joined :: GroupCall -> Maybe Bool
is_joined = Maybe Bool
is_joined_
, need_rejoin :: GroupCall -> Maybe Bool
need_rejoin = Maybe Bool
need_rejoin_
, can_be_managed :: GroupCall -> Maybe Bool
can_be_managed = Maybe Bool
can_be_managed_
, participant_count :: GroupCall -> Maybe Int
participant_count = Maybe Int
participant_count_
, has_hidden_listeners :: GroupCall -> Maybe Bool
has_hidden_listeners = Maybe Bool
has_hidden_listeners_
, loaded_all_participants :: GroupCall -> Maybe Bool
loaded_all_participants = Maybe Bool
loaded_all_participants_
, recent_speakers :: GroupCall -> Maybe [GroupCallRecentSpeaker]
recent_speakers = Maybe [GroupCallRecentSpeaker]
recent_speakers_
, is_my_video_enabled :: GroupCall -> Maybe Bool
is_my_video_enabled = Maybe Bool
is_my_video_enabled_
, is_my_video_paused :: GroupCall -> Maybe Bool
is_my_video_paused = Maybe Bool
is_my_video_paused_
, can_enable_video :: GroupCall -> Maybe Bool
can_enable_video = Maybe Bool
can_enable_video_
, mute_new_participants :: GroupCall -> Maybe Bool
mute_new_participants = Maybe Bool
mute_new_participants_
, can_toggle_mute_new_participants :: GroupCall -> Maybe Bool
can_toggle_mute_new_participants = Maybe Bool
can_toggle_mute_new_participants_
, record_duration :: GroupCall -> Maybe Int
record_duration = Maybe Int
record_duration_
, is_video_recorded :: GroupCall -> Maybe Bool
is_video_recorded = Maybe Bool
is_video_recorded_
, duration :: GroupCall -> Maybe Int
duration = Maybe Int
duration_
}
= String
"GroupCall"
String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
[ String
"_id" String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
_id_
, String
"title" String -> Maybe Text -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Text
title_
, String
"scheduled_start_date" String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
scheduled_start_date_
, String
"enabled_start_notification" String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
enabled_start_notification_
, String
"is_active" String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
is_active_
, String
"is_rtmp_stream" String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
is_rtmp_stream_
, String
"is_joined" String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
is_joined_
, String
"need_rejoin" String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
need_rejoin_
, String
"can_be_managed" String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
can_be_managed_
, String
"participant_count" String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
participant_count_
, String
"has_hidden_listeners" String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
has_hidden_listeners_
, String
"loaded_all_participants" String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
loaded_all_participants_
, String
"recent_speakers" String -> Maybe [GroupCallRecentSpeaker] -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe [GroupCallRecentSpeaker]
recent_speakers_
, String
"is_my_video_enabled" String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
is_my_video_enabled_
, String
"is_my_video_paused" String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
is_my_video_paused_
, String
"can_enable_video" String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
can_enable_video_
, String
"mute_new_participants" String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
mute_new_participants_
, String
"can_toggle_mute_new_participants" String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
can_toggle_mute_new_participants_
, String
"record_duration" String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
record_duration_
, String
"is_video_recorded" String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
is_video_recorded_
, String
"duration" String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
duration_
]
instance AT.FromJSON GroupCall where
parseJSON :: Value -> Parser GroupCall
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
"groupCall" -> Value -> Parser GroupCall
parseGroupCall Value
v
String
_ -> Parser GroupCall
forall a. Monoid a => a
mempty
where
parseGroupCall :: A.Value -> AT.Parser GroupCall
parseGroupCall :: Value -> Parser GroupCall
parseGroupCall = String -> (Object -> Parser GroupCall) -> Value -> Parser GroupCall
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"GroupCall" ((Object -> Parser GroupCall) -> Value -> Parser GroupCall)
-> (Object -> Parser GroupCall) -> Value -> Parser GroupCall
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
Maybe Int
_id_ <- Object
o Object -> Key -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"id"
Maybe Text
title_ <- Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"title"
Maybe Int
scheduled_start_date_ <- Object
o Object -> Key -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"scheduled_start_date"
Maybe Bool
enabled_start_notification_ <- Object
o Object -> Key -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"enabled_start_notification"
Maybe Bool
is_active_ <- Object
o Object -> Key -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"is_active"
Maybe Bool
is_rtmp_stream_ <- Object
o Object -> Key -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"is_rtmp_stream"
Maybe Bool
is_joined_ <- Object
o Object -> Key -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"is_joined"
Maybe Bool
need_rejoin_ <- Object
o Object -> Key -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"need_rejoin"
Maybe Bool
can_be_managed_ <- Object
o Object -> Key -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"can_be_managed"
Maybe Int
participant_count_ <- Object
o Object -> Key -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"participant_count"
Maybe Bool
has_hidden_listeners_ <- Object
o Object -> Key -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"has_hidden_listeners"
Maybe Bool
loaded_all_participants_ <- Object
o Object -> Key -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"loaded_all_participants"
Maybe [GroupCallRecentSpeaker]
recent_speakers_ <- Object
o Object -> Key -> Parser (Maybe [GroupCallRecentSpeaker])
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"recent_speakers"
Maybe Bool
is_my_video_enabled_ <- Object
o Object -> Key -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"is_my_video_enabled"
Maybe Bool
is_my_video_paused_ <- Object
o Object -> Key -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"is_my_video_paused"
Maybe Bool
can_enable_video_ <- Object
o Object -> Key -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"can_enable_video"
Maybe Bool
mute_new_participants_ <- Object
o Object -> Key -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"mute_new_participants"
Maybe Bool
can_toggle_mute_new_participants_ <- Object
o Object -> Key -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"can_toggle_mute_new_participants"
Maybe Int
record_duration_ <- Object
o Object -> Key -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"record_duration"
Maybe Bool
is_video_recorded_ <- Object
o Object -> Key -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"is_video_recorded"
Maybe Int
duration_ <- Object
o Object -> Key -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"duration"
GroupCall -> Parser GroupCall
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (GroupCall -> Parser GroupCall) -> GroupCall -> Parser GroupCall
forall a b. (a -> b) -> a -> b
$ GroupCall
{ _id :: Maybe Int
_id = Maybe Int
_id_
, title :: Maybe Text
title = Maybe Text
title_
, scheduled_start_date :: Maybe Int
scheduled_start_date = Maybe Int
scheduled_start_date_
, enabled_start_notification :: Maybe Bool
enabled_start_notification = Maybe Bool
enabled_start_notification_
, is_active :: Maybe Bool
is_active = Maybe Bool
is_active_
, is_rtmp_stream :: Maybe Bool
is_rtmp_stream = Maybe Bool
is_rtmp_stream_
, is_joined :: Maybe Bool
is_joined = Maybe Bool
is_joined_
, need_rejoin :: Maybe Bool
need_rejoin = Maybe Bool
need_rejoin_
, can_be_managed :: Maybe Bool
can_be_managed = Maybe Bool
can_be_managed_
, participant_count :: Maybe Int
participant_count = Maybe Int
participant_count_
, has_hidden_listeners :: Maybe Bool
has_hidden_listeners = Maybe Bool
has_hidden_listeners_
, loaded_all_participants :: Maybe Bool
loaded_all_participants = Maybe Bool
loaded_all_participants_
, recent_speakers :: Maybe [GroupCallRecentSpeaker]
recent_speakers = Maybe [GroupCallRecentSpeaker]
recent_speakers_
, is_my_video_enabled :: Maybe Bool
is_my_video_enabled = Maybe Bool
is_my_video_enabled_
, is_my_video_paused :: Maybe Bool
is_my_video_paused = Maybe Bool
is_my_video_paused_
, can_enable_video :: Maybe Bool
can_enable_video = Maybe Bool
can_enable_video_
, mute_new_participants :: Maybe Bool
mute_new_participants = Maybe Bool
mute_new_participants_
, can_toggle_mute_new_participants :: Maybe Bool
can_toggle_mute_new_participants = Maybe Bool
can_toggle_mute_new_participants_
, record_duration :: Maybe Int
record_duration = Maybe Int
record_duration_
, is_video_recorded :: Maybe Bool
is_video_recorded = Maybe Bool
is_video_recorded_
, duration :: Maybe Int
duration = Maybe Int
duration_
}
parseJSON Value
_ = Parser GroupCall
forall a. Monoid a => a
mempty