hipchat: Add endpoint function for HipChat server
Change-Id: I4578f5683aa9ed728e503cb3b08ff0bf743a62a2
Reviewed-on: https://go-review.googlesource.com/21712
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
diff --git a/hipchat/hipchat.go b/hipchat/hipchat.go
index 38de0b2..d061c56 100644
--- a/hipchat/hipchat.go
+++ b/hipchat/hipchat.go
@@ -14,3 +14,12 @@
AuthURL: "https://www.hipchat.com/users/authorize",
TokenURL: "https://api.hipchat.com/v2/oauth/token",
}
+
+// ServerEndpoint returns a new oauth2.Endpoint for a HipChat Server instance
+// running on the given domain or host.
+func ServerEndpoint(host string) oauth2.Endpoint {
+ return oauth2.Endpoint{
+ AuthURL: "https://" + host + "/users/authorize",
+ TokenURL: "https://" + host + "/v2/oauth/token",
+ }
+}