This repository has been archived by the owner on Apr 10, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #19 from andaryjo/derhuerst-tweaks
Incorporate changes from @derhuerst
- Loading branch information
Showing
20 changed files
with
1,503 additions
and
8,108 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# editorconfig.org | ||
root = true | ||
|
||
[*] | ||
end_of_line = lf | ||
charset = utf-8 | ||
trim_trailing_whitespace = true | ||
insert_final_newline = true | ||
|
||
[**.{ts, json}] | ||
indent_style = spaces | ||
indent_size = 4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{ | ||
"root": true, | ||
"parser": "@typescript-eslint/parser", | ||
"env": { | ||
"node": true | ||
}, | ||
"plugins": [ | ||
"@typescript-eslint", | ||
"jest" | ||
], | ||
"extends": [ | ||
"eslint:recommended", | ||
"plugin:@typescript-eslint/recommended", | ||
"plugin:jest/recommended", | ||
"prettier" | ||
], | ||
"rules": { | ||
"@typescript-eslint/no-unused-vars": "off" | ||
}, | ||
"ignorePatterns": [ | ||
"lib" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
{ | ||
"printWidth": 200, | ||
"tabWidth": 4, | ||
"trailingComma": "all" | ||
"trailingComma": "all", | ||
"singleQuote": false | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import { inspect } from "util"; | ||
import { getClient } from "../lib"; | ||
|
||
const sbbProfile = { | ||
// Test environment of SBB | ||
// See here: https://opentransportdata.swiss/de/cookbook/abfahrts-ankunftsanzeiger/ | ||
url: "https://api.opentransportdata.swiss/trias2020", | ||
requestorRef: "trias-client", | ||
headers: { | ||
authorization: "57c5dbbbf1fe4d000100001842c323fa9ff44fbba0b9b925f0c052d1", | ||
} | ||
}; | ||
|
||
const zürich = "8503000"; | ||
const luzern = "8505000"; | ||
const aarau = "8502113"; | ||
|
||
const client = getClient(sbbProfile); | ||
|
||
// To Do: Add examples for station search and departures | ||
|
||
async () => { | ||
const journeys = await client.getJourneys({ | ||
origin: zürich, | ||
destination: luzern, | ||
via: [aarau], | ||
departureTime: "2021-05-20T14:00+02:00", | ||
maxResults: 2, | ||
includeFares: true, | ||
}); | ||
|
||
console.log(inspect(journeys, { depth: null, colors: true })); | ||
}; |
Oops, something went wrong.