Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/open-transport-mallorca/mallorca_transit_services
A public API to access Mallorca's transportation services
https://github.com/open-transport-mallorca/mallorca_transit_services
api dartlang pub-dev public-transport spain
Last synced: 3 days ago
JSON representation
A public API to access Mallorca's transportation services
- Host: GitHub
- URL: https://github.com/open-transport-mallorca/mallorca_transit_services
- Owner: open-transport-mallorca
- License: other
- Created: 2024-04-09T20:29:15.000Z (6 months ago)
- Default Branch: master
- Last Pushed: 2024-08-09T13:15:39.000Z (about 2 months ago)
- Last Synced: 2024-08-09T14:34:13.428Z (about 2 months ago)
- Topics: api, dartlang, pub-dev, public-transport, spain
- Language: Dart
- Homepage: https://pub.dev/packages/mallorca_transit_services
- Size: 21.5 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# Mallorca Transit Services API
## Features
An unofficial Dart package for the Balearic Islands' Public Transportation services.
It provides a simple way to access Mallorca's transportation services and get information about the bus stops, lines, schedules, etc.**This package is not affiliated with the government or the respective companies.**
## Getting started
Install the package by adding it to your `pubspec.yaml` file:
```yaml
dependencies:
mallorca_transit_services: ^1.0.1
```## Usage
Get the list of bus stops:
```dart
await Stations.getStations();
```Get the list of departures from a specific bus stop:
```dart
await Departures.getDepartures(stationId: id, numberOfDepartures: 10);
```Get a list of lines that pass through a specific bus stop:
```dart
await Station.getLines(stationCode);
```Get the list of all lines:
```dart
await RouteLine.getAllLines();
```Get specific line information:
```dart
await RouteLine.getLine('A42');
```Get the route of a specific line:
```dart
await RoutePath.getPath(route.code);
```Listen to real-time updates of a specific bus:
```dart
LocationWebSocket.locationStream(busId).then((stream) {
stream.listen((message) {
final action = LocationWebSocket.locationParser(jsonDecode(message));
});
});
```Get the RSS feed of the public warnings:
```dart
await TransitRss.getWarningFeed();
```Get the RSS feed of the public news:
```dart
await TransitRss.getNewsFeed();
```Scrape the website for the affected lines of a specific warning:
```dart
await TransitWarningScraper.scrapeAffectedLines(rssItem);
```Scrape the website for the description of a specific warning:
```dart
await TransitWarningScraper.scrapeWarningDescription(rssItem);
```Scrape the website for the timetable PDF of a specific line:
```dart
await RouteLine.getPdfTimetable('A42');
```The full example can be found in the [example.dart](example/example.dart)
## Facing Issues?
I'm trying my best to make this API as bug-free as possible, if you find any issues, please submit a bug report in the issues section of this repository.