CreateStatus200Response.fromJson constructor

CreateStatus200Response.fromJson(
  1. Map<String, dynamic> json
)

Implementation

factory CreateStatus200Response.fromJson(Map<String, dynamic> json) {
  final statusType = json['scheduled_at'] != null
      ? CreateStatus200ResponseType.scheduledStatus
      : CreateStatus200ResponseType.status;
  return CreateStatus200Response(
    statusType: statusType,
    status: statusType == CreateStatus200ResponseType.status
        ? Status.fromJson(json)
        : null,
    scheduledStatus: statusType == CreateStatus200ResponseType.scheduledStatus
        ? ScheduledStatus.fromJson(json)
        : null,
  );
}