fromJson static method

QueryAggregateCallStatsResponse? fromJson(
  1. dynamic value
)

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

Implementation

// ignore: prefer_constructors_over_static_methods
static QueryAggregateCallStatsResponse? 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(() {
      requiredKeys.forEach((key) {
        assert(json.containsKey(key),
            'Required key "QueryAggregateCallStatsResponse[$key]" is missing from JSON.');
        assert(json[key] != null,
            'Required key "QueryAggregateCallStatsResponse[$key]" has a null value in JSON.');
      });
      return true;
    }());

    return QueryAggregateCallStatsResponse(
      callDurationReport:
          CallDurationReportResponse.fromJson(json[r'call_duration_report']),
      callParticipantCountReport: CallParticipantCountReportResponse.fromJson(
          json[r'call_participant_count_report']),
      callsPerDayReport:
          CallsPerDayReportResponse.fromJson(json[r'calls_per_day_report']),
      duration: mapValueOfType<String>(json, r'duration')!,
      networkMetricsReport: NetworkMetricsReportResponse.fromJson(
          json[r'network_metrics_report']),
      qualityScoreReport:
          QualityScoreReportResponse.fromJson(json[r'quality_score_report']),
      sdkUsageReport:
          SDKUsageReportResponse.fromJson(json[r'sdk_usage_report']),
      userFeedbackReport:
          UserFeedbackReportResponse.fromJson(json[r'user_feedback_report']),
    );
  }
  return null;
}