Configuring the client
ServerConfiguration is the single value you pass to SwiftSonicClient at creation time. It bundles everything the client needs to talk to a server: where it lives, who you are, and how the HTTP plumbing should behave.
let config = ServerConfiguration( host: "music.example.com", username: "user", password: "pass")let client = SwiftSonicClient(config: config)Required fields
Section titled “Required fields”host— server hostname or full URL.username/password— credentials used to derive the per-request token.
TODO: confirm whether
hostaccepts a bare hostname, a scheme-prefixed URL, or both. Verify behaviour around trailing slashes and ports againstSources/SwiftSonic/ServerConfiguration.swift.
Optional fields
Section titled “Optional fields”ServerConfiguration exposes several optional properties for transport and behaviour tuning:
- Custom HTTP headers — see Custom HTTP transport.
- Retry policy — see Retry policy.
- Logging hook — see Logging.
TODO: enumerate the full list of optional
ServerConfigurationparameters with their defaults once verified in source.
Lifecycle
Section titled “Lifecycle”SwiftSonicClient is an actor and is safe to share across tasks. Create one instance per logical server connection and reuse it.