Tsarr Documentation - v2.16.0
    Preparing search index...

    Function bindApiClient

    • Binds a generated API namespace to one specific client instance.

      The generated client.gen.ts for each service exports a module-level singleton, and every generated operation falls back to it ((options?.client ?? client)). Configuring a wrapper by mutating that singleton means the last wrapper constructed wins: a second client silently rebinds the first one's base URL and credentials, so requests — and API keys — can go to the wrong server with no error.

      Wrapping the namespace injects a per-instance client into every call, so each wrapper is isolated. Call sites and types are unchanged.

      Type Parameters

      • T extends object

      Parameters

      • api: T
      • client: unknown

      Returns T