aboutsummaryrefslogtreecommitdiffstats
path: root/lulu.go
diff options
context:
space:
mode:
authorSam Anthony <sam@samanthony.xyz>2026-06-02 13:13:08 -0400
committerSam Anthony <sam@samanthony.xyz>2026-06-02 13:13:08 -0400
commit80ca94381b48d5766c5bcf7897a804d6e2443a69 (patch)
tree1210780353af2f3c10427f5ce36f3dc3abf3edb2 /lulu.go
parent06ba9b3e492ca47f6f966bd7bd6044809b989c30 (diff)
downloadlulu-master.zip
credentials structHEADv0.2.0master
Diffstat (limited to 'lulu.go')
-rw-r--r--lulu.go16
1 files changed, 11 insertions, 5 deletions
diff --git a/lulu.go b/lulu.go
index 69a8ede..9228e28 100644
--- a/lulu.go
+++ b/lulu.go
@@ -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