internal MatchTimelineDTO(matchTimelineEndpoint timeline) { Guard.Argument(timeline, nameof(timeline)).NotNull(); Guard.Argument(timeline.sport_event, nameof(timeline.sport_event)).NotNull(); SportEvent = RestMapperHelper.MapSportEvent(timeline.sport_event); if (timeline.coverage_info != null) { CoverageInfo = new CoverageInfoDTO(timeline.coverage_info); } if (timeline.sport_event_conditions != null) { SportEventConditions = new SportEventConditionsDTO(timeline.sport_event_conditions); } if (timeline.sport_event_status != null) { SportEventStatus = new SportEventStatusDTO(timeline.sport_event_status, null, RestMapperHelper.FillHomeAwayCompetitors(timeline.sport_event.competitors)); } if (timeline.timeline != null && timeline.timeline.Length > 0) { BasicEvents = timeline.timeline.Select(s => new BasicEventDTO(s)); } GeneratedAt = timeline.generated_atSpecified ? timeline.generated_at : (DateTime?)null; }
internal MatchTimelineDTO(matchTimelineEndpoint timeline) { Contract.Requires(timeline != null); Contract.Requires(timeline.sport_event != null); SportEvent = RestMapperHelper.MapSportEvent(timeline.sport_event); if (timeline.coverage_info != null) { CoverageInfo = new CoverageInfoDTO(timeline.coverage_info); } if (timeline.sport_event_conditions != null) { SportEventConditions = new SportEventConditionsDTO(timeline.sport_event_conditions); } if (timeline.sport_event_status != null) { SportEventStatus = new SportEventStatusDTO(timeline.sport_event_status, null, RestMapperHelper.FillHomeAwayCompetitors(timeline.sport_event.competitors)); } if (timeline.timeline != null && timeline.timeline.Length > 0) { BasicEvents = timeline.timeline.Select(s => new BasicEventDTO(s)); } }