commit 47d2055f18788c0250c64a9b435cb9cdab88b676
parent d235292a981a94a4cf2321a8e15680dacfe4d672
Author: Russ Cox <rsc@golang.org>
Date: Thu, 18 Apr 2024 13:33:06 -0400
github: add NewClient
Diffstat:
1 file changed, 6 insertions(+), 0 deletions(-)
diff --git a/client.go b/client.go
@@ -47,6 +47,12 @@ func Dial(user string) (*Client, error) {
return &Client{user: user, passwd: passwd}, nil
}
+// NewClient returns a new client authenticating as the given GitHub user
+// with the given GitHub personal access token (of the form "ghp_....").
+func NewClient(user, token string) *Client {
+ return &Client{user: user, passwd: token}
+}
+
// A Vars is a binding of GraphQL variables to JSON-able values (usually strings).
type Vars map[string]any