ReportRunParameters.fromJson constructor

ReportRunParameters.fromJson(
  1. Object? json
)

Implementation

factory ReportRunParameters.fromJson(Object? json) {
  final map = (json as Map).cast<String, Object?>();
  return ReportRunParameters(
    columns: map['columns'] == null
        ? null
        : (map['columns'] as List<Object?>)
            .map((el) => (el as String))
            .toList(),
    connectedAccount: map['connected_account'] == null
        ? null
        : (map['connected_account'] as String),
    currency: map['currency'] == null ? null : (map['currency'] as String),
    intervalEnd: map['interval_end'] == null
        ? null
        : DateTime.fromMillisecondsSinceEpoch(
            (map['interval_end'] as int).toInt()),
    intervalStart: map['interval_start'] == null
        ? null
        : DateTime.fromMillisecondsSinceEpoch(
            (map['interval_start'] as int).toInt()),
    payout: map['payout'] == null ? null : (map['payout'] as String),
    reportingCategory: map['reporting_category'] == null
        ? null
        : ReportRunReportingCategory.fromJson(map['reporting_category']),
    timezone: map['timezone'] == null
        ? null
        : ReportRunTimezone.fromJson(map['timezone']),
  );
}