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

    Class RequestEngine

    Index
    bigIntegerKeys: ReadonlySet<string>

    EngineOptions.bigIntegerKeys, copied.

    • Build a fully-qualified URL from a path and optional query parameters.

      Throws a FdsError for a path with a "." or ".." segment. The resource methods put ids into the path with encodeURIComponent, which leaves those two unchanged, and URL parsing then resolves them: requests.get(".") would request /api/v1/request/ (the list) and get("..") the API root. Neither can name a resource. (Percent-encoded forms such as "%2e%2e" are safe: encodeURIComponent turns their "%" into "%25".)

      Parameters

      Returns string

    • The request URL as error messages show it: absolute (so a message names the host that gave a bad answer, which matters with a custom base URL), userinfo redacted and cut at MAX_MESSAGE_VALUE_LENGTH characters. It never throws: describing a URL for a message does not validate it (buildUrl does).

      Parameters

      Returns string

    • Perform a GET expecting JSON and parse it into T. With shape, the parsed value must have the documented form (responseShapeProblem), or the call throws an FdsParseError: a null, {}, {"detail": "Wartung"} or an array answered with a 2xx would otherwise be printed as data with exit 0, or read as "nothing found".

      The text is never changed silently: bytes that are not valid in the charset, and lone surrogates written as JSON escapes (\ud800), are replaced with U+FFFD, so the result is well-formed text (jq rejects a lone surrogate, and with it the whole output), and onWarning is told how many. One bad character never sinks a whole answer.

      Type Parameters

      • T

      Parameters

      Returns Promise<T>

    • Perform a GET returning the raw bytes (the server-rendered CSV). An HTML page (a maintenance or login page, a proxy's error page) or a JSON body answered with a 2xx to a CSV request is an FdsParseError naming the request, not a download: the CLI would otherwise print it, or save it over the user's -o file, with exit 0. The response carries request (GET <url>, userinfo redacted), for a message about its text.

      Parameters

      • path: string
      • accept: string
      • Optionalquery: QueryParams

      Returns Promise<RawResponse>

    • Perform a request with Accept negotiation and transient-error retries. A query with a blank value (or blank parameter name) is rejected with an FdsValidationError before anything is sent: the API reads an empty parameter as "no filter" and would answer with the unfiltered dataset.

      Parameters

      • method: string
      • path: string
      • options: { accept: string; query?: QueryParams } = ...

      Returns Promise<RawResponse>