fromJson static method

QueryCallParticipantSessionsResponse? fromJson(
  1. dynamic value
)

Returns a new QueryCallParticipantSessionsResponse instance and imports its values from value if it's a Map, null otherwise.

Implementation

// ignore: prefer_constructors_over_static_methods
static QueryCallParticipantSessionsResponse? 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'call_id'),
          'Required key "QueryCallParticipantSessionsResponse[call_id]" is missing from JSON.');
      assert(json[r'call_id'] != null,
          'Required key "QueryCallParticipantSessionsResponse[call_id]" has a null value in JSON.');
      assert(json.containsKey(r'call_session_id'),
          'Required key "QueryCallParticipantSessionsResponse[call_session_id]" is missing from JSON.');
      assert(json[r'call_session_id'] != null,
          'Required key "QueryCallParticipantSessionsResponse[call_session_id]" has a null value in JSON.');
      assert(json.containsKey(r'call_type'),
          'Required key "QueryCallParticipantSessionsResponse[call_type]" is missing from JSON.');
      assert(json[r'call_type'] != null,
          'Required key "QueryCallParticipantSessionsResponse[call_type]" has a null value in JSON.');
      assert(json.containsKey(r'duration'),
          'Required key "QueryCallParticipantSessionsResponse[duration]" is missing from JSON.');
      assert(json[r'duration'] != null,
          'Required key "QueryCallParticipantSessionsResponse[duration]" has a null value in JSON.');
      assert(json.containsKey(r'participants_sessions'),
          'Required key "QueryCallParticipantSessionsResponse[participants_sessions]" is missing from JSON.');
      assert(json[r'participants_sessions'] != null,
          'Required key "QueryCallParticipantSessionsResponse[participants_sessions]" has a null value in JSON.');
      assert(json.containsKey(r'total_participant_duration'),
          'Required key "QueryCallParticipantSessionsResponse[total_participant_duration]" is missing from JSON.');
      assert(json[r'total_participant_duration'] != null,
          'Required key "QueryCallParticipantSessionsResponse[total_participant_duration]" has a null value in JSON.');
      assert(json.containsKey(r'total_participant_sessions'),
          'Required key "QueryCallParticipantSessionsResponse[total_participant_sessions]" is missing from JSON.');
      assert(json[r'total_participant_sessions'] != null,
          'Required key "QueryCallParticipantSessionsResponse[total_participant_sessions]" has a null value in JSON.');
      return true;
    }());

    return QueryCallParticipantSessionsResponse(
      callId: mapValueOfType<String>(json, r'call_id')!,
      callSessionId: mapValueOfType<String>(json, r'call_session_id')!,
      callType: mapValueOfType<String>(json, r'call_type')!,
      duration: mapValueOfType<int>(json, r'duration')!,
      next: mapValueOfType<String>(json, r'next'),
      participantsSessions: ParticipantSessionDetails.listFromJson(
          json[r'participants_sessions']),
      prev: mapValueOfType<String>(json, r'prev'),
      session: CallSessionResponse.fromJson(json[r'session']),
      totalParticipantDuration:
          mapValueOfType<int>(json, r'total_participant_duration')!,
      totalParticipantSessions:
          mapValueOfType<int>(json, r'total_participant_sessions')!,
    );
  }
  return null;
}