module TD.Data.GroupCallParticipant
(GroupCallParticipant(..)) where
import qualified Data.Aeson as A
import qualified Data.Aeson.Types as AT
import qualified TD.Lib.Internal as I
import qualified TD.Data.MessageSender as MessageSender
import qualified TD.Data.GroupCallParticipantVideoInfo as GroupCallParticipantVideoInfo
import qualified Data.Text as T
data GroupCallParticipant
= GroupCallParticipant
{ GroupCallParticipant -> Maybe MessageSender
participant_id :: Maybe MessageSender.MessageSender
, GroupCallParticipant -> Maybe Int
audio_source_id :: Maybe Int
, GroupCallParticipant -> Maybe Int
screen_sharing_audio_source_id :: Maybe Int
, GroupCallParticipant -> Maybe GroupCallParticipantVideoInfo
video_info :: Maybe GroupCallParticipantVideoInfo.GroupCallParticipantVideoInfo
, GroupCallParticipant -> Maybe GroupCallParticipantVideoInfo
screen_sharing_video_info :: Maybe GroupCallParticipantVideoInfo.GroupCallParticipantVideoInfo
, GroupCallParticipant -> Maybe Text
bio :: Maybe T.Text
, GroupCallParticipant -> Maybe Bool
is_current_user :: Maybe Bool
, GroupCallParticipant -> Maybe Bool
is_speaking :: Maybe Bool
, GroupCallParticipant -> Maybe Bool
is_hand_raised :: Maybe Bool
, GroupCallParticipant -> Maybe Bool
can_be_muted_for_all_users :: Maybe Bool
, GroupCallParticipant -> Maybe Bool
can_be_unmuted_for_all_users :: Maybe Bool
, GroupCallParticipant -> Maybe Bool
can_be_muted_for_current_user :: Maybe Bool
, GroupCallParticipant -> Maybe Bool
can_be_unmuted_for_current_user :: Maybe Bool
, GroupCallParticipant -> Maybe Bool
is_muted_for_all_users :: Maybe Bool
, GroupCallParticipant -> Maybe Bool
is_muted_for_current_user :: Maybe Bool
, GroupCallParticipant -> Maybe Bool
can_unmute_self :: Maybe Bool
, GroupCallParticipant -> Maybe Int
volume_level :: Maybe Int
, GroupCallParticipant -> Maybe Text
order :: Maybe T.Text
}
deriving (GroupCallParticipant -> GroupCallParticipant -> Bool
(GroupCallParticipant -> GroupCallParticipant -> Bool)
-> (GroupCallParticipant -> GroupCallParticipant -> Bool)
-> Eq GroupCallParticipant
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: GroupCallParticipant -> GroupCallParticipant -> Bool
== :: GroupCallParticipant -> GroupCallParticipant -> Bool
$c/= :: GroupCallParticipant -> GroupCallParticipant -> Bool
/= :: GroupCallParticipant -> GroupCallParticipant -> Bool
Eq, Int -> GroupCallParticipant -> ShowS
[GroupCallParticipant] -> ShowS
GroupCallParticipant -> String
(Int -> GroupCallParticipant -> ShowS)
-> (GroupCallParticipant -> String)
-> ([GroupCallParticipant] -> ShowS)
-> Show GroupCallParticipant
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> GroupCallParticipant -> ShowS
showsPrec :: Int -> GroupCallParticipant -> ShowS
$cshow :: GroupCallParticipant -> String
show :: GroupCallParticipant -> String
$cshowList :: [GroupCallParticipant] -> ShowS
showList :: [GroupCallParticipant] -> ShowS
Show)
instance I.ShortShow GroupCallParticipant where
shortShow :: GroupCallParticipant -> String
shortShow GroupCallParticipant
{ participant_id :: GroupCallParticipant -> Maybe MessageSender
participant_id = Maybe MessageSender
participant_id_
, audio_source_id :: GroupCallParticipant -> Maybe Int
audio_source_id = Maybe Int
audio_source_id_
, screen_sharing_audio_source_id :: GroupCallParticipant -> Maybe Int
screen_sharing_audio_source_id = Maybe Int
screen_sharing_audio_source_id_
, video_info :: GroupCallParticipant -> Maybe GroupCallParticipantVideoInfo
video_info = Maybe GroupCallParticipantVideoInfo
video_info_
, screen_sharing_video_info :: GroupCallParticipant -> Maybe GroupCallParticipantVideoInfo
screen_sharing_video_info = Maybe GroupCallParticipantVideoInfo
screen_sharing_video_info_
, bio :: GroupCallParticipant -> Maybe Text
bio = Maybe Text
bio_
, is_current_user :: GroupCallParticipant -> Maybe Bool
is_current_user = Maybe Bool
is_current_user_
, is_speaking :: GroupCallParticipant -> Maybe Bool
is_speaking = Maybe Bool
is_speaking_
, is_hand_raised :: GroupCallParticipant -> Maybe Bool
is_hand_raised = Maybe Bool
is_hand_raised_
, can_be_muted_for_all_users :: GroupCallParticipant -> Maybe Bool
can_be_muted_for_all_users = Maybe Bool
can_be_muted_for_all_users_
, can_be_unmuted_for_all_users :: GroupCallParticipant -> Maybe Bool
can_be_unmuted_for_all_users = Maybe Bool
can_be_unmuted_for_all_users_
, can_be_muted_for_current_user :: GroupCallParticipant -> Maybe Bool
can_be_muted_for_current_user = Maybe Bool
can_be_muted_for_current_user_
, can_be_unmuted_for_current_user :: GroupCallParticipant -> Maybe Bool
can_be_unmuted_for_current_user = Maybe Bool
can_be_unmuted_for_current_user_
, is_muted_for_all_users :: GroupCallParticipant -> Maybe Bool
is_muted_for_all_users = Maybe Bool
is_muted_for_all_users_
, is_muted_for_current_user :: GroupCallParticipant -> Maybe Bool
is_muted_for_current_user = Maybe Bool
is_muted_for_current_user_
, can_unmute_self :: GroupCallParticipant -> Maybe Bool
can_unmute_self = Maybe Bool
can_unmute_self_
, volume_level :: GroupCallParticipant -> Maybe Int
volume_level = Maybe Int
volume_level_
, order :: GroupCallParticipant -> Maybe Text
order = Maybe Text
order_
}
= String
"GroupCallParticipant"
String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
[ String
"participant_id" String -> Maybe MessageSender -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe MessageSender
participant_id_
, String
"audio_source_id" String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
audio_source_id_
, String
"screen_sharing_audio_source_id" String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
screen_sharing_audio_source_id_
, String
"video_info" String -> Maybe GroupCallParticipantVideoInfo -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe GroupCallParticipantVideoInfo
video_info_
, String
"screen_sharing_video_info" String -> Maybe GroupCallParticipantVideoInfo -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe GroupCallParticipantVideoInfo
screen_sharing_video_info_
, String
"bio" String -> Maybe Text -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Text
bio_
, String
"is_current_user" String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
is_current_user_
, String
"is_speaking" String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
is_speaking_
, String
"is_hand_raised" String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
is_hand_raised_
, String
"can_be_muted_for_all_users" String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
can_be_muted_for_all_users_
, String
"can_be_unmuted_for_all_users" String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
can_be_unmuted_for_all_users_
, String
"can_be_muted_for_current_user" String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
can_be_muted_for_current_user_
, String
"can_be_unmuted_for_current_user" String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
can_be_unmuted_for_current_user_
, String
"is_muted_for_all_users" String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
is_muted_for_all_users_
, String
"is_muted_for_current_user" String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
is_muted_for_current_user_
, String
"can_unmute_self" String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
can_unmute_self_
, String
"volume_level" String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
volume_level_
, String
"order" String -> Maybe Text -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Text
order_
]
instance AT.FromJSON GroupCallParticipant where
parseJSON :: Value -> Parser GroupCallParticipant
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
"groupCallParticipant" -> Value -> Parser GroupCallParticipant
parseGroupCallParticipant Value
v
String
_ -> Parser GroupCallParticipant
forall a. Monoid a => a
mempty
where
parseGroupCallParticipant :: A.Value -> AT.Parser GroupCallParticipant
parseGroupCallParticipant :: Value -> Parser GroupCallParticipant
parseGroupCallParticipant = String
-> (Object -> Parser GroupCallParticipant)
-> Value
-> Parser GroupCallParticipant
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"GroupCallParticipant" ((Object -> Parser GroupCallParticipant)
-> Value -> Parser GroupCallParticipant)
-> (Object -> Parser GroupCallParticipant)
-> Value
-> Parser GroupCallParticipant
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
Maybe MessageSender
participant_id_ <- Object
o Object -> Key -> Parser (Maybe MessageSender)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"participant_id"
Maybe Int
audio_source_id_ <- Object
o Object -> Key -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"audio_source_id"
Maybe Int
screen_sharing_audio_source_id_ <- Object
o Object -> Key -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"screen_sharing_audio_source_id"
Maybe GroupCallParticipantVideoInfo
video_info_ <- Object
o Object -> Key -> Parser (Maybe GroupCallParticipantVideoInfo)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"video_info"
Maybe GroupCallParticipantVideoInfo
screen_sharing_video_info_ <- Object
o Object -> Key -> Parser (Maybe GroupCallParticipantVideoInfo)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"screen_sharing_video_info"
Maybe Text
bio_ <- Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"bio"
Maybe Bool
is_current_user_ <- Object
o Object -> Key -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"is_current_user"
Maybe Bool
is_speaking_ <- Object
o Object -> Key -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"is_speaking"
Maybe Bool
is_hand_raised_ <- Object
o Object -> Key -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"is_hand_raised"
Maybe Bool
can_be_muted_for_all_users_ <- Object
o Object -> Key -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"can_be_muted_for_all_users"
Maybe Bool
can_be_unmuted_for_all_users_ <- Object
o Object -> Key -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"can_be_unmuted_for_all_users"
Maybe Bool
can_be_muted_for_current_user_ <- Object
o Object -> Key -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"can_be_muted_for_current_user"
Maybe Bool
can_be_unmuted_for_current_user_ <- Object
o Object -> Key -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"can_be_unmuted_for_current_user"
Maybe Bool
is_muted_for_all_users_ <- Object
o Object -> Key -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"is_muted_for_all_users"
Maybe Bool
is_muted_for_current_user_ <- Object
o Object -> Key -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"is_muted_for_current_user"
Maybe Bool
can_unmute_self_ <- Object
o Object -> Key -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"can_unmute_self"
Maybe Int
volume_level_ <- Object
o Object -> Key -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"volume_level"
Maybe Text
order_ <- Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"order"
GroupCallParticipant -> Parser GroupCallParticipant
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (GroupCallParticipant -> Parser GroupCallParticipant)
-> GroupCallParticipant -> Parser GroupCallParticipant
forall a b. (a -> b) -> a -> b
$ GroupCallParticipant
{ participant_id :: Maybe MessageSender
participant_id = Maybe MessageSender
participant_id_
, audio_source_id :: Maybe Int
audio_source_id = Maybe Int
audio_source_id_
, screen_sharing_audio_source_id :: Maybe Int
screen_sharing_audio_source_id = Maybe Int
screen_sharing_audio_source_id_
, video_info :: Maybe GroupCallParticipantVideoInfo
video_info = Maybe GroupCallParticipantVideoInfo
video_info_
, screen_sharing_video_info :: Maybe GroupCallParticipantVideoInfo
screen_sharing_video_info = Maybe GroupCallParticipantVideoInfo
screen_sharing_video_info_
, bio :: Maybe Text
bio = Maybe Text
bio_
, is_current_user :: Maybe Bool
is_current_user = Maybe Bool
is_current_user_
, is_speaking :: Maybe Bool
is_speaking = Maybe Bool
is_speaking_
, is_hand_raised :: Maybe Bool
is_hand_raised = Maybe Bool
is_hand_raised_
, can_be_muted_for_all_users :: Maybe Bool
can_be_muted_for_all_users = Maybe Bool
can_be_muted_for_all_users_
, can_be_unmuted_for_all_users :: Maybe Bool
can_be_unmuted_for_all_users = Maybe Bool
can_be_unmuted_for_all_users_
, can_be_muted_for_current_user :: Maybe Bool
can_be_muted_for_current_user = Maybe Bool
can_be_muted_for_current_user_
, can_be_unmuted_for_current_user :: Maybe Bool
can_be_unmuted_for_current_user = Maybe Bool
can_be_unmuted_for_current_user_
, is_muted_for_all_users :: Maybe Bool
is_muted_for_all_users = Maybe Bool
is_muted_for_all_users_
, is_muted_for_current_user :: Maybe Bool
is_muted_for_current_user = Maybe Bool
is_muted_for_current_user_
, can_unmute_self :: Maybe Bool
can_unmute_self = Maybe Bool
can_unmute_self_
, volume_level :: Maybe Int
volume_level = Maybe Int
volume_level_
, order :: Maybe Text
order = Maybe Text
order_
}
parseJSON Value
_ = Parser GroupCallParticipant
forall a. Monoid a => a
mempty