fromJson static method
Returns a new VideoEvent instance and imports its values from
value if it's a Map, null otherwise.
Implementation
// ignore: prefer_constructors_over_static_methods
static VideoEvent? fromJson(dynamic value) {
if (value is Map) {
final json = value.cast<String, dynamic>();
// Ensure that the map contains the required keys.
// Note 1: the values aren't checked for validity beyond being non-null.
// Note 2: this code is stripped in release mode!
assert(() {
assert(json.containsKey(r'app'),
'Required key "VideoEvent[app]" is missing from JSON.');
assert(json[r'app'] != null,
'Required key "VideoEvent[app]" has a null value in JSON.');
assert(json.containsKey(r'created_at'),
'Required key "VideoEvent[created_at]" is missing from JSON.');
assert(json[r'created_at'] != null,
'Required key "VideoEvent[created_at]" has a null value in JSON.');
assert(json.containsKey(r'custom'),
'Required key "VideoEvent[custom]" is missing from JSON.');
assert(json[r'custom'] != null,
'Required key "VideoEvent[custom]" has a null value in JSON.');
assert(json.containsKey(r'type'),
'Required key "VideoEvent[type]" is missing from JSON.');
assert(json[r'type'] != null,
'Required key "VideoEvent[type]" has a null value in JSON.');
assert(json.containsKey(r'call_cid'),
'Required key "VideoEvent[call_cid]" is missing from JSON.');
assert(json[r'call_cid'] != null,
'Required key "VideoEvent[call_cid]" has a null value in JSON.');
assert(json.containsKey(r'user'),
'Required key "VideoEvent[user]" is missing from JSON.');
assert(json[r'user'] != null,
'Required key "VideoEvent[user]" has a null value in JSON.');
assert(json.containsKey(r'call'),
'Required key "VideoEvent[call]" is missing from JSON.');
assert(json[r'call'] != null,
'Required key "VideoEvent[call]" has a null value in JSON.');
assert(json.containsKey(r'members'),
'Required key "VideoEvent[members]" is missing from JSON.');
assert(json[r'members'] != null,
'Required key "VideoEvent[members]" has a null value in JSON.');
assert(json.containsKey(r'digit'),
'Required key "VideoEvent[digit]" is missing from JSON.');
assert(json[r'digit'] != null,
'Required key "VideoEvent[digit]" has a null value in JSON.');
assert(json.containsKey(r'duration_ms'),
'Required key "VideoEvent[duration_ms]" is missing from JSON.');
assert(json[r'duration_ms'] != null,
'Required key "VideoEvent[duration_ms]" has a null value in JSON.');
assert(json.containsKey(r'seq_number'),
'Required key "VideoEvent[seq_number]" is missing from JSON.');
assert(json[r'seq_number'] != null,
'Required key "VideoEvent[seq_number]" has a null value in JSON.');
assert(json.containsKey(r'timestamp'),
'Required key "VideoEvent[timestamp]" is missing from JSON.');
assert(json[r'timestamp'] != null,
'Required key "VideoEvent[timestamp]" has a null value in JSON.');
assert(json.containsKey(r'reason'),
'Required key "VideoEvent[reason]" is missing from JSON.');
assert(json[r'reason'] != null,
'Required key "VideoEvent[reason]" has a null value in JSON.');
assert(json.containsKey(r'egress_id'),
'Required key "VideoEvent[egress_id]" is missing from JSON.');
assert(json[r'egress_id'] != null,
'Required key "VideoEvent[egress_id]" has a null value in JSON.');
assert(json.containsKey(r'captured_at'),
'Required key "VideoEvent[captured_at]" is missing from JSON.');
assert(json[r'captured_at'] != null,
'Required key "VideoEvent[captured_at]" has a null value in JSON.');
assert(json.containsKey(r'session_id'),
'Required key "VideoEvent[session_id]" is missing from JSON.');
assert(json[r'session_id'] != null,
'Required key "VideoEvent[session_id]" has a null value in JSON.');
assert(json.containsKey(r'track_type'),
'Required key "VideoEvent[track_type]" is missing from JSON.');
assert(json[r'track_type'] != null,
'Required key "VideoEvent[track_type]" has a null value in JSON.');
assert(json.containsKey(r'url'),
'Required key "VideoEvent[url]" is missing from JSON.');
assert(json[r'url'] != null,
'Required key "VideoEvent[url]" has a null value in JSON.');
assert(json.containsKey(r'users'),
'Required key "VideoEvent[users]" is missing from JSON.');
assert(json[r'users'] != null,
'Required key "VideoEvent[users]" has a null value in JSON.');
assert(json.containsKey(r'hls_playlist_url'),
'Required key "VideoEvent[hls_playlist_url]" is missing from JSON.');
assert(json[r'hls_playlist_url'] != null,
'Required key "VideoEvent[hls_playlist_url]" has a null value in JSON.');
assert(json.containsKey(r'capabilities_by_role'),
'Required key "VideoEvent[capabilities_by_role]" is missing from JSON.');
assert(json[r'capabilities_by_role'] != null,
'Required key "VideoEvent[capabilities_by_role]" has a null value in JSON.');
assert(json.containsKey(r'notify_user'),
'Required key "VideoEvent[notify_user]" is missing from JSON.');
assert(json[r'notify_user'] != null,
'Required key "VideoEvent[notify_user]" has a null value in JSON.');
assert(json.containsKey(r'user_id'),
'Required key "VideoEvent[user_id]" is missing from JSON.');
assert(json[r'user_id'] != null,
'Required key "VideoEvent[user_id]" has a null value in JSON.');
assert(json.containsKey(r'message'),
'Required key "VideoEvent[message]" is missing from JSON.');
assert(json[r'message'] != null,
'Required key "VideoEvent[message]" has a null value in JSON.');
assert(json.containsKey(r'reaction'),
'Required key "VideoEvent[reaction]" is missing from JSON.');
assert(json[r'reaction'] != null,
'Required key "VideoEvent[reaction]" has a null value in JSON.');
assert(json.containsKey(r'recording_type'),
'Required key "VideoEvent[recording_type]" is missing from JSON.');
assert(json[r'recording_type'] != null,
'Required key "VideoEvent[recording_type]" has a null value in JSON.');
assert(json.containsKey(r'call_recording'),
'Required key "VideoEvent[call_recording]" is missing from JSON.');
assert(json[r'call_recording'] != null,
'Required key "VideoEvent[call_recording]" has a null value in JSON.');
assert(json.containsKey(r'video'),
'Required key "VideoEvent[video]" is missing from JSON.');
assert(json[r'video'] != null,
'Required key "VideoEvent[video]" has a null value in JSON.');
assert(json.containsKey(r'name'),
'Required key "VideoEvent[name]" is missing from JSON.');
assert(json[r'name'] != null,
'Required key "VideoEvent[name]" has a null value in JSON.');
assert(json.containsKey(r'anonymous_participant_count'),
'Required key "VideoEvent[anonymous_participant_count]" is missing from JSON.');
assert(json[r'anonymous_participant_count'] != null,
'Required key "VideoEvent[anonymous_participant_count]" has a null value in JSON.');
assert(json.containsKey(r'participants_count_by_role'),
'Required key "VideoEvent[participants_count_by_role]" is missing from JSON.');
assert(json[r'participants_count_by_role'] != null,
'Required key "VideoEvent[participants_count_by_role]" has a null value in JSON.');
assert(json.containsKey(r'participant'),
'Required key "VideoEvent[participant]" is missing from JSON.');
assert(json[r'participant'] != null,
'Required key "VideoEvent[participant]" has a null value in JSON.');
assert(json.containsKey(r'duration_seconds'),
'Required key "VideoEvent[duration_seconds]" is missing from JSON.');
assert(json[r'duration_seconds'] != null,
'Required key "VideoEvent[duration_seconds]" has a null value in JSON.');
assert(json.containsKey(r'error'),
'Required key "VideoEvent[error]" is missing from JSON.');
assert(json[r'error'] != null,
'Required key "VideoEvent[error]" has a null value in JSON.');
assert(json.containsKey(r'call_transcription'),
'Required key "VideoEvent[call_transcription]" is missing from JSON.');
assert(json[r'call_transcription'] != null,
'Required key "VideoEvent[call_transcription]" has a null value in JSON.');
assert(json.containsKey(r'rating'),
'Required key "VideoEvent[rating]" is missing from JSON.');
assert(json[r'rating'] != null,
'Required key "VideoEvent[rating]" has a null value in JSON.');
assert(json.containsKey(r'from_user_id'),
'Required key "VideoEvent[from_user_id]" is missing from JSON.');
assert(json[r'from_user_id'] != null,
'Required key "VideoEvent[from_user_id]" has a null value in JSON.');
assert(json.containsKey(r'muted_user_ids'),
'Required key "VideoEvent[muted_user_ids]" is missing from JSON.');
assert(json[r'muted_user_ids'] != null,
'Required key "VideoEvent[muted_user_ids]" has a null value in JSON.');
assert(json.containsKey(r'closed_caption'),
'Required key "VideoEvent[closed_caption]" is missing from JSON.');
assert(json[r'closed_caption'] != null,
'Required key "VideoEvent[closed_caption]" has a null value in JSON.');
assert(json.containsKey(r'connection_id'),
'Required key "VideoEvent[connection_id]" is missing from JSON.');
assert(json[r'connection_id'] != null,
'Required key "VideoEvent[connection_id]" has a null value in JSON.');
assert(json.containsKey(r'me'),
'Required key "VideoEvent[me]" is missing from JSON.');
assert(json[r'me'] != null,
'Required key "VideoEvent[me]" has a null value in JSON.');
assert(json.containsKey(r'ingress_stream_id'),
'Required key "VideoEvent[ingress_stream_id]" is missing from JSON.');
assert(json[r'ingress_stream_id'] != null,
'Required key "VideoEvent[ingress_stream_id]" has a null value in JSON.');
assert(json.containsKey(r'publisher_type'),
'Required key "VideoEvent[publisher_type]" is missing from JSON.');
assert(json[r'publisher_type'] != null,
'Required key "VideoEvent[publisher_type]" has a null value in JSON.');
assert(json.containsKey(r'permissions'),
'Required key "VideoEvent[permissions]" is missing from JSON.');
assert(json[r'permissions'] != null,
'Required key "VideoEvent[permissions]" has a null value in JSON.');
assert(json.containsKey(r'own_capabilities'),
'Required key "VideoEvent[own_capabilities]" is missing from JSON.');
assert(json[r'own_capabilities'] != null,
'Required key "VideoEvent[own_capabilities]" has a null value in JSON.');
assert(json.containsKey(r'delete_conversation'),
'Required key "VideoEvent[delete_conversation]" is missing from JSON.');
assert(json[r'delete_conversation'] != null,
'Required key "VideoEvent[delete_conversation]" has a null value in JSON.');
assert(json.containsKey(r'delete_conversation_channels'),
'Required key "VideoEvent[delete_conversation_channels]" is missing from JSON.');
assert(json[r'delete_conversation_channels'] != null,
'Required key "VideoEvent[delete_conversation_channels]" has a null value in JSON.');
assert(json.containsKey(r'delete_messages'),
'Required key "VideoEvent[delete_messages]" is missing from JSON.');
assert(json[r'delete_messages'] != null,
'Required key "VideoEvent[delete_messages]" has a null value in JSON.');
assert(json.containsKey(r'delete_user'),
'Required key "VideoEvent[delete_user]" is missing from JSON.');
assert(json[r'delete_user'] != null,
'Required key "VideoEvent[delete_user]" has a null value in JSON.');
assert(json.containsKey(r'hard_delete'),
'Required key "VideoEvent[hard_delete]" is missing from JSON.');
assert(json[r'hard_delete'] != null,
'Required key "VideoEvent[hard_delete]" has a null value in JSON.');
assert(json.containsKey(r'mark_messages_deleted'),
'Required key "VideoEvent[mark_messages_deleted]" is missing from JSON.');
assert(json[r'mark_messages_deleted'] != null,
'Required key "VideoEvent[mark_messages_deleted]" has a null value in JSON.');
return true;
}());
return VideoEvent(
app: AppEventResponse.fromJson(json[r'app'])!,
createdAt: mapDateTime(json, r'created_at', r'')!,
custom: mapCastOfType<String, Object>(json, r'custom')!,
receivedAt: mapDateTime(json, r'received_at', r''),
type: mapValueOfType<String>(json, r'type')!,
blockedByUser: UserResponse.fromJson(json[r'blocked_by_user']),
callCid: mapValueOfType<String>(json, r'call_cid')!,
user: UserResponsePrivacyFields.fromJson(json[r'user'])!,
call: CallResponse.fromJson(json[r'call'])!,
members: MemberResponse.listFromJson(json[r'members']),
digit: mapValueOfType<String>(json, r'digit')!,
durationMs: mapValueOfType<int>(json, r'duration_ms')!,
seqNumber: mapValueOfType<int>(json, r'seq_number')!,
timestamp: mapDateTime(json, r'timestamp', r'')!,
reason: mapValueOfType<String>(json, r'reason')!,
egressId: mapValueOfType<String>(json, r'egress_id')!,
capturedAt: mapDateTime(json, r'captured_at', r'')!,
sessionId: mapValueOfType<String>(json, r'session_id')!,
trackType: mapValueOfType<String>(json, r'track_type')!,
url: mapValueOfType<String>(json, r'url')!,
users: UserResponse.mapFromJson(json[r'users']),
hlsPlaylistUrl: mapValueOfType<String>(json, r'hls_playlist_url')!,
capabilitiesByRole: json[r'capabilities_by_role'] == null
? const {}
: (json[r'capabilities_by_role'] as Map<String, dynamic>).map(
(k, v) => MapEntry(k,
v == null ? const <String>[] : (v as List).cast<String>())),
notifyUser: mapValueOfType<bool>(json, r'notify_user')!,
userId: mapValueOfType<String>(json, r'user_id')!,
message: mapValueOfType<String>(json, r'message')!,
reaction: VideoReactionResponse.fromJson(json[r'reaction'])!,
recordingType:
VideoEventRecordingTypeEnum.fromJson(json[r'recording_type'])!,
callRecording: CallRecording.fromJson(json[r'call_recording'])!,
video: mapValueOfType<bool>(json, r'video')!,
name: mapValueOfType<String>(json, r'name')!,
anonymousParticipantCount:
mapValueOfType<int>(json, r'anonymous_participant_count')!,
participantsCountByRole:
mapCastOfType<String, int>(json, r'participants_count_by_role')!,
participant: CallParticipantResponse.fromJson(json[r'participant'])!,
durationSeconds: mapValueOfType<int>(json, r'duration_seconds')!,
isTrimmed: mapValueOfType<bool>(json, r'is_trimmed'),
participantsOverview:
CallStatsParticipant.listFromJson(json[r'participants_overview']),
error: mapValueOfType<String>(json, r'error')!,
callTranscription:
CallTranscription.fromJson(json[r'call_transcription'])!,
rating: mapValueOfType<int>(json, r'rating')!,
sdk: mapValueOfType<String>(json, r'sdk'),
sdkVersion: mapValueOfType<String>(json, r'sdk_version'),
fromUserId: mapValueOfType<String>(json, r'from_user_id')!,
mutedUserIds: json[r'muted_user_ids'] is Iterable
? (json[r'muted_user_ids'] as Iterable)
.cast<String>()
.toList(growable: false)
: const [],
closedCaption: CallClosedCaption.fromJson(json[r'closed_caption'])!,
connectionId: mapValueOfType<String>(json, r'connection_id')!,
me: OwnUserResponse.fromJson(json[r'me'])!,
cid: mapValueOfType<String>(json, r'cid'),
code: mapValueOfType<String>(json, r'code'),
ingressStreamId: mapValueOfType<String>(json, r'ingress_stream_id')!,
clientIp: mapValueOfType<String>(json, r'client_ip'),
clientName: mapValueOfType<String>(json, r'client_name'),
publisherType: mapValueOfType<String>(json, r'publisher_type')!,
version: mapValueOfType<String>(json, r'version'),
kickedByUser: UserResponse.fromJson(json[r'kicked_by_user']),
permissions: json[r'permissions'] is Iterable
? (json[r'permissions'] as Iterable)
.cast<String>()
.toList(growable: false)
: const [],
ownCapabilities: OwnCapability.listFromJson(json[r'own_capabilities']),
channelCustom:
mapCastOfType<String, Object>(json, r'channel_custom') ?? const {},
channelId: mapValueOfType<String>(json, r'channel_id'),
channelMemberCount: mapValueOfType<int>(json, r'channel_member_count'),
channelMessageCount:
mapValueOfType<int>(json, r'channel_message_count'),
channelType: mapValueOfType<String>(json, r'channel_type'),
createdBy: UserResponseCommonFields.fromJson(json[r'created_by']),
expiration: mapDateTime(json, r'expiration', r''),
shadow: mapValueOfType<bool>(json, r'shadow'),
team: mapValueOfType<String>(json, r'team'),
totalBans: mapValueOfType<int>(json, r'total_bans'),
deleteConversation:
mapValueOfType<String>(json, r'delete_conversation')!,
deleteConversationChannels:
mapValueOfType<bool>(json, r'delete_conversation_channels')!,
deleteMessages: mapValueOfType<String>(json, r'delete_messages')!,
deleteUser: mapValueOfType<String>(json, r'delete_user')!,
hardDelete: mapValueOfType<bool>(json, r'hard_delete')!,
markMessagesDeleted:
mapValueOfType<bool>(json, r'mark_messages_deleted')!,
);
}
return null;
}