2025-12-05 21:33:23 -06:00
|
|
|
package onspring
|
|
|
|
|
|
|
|
|
|
import "net/http"
|
|
|
|
|
|
2026-01-15 16:38:47 -06:00
|
|
|
// ClientOption is a functional option for configuring a Client.
|
|
|
|
|
type ClientOption func(*Client)
|
2025-12-05 21:33:23 -06:00
|
|
|
|
|
|
|
|
// WithHTTPClient sets a custom HTTP client for the Onspring client.
|
|
|
|
|
// If not provided, the client will use http.DefaultClient.
|
2026-01-15 16:38:47 -06:00
|
|
|
func WithHTTPClient(client *http.Client) ClientOption {
|
2025-12-05 21:33:23 -06:00
|
|
|
return func(c *Client) {
|
|
|
|
|
c.httpClient = client
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// WithBaseURL sets a custom base URL for the Onspring API.
|
|
|
|
|
// This is useful for testing or when using a different Onspring environment.
|
2026-01-15 16:38:47 -06:00
|
|
|
func WithBaseURL(url string) ClientOption {
|
2025-12-05 21:33:23 -06:00
|
|
|
return func(c *Client) {
|
|
|
|
|
c.baseURL = url
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// WithAPIVersion sets a custom API version for the Onspring client.
|
|
|
|
|
// If not provided, the client will use the default API version.
|
2026-01-15 16:38:47 -06:00
|
|
|
func WithAPIVersion(version string) ClientOption {
|
2025-12-05 21:33:23 -06:00
|
|
|
return func(c *Client) {
|
|
|
|
|
c.apiVersion = version
|
|
|
|
|
}
|
|
|
|
|
}
|