{"id":17368136,"url":"https://github.com/juliuste/pkp-hafas","last_synced_at":"2025-04-08T03:34:51.210Z","repository":{"id":57325397,"uuid":"246913281","full_name":"juliuste/pkp-hafas","owner":"juliuste","description":"JavaScript client for the PKP HAFAS API.","archived":true,"fork":false,"pushed_at":"2020-03-12T19:18:27.000Z","size":4,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-06T19:15:13.277Z","etag":null,"topics":["library","public-transport","railway"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"isc","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/juliuste.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"license.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-03-12T19:18:12.000Z","updated_at":"2025-04-06T19:12:02.000Z","dependencies_parsed_at":"2022-09-09T08:50:41.192Z","dependency_job_id":null,"html_url":"https://github.com/juliuste/pkp-hafas","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/juliuste%2Fpkp-hafas","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/juliuste%2Fpkp-hafas/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/juliuste%2Fpkp-hafas/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/juliuste%2Fpkp-hafas/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/juliuste","download_url":"https://codeload.github.com/juliuste/pkp-hafas/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247772938,"owners_count":20993627,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["library","public-transport","railway"],"created_at":"2024-10-15T23:58:30.896Z","updated_at":"2025-04-08T03:34:50.957Z","avatar_url":"https://github.com/juliuste.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# pkp-hafas\n\n**An API client for [_Polskie Koleje Państwowe (PKP)_](https://en.wikipedia.org/wiki/Polish_State_Railways), the major national transport provider in Poland.** It acts as a consistent and straightforward interface on top of a verbose API.\n\nThis project is actually a thin wrapper around [`hafas-client@5`](https://github.com/public-transport/hafas-client/tree/5#hafas-client). [Its docs](https://github.com/public-transport/hafas-client/tree/5/docs) document the API in general.\n\n[![npm version](https://img.shields.io/npm/v/pkp-hafas.svg)](https://www.npmjs.com/package/pkp-hafas)\n![ISC-licensed](https://img.shields.io/github/license/juliuste/pkp-hafas.svg)\n![minimum Node.js version](https://img.shields.io/node/v/pkp-hafas.svg)\n\n\n## Installing\n\n```shell\nnpm install pkp-hafas\n```\n\n\n## API\n\nCheck [the docs for `hafas-client@5`](https://github.com/public-transport/hafas-client/tree/5/docs) as well as [its PKP-specific customisations](https://github.com/public-transport/hafas-client/blob/5/p/pkp/readme.md).\n\n\n## Usage\n\n```javascript\nconst hafas = require('pkp-hafas')\n```\n\nAs an example, we will search for a route from *Kraków Główny* to *Wrocław Główny*. To get the station IDs, use [`locations(query, [opt])`](https://github.com/public-transport/hafas-client/blob/5/docs/locations.md).\n\n```javascript\nclient.journeys('5100028', '5100069', {results: 1})\n.then(({journeys}) =\u003e console.log(journeys[0]))\n.catch(console.error)\n```\n\n```javascript\n{\n    type: \"journey\",\n    legs: [\n        {\n            origin: {\n                type: \"stop\",\n                id: \"5100028\",\n                name: \"Kraków Główny\",\n                location: {\n                    type: \"location\",\n                    id: \"5100028\",\n                    latitude: 50.067192,\n                    longitude: 19.947423\n                },\n                products: {\n                    high-speed-train: true,\n                    long-distance-train: true,\n                    regional-train: true,\n                    bus: false\n                }\n            },\n            destination: {\n                type: \"stop\",\n                id: \"5100069\",\n                name: \"Wrocław Główny\",\n                location: {\n                    type: \"location\",\n                    id: \"5100069\",\n                    latitude: 51.098075,\n                    longitude: 17.037084\n                },\n                products: {\n                    high-speed-train: true,\n                    long-distance-train: true,\n                    regional-train: true,\n                    bus: false\n                }\n            },\n            arrival: \"2020-03-13T05:00:00+01:00\",\n            plannedArrival: \"2020-03-13T05:00:00+01:00\",\n            arrivalDelay: 0,\n            departure: \"2020-03-13T00:06:00+01:00\",\n            plannedDeparture: \"2020-03-13T00:06:00+01:00\",\n            departureDelay: 0,\n            reachable: true,\n            tripId: \"1|230049|0|51|12032020\",\n            line: {\n                type: \"line\",\n                id: \"tlk36170\",\n                fahrtNr: \"36170\",\n                name: \"TLK36170\",\n                public: true,\n                adminCode: \"51IC__\",\n                mode: \"train\",\n                product: \"long-distance-train\",\n                operator: {\n                    type: \"operator\",\n                    id: \"pkp-intercity\",\n                    name: \"PKP Intercity\"\n                }\n            },\n            direction: null,\n            arrivalPlatform: null,\n            plannedArrivalPlatform: null,\n            departurePlatform: null,\n            plannedDeparturePlatform: null\n        }\n    ],\n    refreshToken: \"¶HKI¶T$A=1@O=Kraków Główny@L=5100028@a=128@$A=1@O=Wrocław Główny@L=5100069@a=128@$202003130006$202003130500$TLK36170$$1$\"\n}\n```\n\n## Related\n\nCheck [`hafas-client`'s related libs](https://github.com/public-transport/hafas-client/blob/master/readme.md#related).\n\n## Contributing\n\nIf you **have a question**, **found a bug** or want to **propose a feature**, have a look at [the issues page](https://github.com/juliuste/pkp-hafas/issues).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjuliuste%2Fpkp-hafas","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjuliuste%2Fpkp-hafas","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjuliuste%2Fpkp-hafas/lists"}