@maschinenlesbar.org/ausbildungssuche-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 an AusbildungValidationError for a path with a "." or ".." segment, percent-encoded forms included ("%2e", ".%2e", "%2E%2E"). URL parsing resolves either form as a dot segment, so a path built from .. would request /pc/v1/ with the X-API-Key attached. details already accepts digits-only ids (offerIdProblem); this is the backstop for every other caller of the engine.

      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 500 characters. It never throws: describing a URL for a message or a log line does not validate it (buildUrl does).

      Parameters

      Returns string

    • GET an absolute http(s) URL, outside the base URL, with the same request policy as every other request: timeout, size cap, 429/503 retries, redirects with credential stripping, and the User-Agent and default headers. Used by obtainKey(), which builds an engine without an API key. Rejects with an AusbildungValidationError for a URL that is not http(s) (httpUrlProblem).

      Parameters

      • url: string
      • accept: string

      Returns Promise<RawResponse>

    • Perform a GET expecting JSON and parse it into T. The accept header defaults to application/json but can be overridden per endpoint (e.g. the search collection serves HAL+JSON and 406s on plain application/json). An empty (or whitespace-only) body is an AusbildungParseError: every endpoint answers with a JSON document. Every error about the answer names the request (GET <url>: …, userinfo redacted).

      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

      • path: string
      • Optionalquery: QueryParams
      • accept: string = "application/json"

      Returns Promise<T>

    • A value from an answer quoted for an error message (quoteValue), the base URL's credentials and the API key scrubbed first, before the cut: a 2xx answer (a shape the client refuses) can echo them as well as an error body. API code quotes server values with this.

      Parameters

      • value: string

      Returns string