https://github.com/maelgangloff/stan-api
Support non officiel de l'API du Service de Transport de l'Agglomération Nancéienne (STAN)
https://github.com/maelgangloff/stan-api
api nancy nodejs stan transport
Last synced: 4 months ago
JSON representation
Support non officiel de l'API du Service de Transport de l'Agglomération Nancéienne (STAN)
- Host: GitHub
- URL: https://github.com/maelgangloff/stan-api
- Owner: maelgangloff
- License: gpl-3.0
- Created: 2022-07-02T12:07:16.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2024-02-19T22:32:06.000Z (over 2 years ago)
- Last Synced: 2025-10-05T11:47:10.856Z (9 months ago)
- Topics: api, nancy, nodejs, stan, transport
- Language: TypeScript
- Homepage: https://www.npmjs.com/package/stan-api
- Size: 86.9 KB
- Stars: 10
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Citation: CITATION.cff
Awesome Lists containing this project
README
## Stan
Support non officiel de l'API du Service de Transport de l'Agglomération Nancéienne (STAN).
Ce module permet de récupérer:
- les prochains passages
- les lignes
- les directions
- les arrêts
**Kind**: global class
* [Stan](#Stan)
* [.getLignes()](#Stan.getLignes) ⇒ Promise.<Array.<Ligne>>
* [.getArrets(ligne)](#Stan.getArrets) ⇒ Promise.<Array.<Arret>>
* [.getProchainsPassages(arret)](#Stan.getProchainsPassages) ⇒ Promise.<Array.<Passage>>
* [.getDirections(ligne)](#Stan.getDirections) ⇒ Promise.<Array.<Direction>>
* [.getArretsDirection(direction)](#Stan.getArretsDirection) ⇒ Promise.<Array.<Arret>>
### Stan.getLignes() ⇒ Promise.<Array.<Ligne>>
Lister les lignes du réseau de transport
**Kind**: static method of [Stan](#Stan)
**Example**
```js
const { Stan } = require('stan-api')
Stan.getLignes().then(lignes => console.log(lignes))
```
### Stan.getArrets(ligne) ⇒ Promise.<Array.<Arret>>
Liste des arrêts d'une ligne
NB: Un arret peut être commun à plusieurs lignes.
**Kind**: static method of [Stan](#Stan)
| Param | Type | Description |
| --- | --- | --- |
| ligne | Ligne | Ligne |
**Example**
```js
const { Stan } = require('stan-api')
const ligneT4 = {
id: 2332,
numlignepublic: 'T4',
osmid: 'line:GST:4-97',
libelle: 'Tempo 4 - Laxou CLB <> Houdemont Porte Sud'
}
Stan.getArrets(ligneT4).then(arrets => console.log(arrets))
```
### Stan.getProchainsPassages(arret) ⇒ Promise.<Array.<Passage>>
Lister les prochains passages d'un arrêt avec le temps d'attente estimé.
Il n'est pas nécessaire de préciser une ligne, on récupère alors tous les passages des lignes desservants l'arrêt
**Kind**: static method of [Stan](#Stan)
| Param | Type | Description |
| --- | --- | --- |
| arret | Arret | Arrêt |
**Example**
```js
const { Stan } = require('stan-api')
const arret = {
ligne: {
id: 2332,
numlignepublic: 'T4',
osmid: 'line:GST:4-97',
libelle: 'Tempo 4 - Laxou CLB <> Houdemont Porte Sud'
},
libelle: 'Place Stanislas - Dom Calmet',
osmid: 'stop_point:GST:SP:NYPCL1'
}
Stan.getProchainsPassages(arret).then(p => {
console.log(`Liste des prochains passages de l'arrêt "${arret.libelle}" de la ligne ${arret.ligne.numlignepublic}:
${p.map(passage => `${passage.direction} - Temps d'attente: ${Math.trunc(passage.temps_min/60)}H${passage.temps_min%60}min`).join('\n')}`)
})
```
```
Exemple sortie:
Liste des prochains passages de l'arrêt "Place Stanislas - Dom Calmet" de la ligne T4:
Direction Houdemont Porte Sud - Temps d'attente: 0H1min
Direction Houdemont Porte Sud - Temps d'attente: 0H8min
Direction Laxou Champ-le-Boeuf - Temps d'attente: 0H1min
Direction Laxou Champ-le-Boeuf - Temps d'attente: 0H8min
```
### Stan.getDirections(ligne) ⇒ Promise.<Array.<Direction>>
Lister les directions d'une ligne
**Kind**: static method of [Stan](#Stan)
| Param | Type | Description |
| --- | --- | --- |
| ligne | Ligne | Ligne |
**Example**
```js
const { Stan } = require('stan-api')
const ligneT4 = {
id: 2332,
numlignepublic: 'T4',
osmid: 'line:GST:4-97',
libelle: 'Tempo 4 - Laxou CLB <> Houdemont Porte Sud'
}
Stan.getDirections(ligneT4).then(directions => console.log(directions))
```
### Stan.getArretsDirection(direction) ⇒ Promise.<Array.<Arret>>
Lister les arrêts sur le chemin d'une direction d'une ligne
**Kind**: static method of [Stan](#Stan)
| Param | Type | Description |
| --- | --- | --- |
| direction | Direction | Direction d'une ligne |