for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
package httpsms
import (
"net/http"
"strings"
)
// Option is options for constructing a client
type Option interface {
apply(config *clientConfig)
}
type clientOptionFunc func(config *clientConfig)
func (fn clientOptionFunc) apply(config *clientConfig) {
fn(config)
// WithHTTPClient sets the underlying HTTP client used for API requests.
// By default, http.DefaultClient is used.
func WithHTTPClient(httpClient *http.Client) Option {
return clientOptionFunc(func(config *clientConfig) {
if httpClient != nil {
config.httpClient = httpClient
})
// WithBaseURL sets the base url for the httpsms API
func WithBaseURL(baseURL string) Option {
if baseURL != "" {
config.baseURL = strings.TrimRight(baseURL, "/")
// WithAPIKey sets the api key for the httpsms API
func WithAPIKey(apiKey string) Option {
config.apiKey = apiKey