diff --git a/README.md b/README.md index 1d84c2c67352bf01279db1469e90b3f2d7b976d8..eee90b7337bd2b61212a8d47d5498c540cb9c90e 100644 --- a/README.md +++ b/README.md @@ -44,7 +44,7 @@ import ( ) func main() { - client := lunatask.NewClient(os.Getenv("LUNATASK_TOKEN")) + client := lunatask.NewClient(os.Getenv("LUNATASK_TOKEN"), lunatask.UserAgent("MyApp/1.0")) // Verify credentials if _, err := client.Ping(context.Background()); err != nil { diff --git a/lunatask.go b/lunatask.go index bbcd2365335625a200eee20e89bcaa09e78369ed..dea4b5c6f9e2c197c982d93ccafe77246a6f1ead 100644 --- a/lunatask.go +++ b/lunatask.go @@ -4,7 +4,7 @@ // Package lunatask provides a Go client for the Lunatask API. // -// client := lunatask.NewClient(os.Getenv("LUNATASK_TOKEN")) +// client := lunatask.NewClient(os.Getenv("LUNATASK_TOKEN"), lunatask.UserAgent("MyApp/1.0")) // if _, err := client.Ping(ctx); err != nil { // log.Fatal(err) // } @@ -145,23 +145,23 @@ type Client struct { // Option configures a Client. type Option func(*Client) -// WithHTTPClient sets a custom HTTP client. -func WithHTTPClient(client *http.Client) Option { +// HTTPClient sets a custom HTTP client. +func HTTPClient(client *http.Client) Option { return func(c *Client) { c.httpClient = client } } -// WithBaseURL sets a custom base URL (useful for testing). -func WithBaseURL(url string) Option { +// BaseURL sets a custom base URL (useful for testing). +func BaseURL(url string) Option { return func(c *Client) { c.baseURL = url } } -// WithUserAgent sets a custom User-Agent prefix. +// UserAgent sets a custom User-Agent prefix. // The library identifier (go-lunatask/version) is always appended. -func WithUserAgent(ua string) Option { +func UserAgent(ua string) Option { return func(c *Client) { c.userAgent = ua }