public-transport / hafas-client

JavaScript client for HAFAS public transport APIs.
ISC License
262 stars 52 forks source link

parse global remarks #168

Open derhuerst opened 4 years ago

derhuerst commented 4 years ago

This response has a res.globMsgL list. These are usually displayed at the very top or bottom of the app/website.

I'm not sure how to expose this yet, though.

{
    "common": {
        "locL": [
            {
                "lid": "A=1@O=Bad Schandau@X=14137542@Y=50919289@U=80@L=8010022@",
                "type": "S",
                "name": "Bad Schandau",
                "icoX": 3,
                "extId": "8010022",
                "state": "F",
                "crd": {
                    "x": 14139861,
                    "y": 50918741,
                    "z": 0,
                    "type": "WGS84",
                    "layerX": 0,
                    "crdSysX": 0
                },
                "pCls": 123,
                "pRefL": [
                    1,
                    2,
                    3,
                    4,
                    5,
                    6,
                    7,
                    8,
                    9,
                    10,
                    11,
                    12,
                    13,
                    14,
                    15
                ]
            },
            {
                "lid": "A=1@O=Decin hl.n.@X=14201249@Y=50773412@U=80@L=5400003@",
                "type": "S",
                "name": "Decin hl.n.",
                "icoX": 3,
                "extId": "5400003",
                "state": "F",
                "crd": {
                    "x": 14201527,
                    "y": 50773987,
                    "z": 0,
                    "type": "WGS84",
                    "layerX": 0,
                    "crdSysX": 0
                },
                "pCls": 15
            }
        ],
        "prodL": [
            {
                "name": "RB 5454",
                "nameS": "RB",
                "number": "5454",
                "icoX": 1,
                "cls": 8,
                "oprX": 0,
                "prodCtx": {
                    "name": "RB  5454",
                    "num": "5454",
                    "matchId": "U28",
                    "catOut": "RB",
                    "catOutS": "RB",
                    "catOutL": "Regionalbahn",
                    "catIn": "RB",
                    "catCode": "3",
                    "admin": "800417",
                    "addName": "RB   U28"
                },
                "addName": "RB U28"
            },
            {
                "name": "RJ",
                "icoX": 3,
                "cls": 1
            },
            {
                "name": "EC",
                "icoX": 4,
                "cls": 2
            },
            {
                "name": "Bus S1",
                "nameS": "S1",
                "icoX": 5,
                "cls": 8,
                "prodCtx": {
                    "lineId": "3_SD_____S1!!1549560!!5669209"
                }
            },
            {
                "name": "Bus U28",
                "nameS": "U28",
                "icoX": 5,
                "cls": 8,
                "prodCtx": {
                    "lineId": "3_SD_____U28"
                }
            },
            {
                "name": "RB",
                "icoX": 1,
                "cls": 8
            },
            {
                "name": "RE",
                "icoX": 6,
                "cls": 8
            },
            {
                "name": "S 1",
                "nameS": "1",
                "icoX": 7,
                "cls": 16,
                "prodCtx": {
                    "lineId": "4_800469_1"
                }
            },
            {
                "name": "Bus 241",
                "nameS": "241",
                "icoX": 5,
                "cls": 32,
                "prodCtx": {
                    "lineId": "5_voeBU4_241"
                }
            },
            {
                "name": "Bus 251",
                "nameS": "251",
                "icoX": 5,
                "cls": 32,
                "prodCtx": {
                    "lineId": "5_voeBU4_251"
                }
            },
            {
                "name": "Bus 252",
                "nameS": "252",
                "icoX": 5,
                "cls": 32,
                "prodCtx": {
                    "lineId": "5_voeBU4_252"
                }
            },
            {
                "name": "Bus 253",
                "nameS": "253",
                "icoX": 5,
                "cls": 32,
                "prodCtx": {
                    "lineId": "5_voeBU4_253"
                }
            },
            {
                "name": "Bus 260",
                "nameS": "260",
                "icoX": 5,
                "cls": 32,
                "prodCtx": {
                    "lineId": "5_voeBU4_260"
                }
            },
            {
                "name": "Bus 244a",
                "nameS": "244a",
                "icoX": 5,
                "cls": 32,
                "prodCtx": {
                    "lineId": "5_voeBU4_244a"
                }
            },
            {
                "name": "Bus 244b",
                "nameS": "244b",
                "icoX": 5,
                "cls": 32,
                "prodCtx": {
                    "lineId": "5_voeBU4_244b"
                }
            },
            {
                "name": "Fähre",
                "nameS": "F 5",
                "icoX": 8,
                "cls": 64,
                "prodCtx": {
                    "lineId": "6_voeFAE_F5"
                }
            }
        ],
        "polyL": [],
        "layerL": [
            {
                "id": "standard",
                "name": "standard",
                "index": 0,
                "annoCnt": 0
            }
        ],
        "crdSysL": [
            {
                "id": "standard",
                "index": 0,
                "type": "WGS84",
                "dim": 3
            }
        ],
        "opL": [
            {
                "name": "DB Regio AG Südost",
                "icoX": 2
            }
        ],
        "remL": [
            {
                "type": "M",
                "code": "",
                "icoX": 0,
                "txtS": "Decin hl.n.->Rumburk: Störung.   ",
                "txtN": "Aufgrund des für die Tschechische Republik ausgerufenen nationalen Notstands kommt es zu Fahrplanabweichungen auf der Linie U 28. Der Zug fällt zwischen Decín hl.n. (CZ) und Sebnitz(Sachs) aus. Ersatzvekehr mit Bus zwischen Decín hl.n. (CZ) und Dolní Zleb (CZ) sowie zwischen Bad Schandau und Sebnitz(SachS). Zwischen Schöna und Bad Schandau nutzen Sie bitte die Züge der Linie S 1. Weitere Informationen finden Sie unter bahn.de/aktuell"
            },
            {
                "type": "P",
                "code": "",
                "icoX": 9,
                "txtN": "Journey cancelled"
            }
        ],
        "icoL": [
            {
                "res": "HimWarn"
            },
            {
                "res": "RB"
            },
            {
                "res": "RE",
                "txt": "DB Regio AG Südost"
            },
            {
                "res": "RJ"
            },
            {
                "res": "EC"
            },
            {
                "res": "Bus"
            },
            {
                "res": "RE"
            },
            {
                "res": "S"
            },
            {
                "res": "Fähre"
            },
            {
                "res": "cancel"
            }
        ]
    },
    "type": "DEP",
    "jnyL": [
        {
            "jid": "1|277209|0|80|16032020",
            "date": "20200316",
            "prodX": 0,
            "dirTxt": "Decin hl.n.",
            "status": "P",
            "isPartCncl": true,
            "isRchbl": true,
            "stbStop": {
                "locX": 0,
                "idx": 18,
                "dProdX": 0,
                "dInR": false,
                "dTimeS": "205300",
                "dCncl": true,
                "dTZOffset": 60,
                "type": "N"
            },
            "msgL": [
                {
                    "type": "REM",
                    "remX": 1,
                    "txtC": {
                        "r": 204,
                        "g": 0,
                        "b": 0,
                        "a": 255
                    },
                    "prio": 373,
                    "fIdx": -1,
                    "tIdx": -1,
                    "tagL": [
                        "RES_JNY_H3"
                    ]
                }
            ],
            "subscr": "F"
        }
    ],
    "globMsgL": [
        {
            "type": "REM",
            "remX": 0,
            "prio": 100,
            "fIdx": -1,
            "tIdx": -1,
            "tagL": [
                "SUM_GLB_HDR_H3"
            ]
        }
    ],
    "fpB": "20191215",
    "fpE": "20201212",
    "planrtTS": "1584388095",
    "sD": "20200316",
    "sT": "204926"
}
derhuerst commented 3 years ago

related: The Deutsche Bahn official Timetable API docs have codes on the last 2 pages.