lines, timetables, stoppoints
parent
158175f609
commit
b9b4f231ad
|
|
@ -0,0 +1,2 @@
|
|||
obj
|
||||
.idea
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
namespace TFL.Entities;
|
||||
|
||||
public class AdditionalProperties
|
||||
{
|
||||
public string Category;
|
||||
public string Key;
|
||||
public string SourceSystemKey;
|
||||
public string Value;
|
||||
public DateTime? Modified;
|
||||
}
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
namespace TFL.Entities;
|
||||
|
||||
public class ApiError
|
||||
{
|
||||
public DateTime TimestampUtc;
|
||||
public string Name;
|
||||
public string ExceptionType;
|
||||
public int HttpStatusCode;
|
||||
public System.Net.HttpStatusCode HttpStatus;
|
||||
public string RelativeUri;
|
||||
public string Message;
|
||||
public string DetailedMessage;
|
||||
}
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
namespace TFL.Entities;
|
||||
|
||||
public class Crowding
|
||||
{
|
||||
public List<PassengerFlow> PassengerFlows;
|
||||
public List<TrainLoading> TrainLoadings;
|
||||
}
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
using System.Globalization;
|
||||
|
||||
namespace TFL.Entities;
|
||||
|
||||
public class DisruptedRoute : IIdentifiable
|
||||
{
|
||||
public string Id;
|
||||
public string LineId;
|
||||
public string RouteCode;
|
||||
public string Name;
|
||||
public string LineString;
|
||||
public string Direction;
|
||||
public string OriginationName;
|
||||
public string DestinationName;
|
||||
public RouteSectionNaptanEntrySequence Via;
|
||||
public bool? IsEntireRouteSection;
|
||||
public DateTime? ValidTo;
|
||||
public DateTime? ValidFrom;
|
||||
public List<RouteSectionNaptanEntrySequence> RouteSectionNaptanEntrySequence;
|
||||
|
||||
public Identifier ToIdentifier() => new()
|
||||
{
|
||||
Id = Id.ToString(CultureInfo.InvariantCulture),
|
||||
Name = Name,
|
||||
Type = nameof(RouteSection)
|
||||
};
|
||||
}
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
using TFL.Enums;
|
||||
|
||||
namespace TFL.Entities;
|
||||
|
||||
public class Disruption
|
||||
{
|
||||
public string Id;
|
||||
public DisruptionCategory Category;
|
||||
public string Type;
|
||||
public string CategoryDescription;
|
||||
public string Description;
|
||||
public string Summary;
|
||||
public string AdditionalInfo;
|
||||
public DateTime Created;
|
||||
public DateTime LastUpdate;
|
||||
public List<DisruptedRoute> AffectedRoutes;
|
||||
public List<StopPoint> AffectedStops;
|
||||
public bool IsBlocking;
|
||||
public bool IsWholeLine;
|
||||
public string ClosureText;
|
||||
}
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
namespace TFL.Entities;
|
||||
|
||||
public interface IIdentifiable
|
||||
{
|
||||
Identifier ToIdentifier();
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
namespace TFL.Entities;
|
||||
|
||||
public class Identifier
|
||||
{
|
||||
public string Id;
|
||||
public string Name;
|
||||
public string Uri;
|
||||
public string FullName;
|
||||
public string Type;
|
||||
public Crowding Crowding;
|
||||
}
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
namespace TFL.Entities;
|
||||
|
||||
public class Interval
|
||||
{
|
||||
public string StopId;
|
||||
public double TimeToArrival;
|
||||
}
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
namespace TFL.Entities;
|
||||
|
||||
public class KnownJourney
|
||||
{
|
||||
public string Hour;
|
||||
public string Minute;
|
||||
public int IntervalId;
|
||||
|
||||
public TimeSpan ToTimeSpan() => new(int.Parse(Hour), int.Parse(Minute), 0);
|
||||
}
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
namespace TFL.Entities;
|
||||
|
||||
public class Line : IIdentifiable
|
||||
{
|
||||
public string Id;
|
||||
public string Name;
|
||||
public string ModeName;
|
||||
public List<Disruption> Disruptions;
|
||||
public DateTime Created;
|
||||
public DateTime? Modified;
|
||||
public List<LineStatus> LineStatus;
|
||||
public List<MatchedRoute> RouteSections;
|
||||
public List<LineServiceTypeInfo> ServiceTypes;
|
||||
public Crowding Crowding;
|
||||
|
||||
public Identifier ToIdentifier() => new()
|
||||
{
|
||||
Id = Id,
|
||||
Name = Name,
|
||||
Type = nameof(Line),
|
||||
Uri = $"/Line/{Id}",
|
||||
Crowding = Crowding
|
||||
};
|
||||
}
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
namespace TFL.Entities;
|
||||
|
||||
public class LineGroup
|
||||
{
|
||||
public string NaptanIdReference;
|
||||
public string StationAtcoCode;
|
||||
public List<string> LineIdentifier;
|
||||
}
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
namespace TFL.Entities;
|
||||
|
||||
public class LineModeGroup
|
||||
{
|
||||
public string ModeName;
|
||||
public List<string> LineIdentifier;
|
||||
}
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
namespace TFL.Entities;
|
||||
|
||||
public class LineServiceTypeInfo
|
||||
{
|
||||
public string Name;
|
||||
public string Uri;
|
||||
}
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
using System.Globalization;
|
||||
|
||||
namespace TFL.Entities;
|
||||
|
||||
public class LineStatus : IIdentifiable
|
||||
{
|
||||
public string Id;
|
||||
public string LineId;
|
||||
public int? StatusSeverity;
|
||||
public string StatusSeverityDescription;
|
||||
public string Reason;
|
||||
public DateTime Created;
|
||||
public DateTime? Modified;
|
||||
|
||||
public Identifier ToIdentifier() => new()
|
||||
{
|
||||
Id = Id.ToString(CultureInfo.InvariantCulture),
|
||||
Name = $"{StatusSeverity} - {StatusSeverityDescription}",
|
||||
Type = nameof(LineStatus),
|
||||
Uri = $"/Line/{Id}/Status"
|
||||
};
|
||||
}
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
using System.Globalization;
|
||||
|
||||
namespace TFL.Entities;
|
||||
|
||||
public class MatchedRoute : IIdentifiable
|
||||
{
|
||||
public string Id;
|
||||
public string LineId;
|
||||
public string RouteCode;
|
||||
public string Name;
|
||||
public string Direction;
|
||||
public string OriginationName;
|
||||
public string DestinationName;
|
||||
public string Originator;
|
||||
public string Destination;
|
||||
public string ServiceType;
|
||||
public DateTime? ValidTo;
|
||||
public DateTime? ValidFrom;
|
||||
|
||||
public Identifier ToIdentifier() => new()
|
||||
{
|
||||
Id = Id.ToString(CultureInfo.InvariantCulture),
|
||||
Name = Name,
|
||||
Type = nameof(MatchedRoute),
|
||||
Uri = $"/MatchedRoute/{Id}"
|
||||
};
|
||||
}
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
namespace TFL.Entities;
|
||||
|
||||
public class MatchedStop : SearchMatch, IIdentifiable, IComparable<MatchedStop>
|
||||
{
|
||||
public int RouteId;
|
||||
public string ParentId;
|
||||
public string StationId;
|
||||
public string IcsId;
|
||||
public string TopMostParentId;
|
||||
public string Direction;
|
||||
public string Towards;
|
||||
public List<string> Modes;
|
||||
public string StopType;
|
||||
public string StopLetter;
|
||||
public string Zone;
|
||||
public string AccessibilitySummary;
|
||||
public bool HasDisruption;
|
||||
public List<Identifier> Lines;
|
||||
public bool Status;
|
||||
|
||||
public Identifier ToIdentifier() => new()
|
||||
{
|
||||
Id = Id,
|
||||
Name = Name,
|
||||
Type = nameof(StopPoint),
|
||||
Uri = "/StopPoint/" + Id
|
||||
};
|
||||
|
||||
public int CompareTo(MatchedStop? obj) => obj == null ? -1 : string.Compare(Name, obj.Name, StringComparison.Ordinal);
|
||||
}
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
using System.Globalization;
|
||||
|
||||
namespace TFL.Entities;
|
||||
|
||||
public class Mode : IIdentifiable
|
||||
{
|
||||
public bool IsTflService;
|
||||
public bool IsFarePaying;
|
||||
public bool IsScheduledService;
|
||||
public string ModeName;
|
||||
|
||||
public Identifier ToIdentifier() => new()
|
||||
{
|
||||
Id = ModeName.ToString(CultureInfo.InvariantCulture),
|
||||
Name = ModeName,
|
||||
Type = nameof(Mode)
|
||||
};
|
||||
}
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
namespace TFL.Entities;
|
||||
|
||||
public class OrderedRoute
|
||||
{
|
||||
public string Name;
|
||||
public List<string> NaptanIds;
|
||||
public string ServiceType;
|
||||
}
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
namespace TFL.Entities;
|
||||
|
||||
public class PassengerFlow
|
||||
{
|
||||
public string TimeSlice;
|
||||
public int? Value;
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
using TFL.Enums;
|
||||
|
||||
namespace TFL.Entities;
|
||||
|
||||
public class Period
|
||||
{
|
||||
public TimetablePeriodType Type;
|
||||
public TwentyFourHourClockTime FromTime;
|
||||
public TwentyFourHourClockTime ToTime;
|
||||
public ServiceFrequency Frequency;
|
||||
}
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
using System.Web;
|
||||
|
||||
namespace TFL.Entities;
|
||||
|
||||
public class Place : Point, IIdentifiable
|
||||
{
|
||||
public string Id;
|
||||
public string Url;
|
||||
public string CommonName;
|
||||
public double Distance;
|
||||
public string PlaceType;
|
||||
public List<AdditionalProperties> AdditionalProperties;
|
||||
public List<Place> Children;
|
||||
public List<string> ChildrenUrls;
|
||||
|
||||
public Identifier ToIdentifier() => new()
|
||||
{
|
||||
Id = Id,
|
||||
Name = CommonName,
|
||||
Type = nameof(Place),
|
||||
Uri = $@"/Place/{HttpUtility.UrlEncode(Id)}"
|
||||
};
|
||||
}
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
namespace TFL.Entities;
|
||||
|
||||
public class Point
|
||||
{
|
||||
public double Lat;
|
||||
public double Lon;
|
||||
}
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
using System.Globalization;
|
||||
|
||||
namespace TFL.Entities;
|
||||
|
||||
public class RouteSection : IIdentifiable
|
||||
{
|
||||
public string Id;
|
||||
public string LineId;
|
||||
public string RouteCode;
|
||||
public string Name;
|
||||
public string LineString;
|
||||
public string Direction;
|
||||
public string OriginationName;
|
||||
public string DestinationName;
|
||||
public DateTime? ValidTo;
|
||||
public DateTime? ValidFrom;
|
||||
public List<RouteSectionNaptanEntrySequence> RouteSectionNaptanEntrySequence;
|
||||
|
||||
public Identifier ToIdentifier() => new()
|
||||
{
|
||||
Id = Id.ToString(CultureInfo.InvariantCulture),
|
||||
Name = Name,
|
||||
Type = nameof(RouteSection)
|
||||
};
|
||||
}
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
namespace TFL.Entities;
|
||||
|
||||
public class RouteSectionNaptanEntrySequence
|
||||
{
|
||||
public int Ordinal;
|
||||
public StopPoint StopPoint;
|
||||
}
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
namespace TFL.Entities;
|
||||
|
||||
public class RouteSequence : IIdentifiable
|
||||
{
|
||||
public string LineId;
|
||||
public string LineName;
|
||||
public string Direction;
|
||||
public bool IsOutboundOnly;
|
||||
public string Mode;
|
||||
public List<string> LineStrings;
|
||||
public List<MatchedStop> Stations;
|
||||
public List<StopPointSequence> StopPointSequences;
|
||||
public List<OrderedRoute> OrderedLineRoutes;
|
||||
|
||||
public Identifier ToIdentifier() => new()
|
||||
{
|
||||
Id = LineId,
|
||||
Type = nameof(RouteSequence),
|
||||
Uri = $"/Line/{LineId}/Route/Sequence/{Direction}"
|
||||
};
|
||||
}
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
namespace TFL.Entities;
|
||||
|
||||
public class Schedule
|
||||
{
|
||||
public string Name;
|
||||
public List<KnownJourney> KnownJourneys;
|
||||
public KnownJourney FirstJourney;
|
||||
public KnownJourney LastJourney;
|
||||
public List<Period> Periods;
|
||||
}
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
namespace TFL.Entities;
|
||||
|
||||
public class SearchMatch
|
||||
{
|
||||
public string Id;
|
||||
public string Url;
|
||||
public string Name;
|
||||
public double? Lat;
|
||||
public double? Lon;
|
||||
}
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
namespace TFL.Entities;
|
||||
|
||||
public class ServiceFrequency
|
||||
{
|
||||
public double LowestFrequency;
|
||||
public double HighestFrequency;
|
||||
}
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
namespace TFL.Entities;
|
||||
|
||||
public class StationInterval
|
||||
{
|
||||
public string Id;
|
||||
public List<Interval> Intervals;
|
||||
}
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
namespace TFL.Entities;
|
||||
|
||||
public class StopPoint : Place, IIdentifiable, IComparable<StopPoint>
|
||||
{
|
||||
public string NaptanId;
|
||||
public string PlatformName;
|
||||
public string Indicator;
|
||||
public string StopLetter;
|
||||
public List<string> Modes;
|
||||
public string IcsCode;
|
||||
public string SMSCode;
|
||||
public string StopType;
|
||||
public string StationNaptan;
|
||||
public string AccessibilitySummary;
|
||||
public string HubNaptanCode;
|
||||
public List<Identifier> Lines;
|
||||
public List<LineGroup> LineGroup;
|
||||
public List<LineModeGroup> LineModeGroups;
|
||||
public string FullName;
|
||||
public string NaptanMode;
|
||||
public bool Status;
|
||||
|
||||
public int CompareTo(StopPoint? obj) => obj == null ? -1 : string.Compare(CommonName, obj.CommonName, StringComparison.Ordinal);
|
||||
|
||||
public new Identifier ToIdentifier() => new()
|
||||
{
|
||||
Id = NaptanId,
|
||||
Name = CommonName,
|
||||
Type = nameof(StopPoint),
|
||||
Uri = $"/StopPoint/{NaptanId}",
|
||||
FullName = FullName
|
||||
};
|
||||
}
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
using TFL.Enums;
|
||||
|
||||
namespace TFL.Entities;
|
||||
|
||||
public class StopPointSequence : IIdentifiable
|
||||
{
|
||||
public string LineId;
|
||||
public string LineName;
|
||||
public string Direction;
|
||||
public int BranchId;
|
||||
public List<int> NextBranchIds;
|
||||
public List<int> PrevBranchIds;
|
||||
public List<MatchedStop> StopPoint;
|
||||
public ServiceType ServiceType;
|
||||
|
||||
public Identifier ToIdentifier() => new()
|
||||
{
|
||||
Id = LineId,
|
||||
Type = nameof(StopPointSequence),
|
||||
Uri = $"/Line/{LineId}/Route/Sequence/{Direction}"
|
||||
};
|
||||
}
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
namespace TFL.Entities;
|
||||
|
||||
public class Timetable
|
||||
{
|
||||
public string DepartureStopId;
|
||||
public List<TimetableRoute> Routes;
|
||||
}
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
using TFL.Entities.Timetables;
|
||||
|
||||
namespace TFL.Entities;
|
||||
|
||||
public class TimetableResponse
|
||||
{
|
||||
public string LineId;
|
||||
public string LineName;
|
||||
public string Direction;
|
||||
public string PdfUrl;
|
||||
public List<MatchedStop> Stations;
|
||||
public List<MatchedStop> Stops;
|
||||
public Timetable Timetable;
|
||||
public Disambiguation Disambiguation;
|
||||
public string StatusErrorMessage;
|
||||
}
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
namespace TFL.Entities;
|
||||
|
||||
public class TimetableRoute
|
||||
{
|
||||
public List<StationInterval> StationIntervals;
|
||||
public List<Schedule> Schedules;
|
||||
}
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
namespace TFL.Entities.Timetables;
|
||||
|
||||
public class Disambiguation
|
||||
{
|
||||
public List<DisambiguationOption> DisambiguationOptions;
|
||||
}
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
namespace TFL.Entities.Timetables;
|
||||
|
||||
public class DisambiguationOption
|
||||
{
|
||||
public string Description;
|
||||
public string Uri;
|
||||
}
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
namespace TFL.Entities;
|
||||
|
||||
public class TrainLoading
|
||||
{
|
||||
public string Line;
|
||||
public string LineDirection;
|
||||
public string PlatformDirection;
|
||||
public string Direction;
|
||||
public string NaptanTo;
|
||||
public string TimeSlice;
|
||||
public int? Value;
|
||||
}
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
namespace TFL.Entities;
|
||||
|
||||
public class TwentyFourHourClockTime
|
||||
{
|
||||
public string Hour;
|
||||
public string Minute;
|
||||
|
||||
public TimeSpan ToTimeSpan() => new(int.Parse(Hour), int.Parse(Minute), 0);
|
||||
}
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
namespace TFL.Enums;
|
||||
|
||||
public enum DisruptionCategory
|
||||
{
|
||||
Undefined,
|
||||
RealTime,
|
||||
PlannedWork,
|
||||
Information,
|
||||
Event,
|
||||
Crowding,
|
||||
StatusAlert
|
||||
}
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
namespace TFL.Enums;
|
||||
|
||||
public enum ServiceType
|
||||
{
|
||||
Regular,
|
||||
Night
|
||||
}
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
namespace TFL.Enums;
|
||||
|
||||
public enum TimetablePeriodType
|
||||
{
|
||||
Normal,
|
||||
FrequencyHours,
|
||||
FrequencyMinutes,
|
||||
Unknown,
|
||||
}
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TFL", "TFL.csproj", "{56E575D0-549D-4E67-A084-C632DDA5F1E2}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{56E575D0-549D-4E67-A084-C632DDA5F1E2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{56E575D0-549D-4E67-A084-C632DDA5F1E2}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{56E575D0-549D-4E67-A084-C632DDA5F1E2}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{56E575D0-549D-4E67-A084-C632DDA5F1E2}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
Loading…
Reference in New Issue