fromJson method

  1. @override
UModEventViewEvent fromJson(
  1. Map<String, dynamic> json
)

Implementation

@override
UModEventViewEvent fromJson(Map<String, dynamic> json) {
  try {
    if (isModEventTakedown(json)) {
      return UModEventViewEvent.modEventTakedown(
        data: const ModEventTakedownConverter().fromJson(json),
      );
    }
    if (isModEventReverseTakedown(json)) {
      return UModEventViewEvent.modEventReverseTakedown(
        data: const ModEventReverseTakedownConverter().fromJson(json),
      );
    }
    if (isModEventComment(json)) {
      return UModEventViewEvent.modEventComment(
        data: const ModEventCommentConverter().fromJson(json),
      );
    }
    if (isModEventReport(json)) {
      return UModEventViewEvent.modEventReport(
        data: const ModEventReportConverter().fromJson(json),
      );
    }
    if (isModEventLabel(json)) {
      return UModEventViewEvent.modEventLabel(
        data: const ModEventLabelConverter().fromJson(json),
      );
    }
    if (isModEventAcknowledge(json)) {
      return UModEventViewEvent.modEventAcknowledge(
        data: const ModEventAcknowledgeConverter().fromJson(json),
      );
    }
    if (isModEventEscalate(json)) {
      return UModEventViewEvent.modEventEscalate(
        data: const ModEventEscalateConverter().fromJson(json),
      );
    }
    if (isModEventMute(json)) {
      return UModEventViewEvent.modEventMute(
        data: const ModEventMuteConverter().fromJson(json),
      );
    }
    if (isModEventUnmute(json)) {
      return UModEventViewEvent.modEventUnmute(
        data: const ModEventUnmuteConverter().fromJson(json),
      );
    }
    if (isModEventMuteReporter(json)) {
      return UModEventViewEvent.modEventMuteReporter(
        data: const ModEventMuteReporterConverter().fromJson(json),
      );
    }
    if (isModEventUnmuteReporter(json)) {
      return UModEventViewEvent.modEventUnmuteReporter(
        data: const ModEventUnmuteReporterConverter().fromJson(json),
      );
    }
    if (isModEventEmail(json)) {
      return UModEventViewEvent.modEventEmail(
        data: const ModEventEmailConverter().fromJson(json),
      );
    }
    if (isModEventResolveAppeal(json)) {
      return UModEventViewEvent.modEventResolveAppeal(
        data: const ModEventResolveAppealConverter().fromJson(json),
      );
    }
    if (isModEventDivert(json)) {
      return UModEventViewEvent.modEventDivert(
        data: const ModEventDivertConverter().fromJson(json),
      );
    }
    if (isModEventTag(json)) {
      return UModEventViewEvent.modEventTag(
        data: const ModEventTagConverter().fromJson(json),
      );
    }

    return UModEventViewEvent.unknown(data: json);
  } catch (_) {
    return UModEventViewEvent.unknown(data: json);
  }
}