make client interface
This commit is contained in:
@@ -29,7 +29,7 @@ func MustViperFlags(v *viper.Viper, flags *pflag.FlagSet) {
|
||||
|
||||
// WithConfig applies all configurations defined in the config.
|
||||
func WithConfig(config Config) Option {
|
||||
return func(c *Client) error {
|
||||
return func(c *client) error {
|
||||
var options []Option
|
||||
|
||||
if config.BaseURL != "" {
|
||||
@@ -52,7 +52,7 @@ func WithConfig(config Config) Option {
|
||||
|
||||
// WithBaseURL updates the baseurl used by the client.
|
||||
func WithBaseURL(baseURL string) Option {
|
||||
return func(c *Client) error {
|
||||
return func(c *client) error {
|
||||
u, err := url.Parse(baseURL)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to parse emapi base url %s: %w", baseURL, err)
|
||||
@@ -66,7 +66,7 @@ func WithBaseURL(baseURL string) Option {
|
||||
|
||||
// WithBearerToken sets the bearer token to authenticate the request with.
|
||||
func WithBearerToken(token string) Option {
|
||||
return func(c *Client) error {
|
||||
return func(c *client) error {
|
||||
c.token = token
|
||||
|
||||
return nil
|
||||
|
||||
Reference in New Issue
Block a user