From b0e2337fe6ec0c637fa4f123268b972f334504eb Mon Sep 17 00:00:00 2001 From: Sam Whited Date: Thu, 7 Apr 2016 20:06:28 -0500 Subject: [PATCH] hipchat: Add endpoint function for HipChat server Change-Id: I4578f5683aa9ed728e503cb3b08ff0bf743a62a2 Reviewed-on: https://go-review.googlesource.com/21712 Reviewed-by: Brad Fitzpatrick --- hipchat/hipchat.go | 9 +++++++++ 1 file changed, 9 insertions(+) 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 @@ var Endpoint = oauth2.Endpoint{ 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", + } +}