diff options
| author | Sam Anthony <sam@samanthony.xyz> | 2026-06-02 13:13:08 -0400 |
|---|---|---|
| committer | Sam Anthony <sam@samanthony.xyz> | 2026-06-02 13:13:08 -0400 |
| commit | 80ca94381b48d5766c5bcf7897a804d6e2443a69 (patch) | |
| tree | 1210780353af2f3c10427f5ce36f3dc3abf3edb2 /lulu.go | |
| parent | 06ba9b3e492ca47f6f966bd7bd6044809b989c30 (diff) | |
| download | lulu-80ca94381b48d5766c5bcf7897a804d6e2443a69.zip | |
Diffstat (limited to 'lulu.go')
| -rw-r--r-- | lulu.go | 16 |
1 files changed, 11 insertions, 5 deletions
@@ -58,17 +58,23 @@ type Client struct { c *http.Client } -// NewClient returns a client that will use the given client-key and -// client-secret to connect to the API server. -func NewClient(ctx context.Context, key, secret string) (*Client, error) { +// Credentials contains the client-key and client-secret used to +// authenticate to the API. +type Credentials struct { + Key, Secret string +} + +// NewClient returns a client that will use the given credentials to +// connect to the API server. +func NewClient(ctx context.Context, creds Credentials) (*Client, error) { tokenUrl, err := url.JoinPath(ApiUrl, tokenPath) if err != nil { return nil, pkgErrf(err, "error creating client") } cfg := &clientcredentials.Config{ - ClientID: key, - ClientSecret: secret, + ClientID: creds.Key, + ClientSecret: creds.Secret, TokenURL: tokenUrl, } return &Client{ctx, cfg.Client(ctx)}, nil |