From de9257ba6591c2022b560f7027e83547fe74f8a5 Mon Sep 17 00:00:00 2001 From: Julien Dessaux Date: Tue, 7 Sep 2021 15:44:44 +0200 Subject: Added navitia code to fetch train stops names --- .../test_data/4-train-stops-page-0.json | 264 +++++++++++++++++++++ .../test_data/4-train-stops-page-1.json | 239 +++++++++++++++++++ .../test_data/4-train-stops-page-2.json | 239 +++++++++++++++++++ .../test_data/4-train-stops.json | 264 +++++++++++++++++++++ 4 files changed, 1006 insertions(+) create mode 100644 pkg/navitia_api_client/test_data/4-train-stops-page-0.json create mode 100644 pkg/navitia_api_client/test_data/4-train-stops-page-1.json create mode 100644 pkg/navitia_api_client/test_data/4-train-stops-page-2.json create mode 100644 pkg/navitia_api_client/test_data/4-train-stops.json (limited to 'pkg/navitia_api_client/test_data') diff --git a/pkg/navitia_api_client/test_data/4-train-stops-page-0.json b/pkg/navitia_api_client/test_data/4-train-stops-page-0.json new file mode 100644 index 0000000..5b91260 --- /dev/null +++ b/pkg/navitia_api_client/test_data/4-train-stops-page-0.json @@ -0,0 +1,264 @@ +{ + "pagination": { + "start_page": 0, + "items_on_page": 4, + "items_per_page": 4, + "total_result": 12 + }, + "links": [ + { + "href": "https://api.sncf.com/v1/coverage/sncf/stop_areas/{stop_areas.id}", + "type": "stop_areas", + "rel": "stop_areas", + "templated": true + }, + { + "href": "https://api.sncf.com/v1/coverage/sncf/stop_areas/{stop_areas.id}/route_schedules", + "type": "route_schedules", + "rel": "route_schedules", + "templated": true + }, + { + "href": "https://api.sncf.com/v1/coverage/sncf/stop_areas/{stop_areas.id}/stop_schedules", + "type": "stop_schedules", + "rel": "stop_schedules", + "templated": true + }, + { + "href": "https://api.sncf.com/v1/coverage/sncf/stop_areas/{stop_areas.id}/arrivals", + "type": "arrivals", + "rel": "arrivals", + "templated": true + }, + { + "href": "https://api.sncf.com/v1/coverage/sncf/stop_areas/{stop_areas.id}/departures", + "type": "departures", + "rel": "departures", + "templated": true + }, + { + "href": "https://api.sncf.com/v1/coverage/sncf/stop_areas/{stop_areas.id}/places_nearby", + "type": "places_nearby", + "rel": "places_nearby", + "templated": true + }, + { + "href": "https://api.sncf.com/v1/coverage/sncf/stop_areas/{stop_areas.id}/journeys", + "type": "journey", + "rel": "journeys", + "templated": true + }, + { + "href": "https://api.sncf.com/v1/coverage/sncf/stop_areas/{stop_areas.id}/traffic_reports", + "type": "disruption", + "rel": "disruptions", + "templated": true + }, + { + "href": "https://api.sncf.com/v1/coverage/sncf/stop_areas?count=4&start_page=1", + "type": "next", + "templated": false + }, + { + "href": "https://api.sncf.com/v1/coverage/sncf/stop_areas?count=4&start_page=1280", + "type": "last", + "templated": false + }, + { + "href": "https://api.sncf.com/v1/coverage/sncf/stop_areas?count=4", + "type": "first", + "templated": false + } + ], + "disruptions": [], + "feed_publishers": [ + { + "url": "", + "id": "sncf", + "license": "Private (unspecified)", + "name": "SNCF PIV Production" + }, + { + "url": "", + "id": "SNCF:sncf-piv", + "license": "Private (unspecified)", + "name": "SNCF PIV Production" + } + ], + "context": { + "timezone": "Europe/Paris", + "current_datetime": "20210906T224334" + }, + "stop_areas": [ + { + "codes": [ + { + "type": "secondary_id", + "value": "SNCF:87144758" + }, + { + "type": "secondary_id", + "value": "SNCF:87407536" + }, + { + "type": "secondary_id", + "value": "SNCF:87641241" + }, + { + "type": "secondary_id", + "value": "SNCF:87714089" + }, + { + "type": "secondary_id", + "value": "SNCF:87757005" + }, + { + "type": "secondary_id", + "value": "SNCF:87781567" + }, + { + "type": "source", + "value": "87144758" + }, + { + "type": "source", + "value": "87407536" + }, + { + "type": "source", + "value": "87420802" + }, + { + "type": "source", + "value": "87641241" + }, + { + "type": "source", + "value": "87714089" + }, + { + "type": "source", + "value": "87757005" + }, + { + "type": "source", + "value": "87781567" + } + ], + "name": "", + "links": [], + "coord": { + "lat": "0", + "lon": "0" + }, + "label": "", + "timezone": "Europe/Paris", + "id": "stop_area:SNCF:87420802" + }, + { + "codes": [ + { + "type": "source", + "value": "87313759" + }, + { + "type": "uic", + "value": "87313759" + } + ], + "name": "Abancourt", + "links": [], + "coord": { + "lat": "49.685602", + "lon": "1.774351" + }, + "label": "Abancourt (Abancourt)", + "administrative_regions": [ + { + "insee": "60001", + "name": "Abancourt", + "level": 8, + "coord": { + "lat": "49.6977145", + "lon": "1.7646826" + }, + "label": "Abancourt (60220)", + "id": "admin:fr:60001", + "zip_code": "60220" + } + ], + "timezone": "Europe/Paris", + "id": "stop_area:SNCF:87313759" + }, + { + "codes": [ + { + "type": "source", + "value": "87481614" + }, + { + "type": "uic", + "value": "87481614" + } + ], + "name": "Abbaretz", + "links": [], + "coord": { + "lat": "47.555241", + "lon": "-1.524289" + }, + "label": "Abbaretz (Abbaretz)", + "administrative_regions": [ + { + "insee": "44001", + "name": "Abbaretz", + "level": 8, + "coord": { + "lat": "47.5525545", + "lon": "-1.5322775" + }, + "label": "Abbaretz (44170)", + "id": "admin:fr:44001", + "zip_code": "44170" + } + ], + "timezone": "Europe/Paris", + "id": "stop_area:SNCF:87481614" + }, + { + "codes": [ + { + "type": "source", + "value": "87317362" + }, + { + "type": "uic", + "value": "87317362" + } + ], + "name": "Abbeville", + "links": [], + "coord": { + "lat": "50.102216", + "lon": "1.824487" + }, + "label": "Abbeville (Abbeville)", + "administrative_regions": [ + { + "insee": "80001", + "name": "Abbeville", + "level": 8, + "coord": { + "lat": "50.1060835", + "lon": "1.8337029" + }, + "label": "Abbeville (80100)", + "id": "admin:fr:80001", + "zip_code": "80100" + } + ], + "timezone": "Europe/Paris", + "id": "stop_area:SNCF:87317362" + } + ] +} diff --git a/pkg/navitia_api_client/test_data/4-train-stops-page-1.json b/pkg/navitia_api_client/test_data/4-train-stops-page-1.json new file mode 100644 index 0000000..c57b85b --- /dev/null +++ b/pkg/navitia_api_client/test_data/4-train-stops-page-1.json @@ -0,0 +1,239 @@ +{ + "pagination": { + "start_page": 1, + "items_on_page": 4, + "items_per_page": 4, + "total_result": 12 + }, + "links": [ + { + "href": "https://api.sncf.com/v1/coverage/sncf/stop_areas/{stop_areas.id}", + "type": "stop_areas", + "rel": "stop_areas", + "templated": true + }, + { + "href": "https://api.sncf.com/v1/coverage/sncf/stop_areas/{stop_areas.id}/route_schedules", + "type": "route_schedules", + "rel": "route_schedules", + "templated": true + }, + { + "href": "https://api.sncf.com/v1/coverage/sncf/stop_areas/{stop_areas.id}/stop_schedules", + "type": "stop_schedules", + "rel": "stop_schedules", + "templated": true + }, + { + "href": "https://api.sncf.com/v1/coverage/sncf/stop_areas/{stop_areas.id}/arrivals", + "type": "arrivals", + "rel": "arrivals", + "templated": true + }, + { + "href": "https://api.sncf.com/v1/coverage/sncf/stop_areas/{stop_areas.id}/departures", + "type": "departures", + "rel": "departures", + "templated": true + }, + { + "href": "https://api.sncf.com/v1/coverage/sncf/stop_areas/{stop_areas.id}/places_nearby", + "type": "places_nearby", + "rel": "places_nearby", + "templated": true + }, + { + "href": "https://api.sncf.com/v1/coverage/sncf/stop_areas/{stop_areas.id}/journeys", + "type": "journey", + "rel": "journeys", + "templated": true + }, + { + "href": "https://api.sncf.com/v1/coverage/sncf/stop_areas/{stop_areas.id}/traffic_reports", + "type": "disruption", + "rel": "disruptions", + "templated": true + }, + { + "href": "https://api.sncf.com/v1/coverage/sncf/stop_areas?count=4&start_page=0", + "type": "previous", + "templated": false + }, + { + "href": "https://api.sncf.com/v1/coverage/sncf/stop_areas?count=4&start_page=2", + "type": "next", + "templated": false + }, + { + "href": "https://api.sncf.com/v1/coverage/sncf/stop_areas?count=4&start_page=1280", + "type": "last", + "templated": false + }, + { + "href": "https://api.sncf.com/v1/coverage/sncf/stop_areas?count=4", + "type": "first", + "templated": false + } + ], + "disruptions": [], + "feed_publishers": [ + { + "url": "", + "id": "sncf", + "license": "Private (unspecified)", + "name": "SNCF PIV Production" + }, + { + "url": "", + "id": "SNCF:sncf-piv", + "license": "Private (unspecified)", + "name": "SNCF PIV Production" + } + ], + "context": { + "timezone": "Europe/Paris", + "current_datetime": "20210906T212057" + }, + "stop_areas": [ + { + "codes": [ + { + "type": "source", + "value": "87545269" + }, + { + "type": "uic", + "value": "87545269" + } + ], + "name": "Ablon", + "links": [], + "coord": { + "lat": "48.725443", + "lon": "2.419213" + }, + "label": "Ablon (Ablon-sur-Seine)", + "administrative_regions": [ + { + "insee": "94001", + "name": "Ablon-sur-Seine", + "level": 8, + "coord": { + "lat": "48.7247582", + "lon": "2.421509" + }, + "label": "Ablon-sur-Seine (94480)", + "id": "admin:fr:94001", + "zip_code": "94480" + } + ], + "timezone": "Europe/Paris", + "id": "stop_area:SNCF:87545269" + }, + { + "codes": [ + { + "type": "source", + "value": "87590588" + }, + { + "type": "uic", + "value": "87590588" + } + ], + "name": "Ablon Noctilien", + "links": [], + "coord": { + "lat": "48.72551", + "lon": "2.419155" + }, + "label": "Ablon Noctilien (Ablon-sur-Seine)", + "administrative_regions": [ + { + "insee": "94001", + "name": "Ablon-sur-Seine", + "level": 8, + "coord": { + "lat": "48.7247582", + "lon": "2.421509" + }, + "label": "Ablon-sur-Seine (94480)", + "id": "admin:fr:94001", + "zip_code": "94480" + } + ], + "timezone": "Europe/Paris", + "id": "stop_area:SNCF:87590588" + }, + { + "codes": [ + { + "type": "source", + "value": "87191403" + }, + { + "type": "uic", + "value": "87191403" + } + ], + "name": "Aboncourt Mairie", + "links": [], + "coord": { + "lat": "49.261076", + "lon": "6.346603" + }, + "label": "Aboncourt Mairie (Aboncourt)", + "administrative_regions": [ + { + "insee": "57001", + "name": "Aboncourt", + "level": 8, + "coord": { + "lat": "49.2602817", + "lon": "6.3463759" + }, + "label": "Aboncourt (57920)", + "id": "admin:fr:57001", + "zip_code": "57920" + } + ], + "timezone": "Europe/Paris", + "id": "stop_area:SNCF:87191403" + }, + { + "codes": [ + { + "type": "source", + "value": "87721944" + }, + { + "type": "uic", + "value": "87721944" + } + ], + "name": "Abrest Mairie", + "links": [], + "coord": { + "lat": "46.098868", + "lon": "3.444791" + }, + "label": "Abrest Mairie (Abrest)", + "administrative_regions": [ + { + "insee": "3001", + "name": "Abrest", + "level": 8, + "coord": { + "lat": "46.0980139", + "lon": "3.4450434" + }, + "label": "Abrest (03200)", + "id": "admin:fr:3001", + "zip_code": "03200" + } + ], + "timezone": "Europe/Paris", + "id": "stop_area:SNCF:87721944" + } + ] +} diff --git a/pkg/navitia_api_client/test_data/4-train-stops-page-2.json b/pkg/navitia_api_client/test_data/4-train-stops-page-2.json new file mode 100644 index 0000000..5d0952c --- /dev/null +++ b/pkg/navitia_api_client/test_data/4-train-stops-page-2.json @@ -0,0 +1,239 @@ +{ + "pagination": { + "start_page": 2, + "items_on_page": 4, + "items_per_page": 4, + "total_result": 12 + }, + "links": [ + { + "href": "https://api.sncf.com/v1/coverage/sncf/stop_areas/{stop_areas.id}", + "type": "stop_areas", + "rel": "stop_areas", + "templated": true + }, + { + "href": "https://api.sncf.com/v1/coverage/sncf/stop_areas/{stop_areas.id}/route_schedules", + "type": "route_schedules", + "rel": "route_schedules", + "templated": true + }, + { + "href": "https://api.sncf.com/v1/coverage/sncf/stop_areas/{stop_areas.id}/stop_schedules", + "type": "stop_schedules", + "rel": "stop_schedules", + "templated": true + }, + { + "href": "https://api.sncf.com/v1/coverage/sncf/stop_areas/{stop_areas.id}/arrivals", + "type": "arrivals", + "rel": "arrivals", + "templated": true + }, + { + "href": "https://api.sncf.com/v1/coverage/sncf/stop_areas/{stop_areas.id}/departures", + "type": "departures", + "rel": "departures", + "templated": true + }, + { + "href": "https://api.sncf.com/v1/coverage/sncf/stop_areas/{stop_areas.id}/places_nearby", + "type": "places_nearby", + "rel": "places_nearby", + "templated": true + }, + { + "href": "https://api.sncf.com/v1/coverage/sncf/stop_areas/{stop_areas.id}/journeys", + "type": "journey", + "rel": "journeys", + "templated": true + }, + { + "href": "https://api.sncf.com/v1/coverage/sncf/stop_areas/{stop_areas.id}/traffic_reports", + "type": "disruption", + "rel": "disruptions", + "templated": true + }, + { + "href": "https://api.sncf.com/v1/coverage/sncf/stop_areas?count=4&start_page=1", + "type": "previous", + "templated": false + }, + { + "href": "https://api.sncf.com/v1/coverage/sncf/stop_areas?count=4&start_page=3", + "type": "next", + "templated": false + }, + { + "href": "https://api.sncf.com/v1/coverage/sncf/stop_areas?count=4&start_page=1280", + "type": "last", + "templated": false + }, + { + "href": "https://api.sncf.com/v1/coverage/sncf/stop_areas?count=4", + "type": "first", + "templated": false + } + ], + "disruptions": [], + "feed_publishers": [ + { + "url": "", + "id": "sncf", + "license": "Private (unspecified)", + "name": "SNCF PIV Production" + }, + { + "url": "", + "id": "SNCF:sncf-piv", + "license": "Private (unspecified)", + "name": "SNCF PIV Production" + } + ], + "context": { + "timezone": "Europe/Paris", + "current_datetime": "20210906T212107" + }, + "stop_areas": [ + { + "codes": [ + { + "type": "source", + "value": "87677252" + }, + { + "type": "uic", + "value": "87677252" + } + ], + "name": "Accolay Le Pont", + "links": [], + "coord": { + "lat": "47.663798", + "lon": "3.709584" + }, + "label": "Accolay Le Pont (Deux Rivières)", + "administrative_regions": [ + { + "insee": "89130", + "name": "Deux Rivières", + "level": 8, + "coord": { + "lat": "47.6839847", + "lon": "3.6898895" + }, + "label": "Deux Rivières", + "id": "admin:fr:89130", + "zip_code": "" + } + ], + "timezone": "Europe/Paris", + "id": "stop_area:SNCF:87677252" + }, + { + "codes": [ + { + "type": "source", + "value": "87386052" + }, + { + "type": "uic", + "value": "87386052" + } + ], + "name": "Achères Grand Cormier", + "links": [], + "coord": { + "lat": "48.955187", + "lon": "2.091962" + }, + "label": "Achères Grand Cormier (Saint-Germain-en-Laye)", + "administrative_regions": [ + { + "insee": "78551", + "name": "Saint-Germain-en-Laye", + "level": 8, + "coord": { + "lat": "48.8990413", + "lon": "2.0942792" + }, + "label": "Saint-Germain-en-Laye", + "id": "admin:fr:78551", + "zip_code": "" + } + ], + "timezone": "Europe/Paris", + "id": "stop_area:SNCF:87386052" + }, + { + "codes": [ + { + "type": "source", + "value": "87612978" + }, + { + "type": "uic", + "value": "87612978" + } + ], + "name": "Acheres Grand Cormier Noctilien", + "links": [], + "coord": { + "lat": "48.955143", + "lon": "2.091769" + }, + "label": "Acheres Grand Cormier Noctilien (Saint-Germain-en-Laye)", + "administrative_regions": [ + { + "insee": "78551", + "name": "Saint-Germain-en-Laye", + "level": 8, + "coord": { + "lat": "48.8990413", + "lon": "2.0942792" + }, + "label": "Saint-Germain-en-Laye", + "id": "admin:fr:78551", + "zip_code": "" + } + ], + "timezone": "Europe/Paris", + "id": "stop_area:SNCF:87612978" + }, + { + "codes": [ + { + "type": "source", + "value": "87381657" + }, + { + "type": "uic", + "value": "87381657" + } + ], + "name": "Achères Ville", + "links": [], + "coord": { + "lat": "48.97011", + "lon": "2.07739" + }, + "label": "Achères Ville (Achères)", + "administrative_regions": [ + { + "insee": "78005", + "name": "Achères", + "level": 8, + "coord": { + "lat": "48.9606321", + "lon": "2.0698106" + }, + "label": "Achères (78260)", + "id": "admin:fr:78005", + "zip_code": "78260" + } + ], + "timezone": "Europe/Paris", + "id": "stop_area:SNCF:87381657" + } + ] +} diff --git a/pkg/navitia_api_client/test_data/4-train-stops.json b/pkg/navitia_api_client/test_data/4-train-stops.json new file mode 100644 index 0000000..3c5a7a4 --- /dev/null +++ b/pkg/navitia_api_client/test_data/4-train-stops.json @@ -0,0 +1,264 @@ +{ + "pagination": { + "start_page": 0, + "items_on_page": 4, + "items_per_page": 4, + "total_result": 4 + }, + "links": [ + { + "href": "https://api.sncf.com/v1/coverage/sncf/stop_areas/{stop_areas.id}", + "type": "stop_areas", + "rel": "stop_areas", + "templated": true + }, + { + "href": "https://api.sncf.com/v1/coverage/sncf/stop_areas/{stop_areas.id}/route_schedules", + "type": "route_schedules", + "rel": "route_schedules", + "templated": true + }, + { + "href": "https://api.sncf.com/v1/coverage/sncf/stop_areas/{stop_areas.id}/stop_schedules", + "type": "stop_schedules", + "rel": "stop_schedules", + "templated": true + }, + { + "href": "https://api.sncf.com/v1/coverage/sncf/stop_areas/{stop_areas.id}/arrivals", + "type": "arrivals", + "rel": "arrivals", + "templated": true + }, + { + "href": "https://api.sncf.com/v1/coverage/sncf/stop_areas/{stop_areas.id}/departures", + "type": "departures", + "rel": "departures", + "templated": true + }, + { + "href": "https://api.sncf.com/v1/coverage/sncf/stop_areas/{stop_areas.id}/places_nearby", + "type": "places_nearby", + "rel": "places_nearby", + "templated": true + }, + { + "href": "https://api.sncf.com/v1/coverage/sncf/stop_areas/{stop_areas.id}/journeys", + "type": "journey", + "rel": "journeys", + "templated": true + }, + { + "href": "https://api.sncf.com/v1/coverage/sncf/stop_areas/{stop_areas.id}/traffic_reports", + "type": "disruption", + "rel": "disruptions", + "templated": true + }, + { + "href": "https://api.sncf.com/v1/coverage/sncf/stop_areas?count=4&start_page=1", + "type": "next", + "templated": false + }, + { + "href": "https://api.sncf.com/v1/coverage/sncf/stop_areas?count=4&start_page=1280", + "type": "last", + "templated": false + }, + { + "href": "https://api.sncf.com/v1/coverage/sncf/stop_areas?count=4", + "type": "first", + "templated": false + } + ], + "disruptions": [], + "feed_publishers": [ + { + "url": "", + "id": "sncf", + "license": "Private (unspecified)", + "name": "SNCF PIV Production" + }, + { + "url": "", + "id": "SNCF:sncf-piv", + "license": "Private (unspecified)", + "name": "SNCF PIV Production" + } + ], + "context": { + "timezone": "Europe/Paris", + "current_datetime": "20210906T213433" + }, + "stop_areas": [ + { + "codes": [ + { + "type": "secondary_id", + "value": "SNCF:87144758" + }, + { + "type": "secondary_id", + "value": "SNCF:87407536" + }, + { + "type": "secondary_id", + "value": "SNCF:87641241" + }, + { + "type": "secondary_id", + "value": "SNCF:87714089" + }, + { + "type": "secondary_id", + "value": "SNCF:87757005" + }, + { + "type": "secondary_id", + "value": "SNCF:87781567" + }, + { + "type": "source", + "value": "87144758" + }, + { + "type": "source", + "value": "87407536" + }, + { + "type": "source", + "value": "87420802" + }, + { + "type": "source", + "value": "87641241" + }, + { + "type": "source", + "value": "87714089" + }, + { + "type": "source", + "value": "87757005" + }, + { + "type": "source", + "value": "87781567" + } + ], + "name": "", + "links": [], + "coord": { + "lat": "0", + "lon": "0" + }, + "label": "", + "timezone": "Europe/Paris", + "id": "stop_area:SNCF:87420802" + }, + { + "codes": [ + { + "type": "source", + "value": "87313759" + }, + { + "type": "uic", + "value": "87313759" + } + ], + "name": "Abancourt", + "links": [], + "coord": { + "lat": "49.685602", + "lon": "1.774351" + }, + "label": "Abancourt (Abancourt)", + "administrative_regions": [ + { + "insee": "60001", + "name": "Abancourt", + "level": 8, + "coord": { + "lat": "49.6977145", + "lon": "1.7646826" + }, + "label": "Abancourt (60220)", + "id": "admin:fr:60001", + "zip_code": "60220" + } + ], + "timezone": "Europe/Paris", + "id": "stop_area:SNCF:87313759" + }, + { + "codes": [ + { + "type": "source", + "value": "87481614" + }, + { + "type": "uic", + "value": "87481614" + } + ], + "name": "Abbaretz", + "links": [], + "coord": { + "lat": "47.555241", + "lon": "-1.524289" + }, + "label": "Abbaretz (Abbaretz)", + "administrative_regions": [ + { + "insee": "44001", + "name": "Abbaretz", + "level": 8, + "coord": { + "lat": "47.5525545", + "lon": "-1.5322775" + }, + "label": "Abbaretz (44170)", + "id": "admin:fr:44001", + "zip_code": "44170" + } + ], + "timezone": "Europe/Paris", + "id": "stop_area:SNCF:87481614" + }, + { + "codes": [ + { + "type": "source", + "value": "87317362" + }, + { + "type": "uic", + "value": "87317362" + } + ], + "name": "Abbeville", + "links": [], + "coord": { + "lat": "50.102216", + "lon": "1.824487" + }, + "label": "Abbeville (Abbeville)", + "administrative_regions": [ + { + "insee": "80001", + "name": "Abbeville", + "level": 8, + "coord": { + "lat": "50.1060835", + "lon": "1.8337029" + }, + "label": "Abbeville (80100)", + "id": "admin:fr:80001", + "zip_code": "80100" + } + ], + "timezone": "Europe/Paris", + "id": "stop_area:SNCF:87317362" + } + ] +} -- cgit v1.2.3