forked from Minecraft/canopeas
30 lines
519 B
Go
30 lines
519 B
Go
|
package falseknees
|
||
|
|
||
|
import "net/http"
|
||
|
|
||
|
// Client is a FalseKnees client
|
||
|
type Client struct {
|
||
|
http *http.Client
|
||
|
}
|
||
|
|
||
|
// New returns a new Client
|
||
|
func New(opts ...ClientOption) *Client {
|
||
|
c := &Client{
|
||
|
http: http.DefaultClient,
|
||
|
}
|
||
|
for _, opt := range opts {
|
||
|
opt(c)
|
||
|
}
|
||
|
return c
|
||
|
}
|
||
|
|
||
|
// ClientOption is options for a Client
|
||
|
type ClientOption func(*Client)
|
||
|
|
||
|
// WithHTTP is a ClientOption for using a different http.Client
|
||
|
func WithHTTP(client *http.Client) ClientOption {
|
||
|
return func(c *Client) {
|
||
|
c.http = client
|
||
|
}
|
||
|
}
|