@@ -9,15 +9,11 @@ import (
99 "net/http"
1010 "net/url"
1111
12+ "golang.org/x/net/context"
1213 "golang.org/x/oauth2"
1314)
1415
1516const (
16- pathLogin = "%slogin?access_token=%s"
17- pathUser = "%sapi/user"
18- pathRepos = "%sapi/user/repos"
19- pathRepo = "%sapi/repos/%s"
20- pathConf = "%sapi/repos/%s/maintainers"
2117 pathBranch = "%srepos/%s/%s/branches/%s/protection"
2218
2319 // protected branch
@@ -39,7 +35,7 @@ func NewClient(uri string) *Client {
3935// authenticates all outbound requests with the given token.
4036func NewClientToken (uri , token string ) * Client {
4137 config := new (oauth2.Config )
42- auther := config .Client (oauth2 . NoContext , & oauth2.Token {AccessToken : token })
38+ auther := config .Client (context . TODO () , & oauth2.Token {AccessToken : token })
4339 return & Client {auther , uri }
4440}
4541
@@ -79,11 +75,6 @@ func (c *Client) get(rawurl string, out interface{}) error {
7975 return c .do (rawurl , "GET" , nil , out )
8076}
8177
82- // helper function for making an http POST request.
83- func (c * Client ) post (rawurl string , in , out interface {}) error {
84- return c .do (rawurl , "POST" , in , out )
85- }
86-
8778// helper function for making an http PUT request.
8879func (c * Client ) put (rawurl string , in , out interface {}) error {
8980 return c .do (rawurl , "PUT" , in , out )
@@ -94,11 +85,6 @@ func (c *Client) patch(rawurl string, in, out interface{}) error {
9485 return c .do (rawurl , "PATCH" , in , out )
9586}
9687
97- // helper function for making an http DELETE request.
98- func (c * Client ) delete (rawurl string ) error {
99- return c .do (rawurl , "DELETE" , nil , nil )
100- }
101-
10288// helper function to make an http request
10389func (c * Client ) do (rawurl , method string , in , out interface {}) error {
10490 // executes the http request and returns the body as
0 commit comments