Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
func New ¶
func New(opts ...ClientOption) *Client
New creates a new instance of the Client. It accepts optional ClientOption arguments to customize the configuration. Returns a pointer to the newly created Client.
type ClientOption ¶
func WithEnv ¶
func WithEnv(env string) ClientOption
WithEnv sets the environment for the client configuration. It takes an `env` string as a parameter and returns a `ClientOption` function. The `ClientOption` function modifies the `Config` object by setting the `Env` field. If the `env` is not equal to "api", the `Env` field is set to "dev". Otherwise, the `Env` field is set to the value of `env`.
func WithHTTPClient ¶
func WithHTTPClient(cl *http.Client) ClientOption
WithHTTPClient is a ClientOption function that sets the HTTP client for the configuration. It takes a pointer to an http.Client and returns a function that sets the client in the Config struct.
func WithLogLevel ¶
func WithLogLevel(lv slog.Level) ClientOption
WithLogLevel sets the log level for the client. It takes a slog.Level as input and returns a ClientOption. The ClientOption modifies the Config object by setting the log level.
func WithLogger ¶
func WithLogger(lg *slog.Logger) ClientOption
WithLogger sets the logger for the client. It takes a pointer to a slog.Logger and returns a ClientOption function. The ClientOption function sets the logger in the provided Config and returns the updated Config.
func WithTimeout ¶
func WithTimeout(timeout time.Duration) ClientOption
WithTimeout sets the timeout duration for the HTTP client in the configuration. It returns a ClientOption function that modifies the given Config object.