Files
netbird/management/client/rest/options.go
2025-05-15 18:20:29 +02:00

36 lines
608 B
Go

package rest
import "net/http"
type option func(*Client)
type HttpClient interface {
Do(req *http.Request) (*http.Response, error)
}
func WithHttpClient(client HttpClient) option {
return func(c *Client) {
c.httpClient = client
}
}
func WithBearerToken(token string) option {
return WithAuthHeader("Bearer " + token)
}
func WithPAT(token string) option {
return WithAuthHeader("Token " + token)
}
func WithManagementURL(url string) option {
return func(c *Client) {
c.managementURL = url
}
}
func WithAuthHeader(value string) option {
return func(c *Client) {
c.authHeader = value
}
}