2023-08-12 19:45:19 +00:00
|
|
|
package teslainventory_sdk
|
2023-08-09 12:05:37 +00:00
|
|
|
|
|
|
|
// ClientOptions allows for options to be passed into the Client for customization.
|
|
|
|
type ClientOptions func(*Client)
|
|
|
|
|
|
|
|
// WithUserAgent will force the usage of a specific user agent.
|
|
|
|
func WithUserAgent(userAgent string) ClientOptions {
|
|
|
|
return func(c *Client) {
|
|
|
|
c.userAgent = userAgent
|
|
|
|
}
|
|
|
|
}
|
2023-08-12 20:00:35 +00:00
|
|
|
|
|
|
|
// WithCustomEndpoint will allow to overide the default endpoint with a custom one.
|
|
|
|
func WithCustomEndpoint(endpoint string) ClientOptions {
|
|
|
|
return func(c *Client) {
|
|
|
|
c.endpoint = endpoint
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// WithHeaders will add the given headers to every request made by the sdk.
|
|
|
|
func WithHeaders(headers map[string]string) ClientOptions {
|
|
|
|
return func(c *Client) {
|
|
|
|
c.headers = headers
|
|
|
|
}
|
|
|
|
}
|