github.com/argoproj/argo-cd/v3@v3.2.1/applicationset/services/internal/http/client_options.go (about)

     1  package http
     2  
     3  import "time"
     4  
     5  // ClientOptionFunc can be used to customize a new Restful API client.
     6  type ClientOptionFunc func(*Client) error
     7  
     8  // WithToken is an option for NewClient to set token
     9  func WithToken(token string) ClientOptionFunc {
    10  	return func(c *Client) error {
    11  		c.token = token
    12  		return nil
    13  	}
    14  }
    15  
    16  // WithTimeout can be used to configure a custom timeout for requests.
    17  func WithTimeout(timeout int) ClientOptionFunc {
    18  	return func(c *Client) error {
    19  		c.client.Timeout = time.Duration(timeout) * time.Second
    20  		return nil
    21  	}
    22  }