Replace the atomic counter-based request ID generation with random
int64 values using math/rand/v2. This improves unpredictability and
avoids potential ID collisions across client instances or restarts.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Support configuring a custom HTTP header name for authentication
(e.g., X-API-Auth instead of Authorization) for Kanboard servers
with specific proxy configurations that use alternative auth headers.
- Add headerName field to apiTokenAuth and basicAuth structs
- Add WithAuthHeader() fluent method to Client
- Auth methods pass custom header name when creating auth structs
- Add tests for custom header with API token, basic auth, and custom user
Closes kanboard-9wa
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add user field to apiTokenAuth struct
- Add WithAPITokenUser(token, user) method for custom username
- Default to "jsonrpc" when no user specified (backward compatible)
- Add tests for custom user and empty user scenarios
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add full client configuration with fluent builder pattern:
- WithTimeout(duration) - configurable request timeout
- WithLogger(slog.Logger) - optional debug logging
- DefaultTimeout constant (30 seconds)
- Default HTTP client with timeout on construction
All fluent methods return same client instance for chaining.
Client is thread-safe for concurrent use.
Closes: kanboard-api-uls
Add core JSON-RPC 2.0 protocol implementation for Kanboard API:
- JSONRPCRequest/Response/Error structs with proper JSON tags
- Generic call() method for sending requests and parsing responses
- Thread-safe request ID generation using atomic.Int64
- Automatic /jsonrpc.php path appending to baseURL
- Support for subdirectory installations
- HTTP Basic Auth support (API token and username/password)
- Error handling for unauthorized/forbidden responses
Includes comprehensive tests with httptest mock server.
Closes: kanboard-api-2g1