Skip to main content

Module client

Module client 

Source
Expand description

HTTP client for the Nordnet External API.

Wraps reqwest::Client with:

  • Base URL composition ({base}/{path} with leading-slash tolerated).
  • Authorization: Basic <session_key:session_key> injection when a Session is attached.
  • Single response-parsing path so every method routes identical status-code handling.

Non-2xx responses (including 429 Too Many Requests and 503 Service Unavailable) surface to the caller as the matching Error variant. Retry policy is deliberately a caller concern โ€” the library does not sleep, retry, or hide latency. POST/PUT operations on /orders are non-idempotent; a hidden retry could double-place an order if a response is lost in flight. Callers that want backoff should wrap these methods explicitly.

No method here calls a Nordnet host directly โ€” callers supply the base URL (production, test, or a wiremock::MockServer).

Structsยง

Client
Typed HTTP client for the Nordnet API. Cheap to clone โ€” wraps a reqwest::Client and a base URL + optional session.