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

    Class RequestEngine

    Index
    • Build a fully-qualified URL from a path (parameters travel in the body).

      Parameters

      • path: string

      Returns string

    • POST form-encoded params (with credential headers) and parse the JSON reply, which must have the GENESIS envelope unless shape says otherwise.

      Type Parameters

      • T

      Parameters

      Returns Promise<T>

    • POST helloworld/logincheck and evaluate the answer (loginVerdict, P18): resolves only when GENESIS confirms the login. Rejected credentials — live an HTTP 200 whose Status is an error text, the token echoed as Username — reject with a RegionalstatistikApiError whose loginRejected (and so isAuthError) is true; an answer that confirms nothing is a RegionalstatistikParseError. The 401/404 auth answers and the transport errors keep their usual mapping.

      Type Parameters

      • T

      Parameters

      • path: string
      • params: QueryParams
      • authHeaders: Record<string, string>

      Returns Promise<T>

    • POST form-encoded params and return the raw bytes (file / binary downloads).

      A data/*file endpoint answers with a file (a ZIP wrapper), so a JSON or empty reply is never a download: it is a GENESIS status the server sent instead of the file (a credential, "too large" or "no such object" reply), and handing it back would let a caller save {"Status":…} as x.zip.

      • an empty body → RegionalstatistikParseError;
      • a JSON body with a GENESIS status (enveloped or flat) → the logical-error mapping (90, 98, error Type), and otherwise a RegionalstatistikApiError with that status — including 104 ("keine Objekte"), which for a download means "no such object" (isNotFound, exit 4 in the CLI);
      • any other JSON, or a body labelled JSON that does not parse → RegionalstatistikParseError. A body counts as JSON when its Content-Type says so or it starts with { (after an optional UTF-8 BOM), whatever the Content-Type claims.

      Parameters

      • path: string
      • accept: string
      • params: QueryParams
      • authHeaders: Record<string, string>

      Returns Promise<RawResponse>