@maschinenlesbar.org/autobahn-cli
    Preparing search index...

    Interface ServiceResource<K>

    One Autobahn service (roadworks, webcam, ...). list(roadId) returns the items along a motorway; get(id) returns one item's full details.

    interface ServiceResource<K extends string> {
        get(identifier: string): Promise<JsonObject>;
        list(roadId: string): Promise<AutobahnServiceItem[]>;
    }

    Type Parameters

    • K extends string

      the envelope key the listing endpoint wraps its array in.

    Index
    • Fetch one item's details by its identifier (an opaque string; the format varies by service). Surrounding whitespace is trimmed, as list() does for road ids: no identifier the API issues has any, so a stray space from a copy-paste would otherwise read as "not found". An identifier containing "/" is rejected like such a road id (idProblem): "x/../<id>" would otherwise resolve to <id>. A 2xx body that is not a JSON object, or one whose identifier is not the one asked for, raises AutobahnParseError.

      Parameters

      • identifier: string

      Returns Promise<JsonObject>

    • List the service's items along a motorway, e.g. roadId "A1". Road ids are case-sensitive. The API answers an unknown id (A999, a1) exactly like a road without items, so an empty listing is checked against roads(): an id not in that list raises AutobahnNotFoundError (with a did-you-mean for a case slip, a space or dash, or a leading zero) instead of returning []. That check is a second request (with its own timeout and retries); if it fails, list() throws an AutobahnError naming the check, with the original error as cause.

      Parameters

      • roadId: string

      Returns Promise<AutobahnServiceItem[]>