ReadingBusesAPI 3.0.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package ReadingBusesAPI --version 3.0.0                
NuGet\Install-Package ReadingBusesAPI -Version 3.0.0                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="ReadingBusesAPI" Version="3.0.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add ReadingBusesAPI --version 3.0.0                
#r "nuget: ReadingBusesAPI, 3.0.0"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install ReadingBusesAPI as a Cake Addin
#addin nuget:?package=ReadingBusesAPI&version=3.0.0

// Install ReadingBusesAPI as a Cake Tool
#tool nuget:?package=ReadingBusesAPI&version=3.0.0                

.NET Core Codacy Badge https://img.shields.io/badge/Documentation-View-blue

Reading Buses API

A C#, .net Standard Library for the new Reading Buses API, available to use in your C# console, UWP, WPF or Win Form Applications.

This includes bus services operated by Reading Buses and subsidiaries such as, Thames Valley Buses and Newbury & District Buses.

The library supports the List of Bus Stops, Live Vehicle Positions, Live Journey Details, Stop Predictions, List of Lines, Line Patterns, Timetabled Journeys, Tracking History and the Vehicle Position History API..

Get your own API Keys from: https://reading-opendata.r2p.com/api-service

Examples

Examples code can be found on the Examples Repository here

Documentation

Documentation can be found by online here or the "docs" folder of this repository.

Download & Installation

Get the package from the nuget store here

Very Quick Start

First you need to initialise the library by providing your API key:

ReadingBuses Controller = await ReadingBuses.Initialise("APIKEY");

Once Initialised all future reference can be got using:

ReadingBuses Controller = ReadingBuses.GetInstance();

Get a List of Bus Services

To get a list of bus services operated by Reading Buses and the information about them you can do any of the following:

To get all Services:

BusService[] Services = Controller.GetServices();

To get all Services from a company:

BusService[] RBServices = Controller.GetServices(Company.ReadingBuses);
BusService[] TVServices = Controller.GetServices(Company.ThamesValley);

To get specific Services based on their brand:

BusService[] Services = Controller.GetServices("pink");

To get specific Service by Service Number and Company Operator:

Note that the API has data for Reading Buses, Thames Valley Buses and Newbury & District Buses, as such, service id might not be unique. For example, Reading Buses and Newbury & District both operate a service number "1", so operator is needed to specify which one.

BusService purple17 = Controller.GetService("17", Company.ReadingBuses);

To get a service's timetable

Journey[] timetable = await purple17.GetTimeTable(DateTime.Now);

To get a service's historical journeys

HistoricJourney[] timetable = await purple17.GetArchivedTimeTable(DateTime.Now.AddDays(-5));

To get a service's route*

BusStop[] outbound = await purple17.GetLocations(Direction.Outbound);
BusStop[] inbound = await purple17.GetLocations(Direction.Inbound);

Get a List of Locations (Bus Stops)

To get all locations

BusStop[] Locations = Controller.GetLocations();

To get location based on Acto-Code (Bus Stop ID)

BusStop stop = Controller.GetLocation("039028150002");

To get live stop departure information

LiveRecord[] departures = await stop.GetLiveData();

Get GPS Data

To get Live GPS Data

LiveVehiclePosition[] Positions = await Controller.GpsController.GetLiveVehiclePositions();

To get Archived GPS Data

VehiclePosition[] Positions = await Controller.GpsController.GetArchivedVehiclePositions(DateTime.Now.AddDays(-1), new TimeSpan(3, 0, 0));

Once you have the bus service or location you want to inspect, they have various properties to let you get further data about them. Such as live bus stop data, GPS data, bus service routes. For more examples, please see the repository linked above.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
3.1.0 84 7/28/2024
3.0.0 684 7/30/2022

* Updated to support the new Reading Buses API!
* Replacing Newtonsoft.JSON library with the system.text.json library.
* Improved what is cached to include historical GPS data, historical journey information and historical timetables, as this data will never change.
* Added support for "Live Journey Details" API feed.
* Removed Courtney Buses for Thames Valley Buses
* Can now query by direction of stops in the line pattern API, such as outbound or inbound.
* ArchivedBusTimetable has loosely become HistoricalJourney
* BusTimetable has loosely become Journey
* ArchivedPosition has loosely become VehiclePosition
* LivePosition has loosely become LiveVehiclePosition