aboutsummaryrefslogtreecommitdiff
path: root/vendor/github.com/google/go-github/github/misc.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/google/go-github/github/misc.go')
-rw-r--r--vendor/github.com/google/go-github/github/misc.go25
1 files changed, 13 insertions, 12 deletions
diff --git a/vendor/github.com/google/go-github/github/misc.go b/vendor/github.com/google/go-github/github/misc.go
index 0cdb3f7..42d0d30 100644
--- a/vendor/github.com/google/go-github/github/misc.go
+++ b/vendor/github.com/google/go-github/github/misc.go
@@ -7,6 +7,7 @@ package github
import (
"bytes"
+ "context"
"fmt"
"net/url"
)
@@ -39,7 +40,7 @@ type markdownRequest struct {
// Markdown renders an arbitrary Markdown document.
//
// GitHub API docs: https://developer.github.com/v3/markdown/
-func (c *Client) Markdown(text string, opt *MarkdownOptions) (string, *Response, error) {
+func (c *Client) Markdown(ctx context.Context, text string, opt *MarkdownOptions) (string, *Response, error) {
request := &markdownRequest{Text: String(text)}
if opt != nil {
if opt.Mode != "" {
@@ -56,7 +57,7 @@ func (c *Client) Markdown(text string, opt *MarkdownOptions) (string, *Response,
}
buf := new(bytes.Buffer)
- resp, err := c.Do(req, buf)
+ resp, err := c.Do(ctx, req, buf)
if err != nil {
return "", resp, err
}
@@ -67,14 +68,14 @@ func (c *Client) Markdown(text string, opt *MarkdownOptions) (string, *Response,
// ListEmojis returns the emojis available to use on GitHub.
//
// GitHub API docs: https://developer.github.com/v3/emojis/
-func (c *Client) ListEmojis() (map[string]string, *Response, error) {
+func (c *Client) ListEmojis(ctx context.Context) (map[string]string, *Response, error) {
req, err := c.NewRequest("GET", "emojis", nil)
if err != nil {
return nil, nil, err
}
var emoji map[string]string
- resp, err := c.Do(req, &emoji)
+ resp, err := c.Do(ctx, req, &emoji)
if err != nil {
return nil, resp, err
}
@@ -109,14 +110,14 @@ type APIMeta struct {
// endpoint provides information about that installation.
//
// GitHub API docs: https://developer.github.com/v3/meta/
-func (c *Client) APIMeta() (*APIMeta, *Response, error) {
+func (c *Client) APIMeta(ctx context.Context) (*APIMeta, *Response, error) {
req, err := c.NewRequest("GET", "meta", nil)
if err != nil {
return nil, nil, err
}
meta := new(APIMeta)
- resp, err := c.Do(req, meta)
+ resp, err := c.Do(ctx, req, meta)
if err != nil {
return nil, resp, err
}
@@ -126,7 +127,7 @@ func (c *Client) APIMeta() (*APIMeta, *Response, error) {
// Octocat returns an ASCII art octocat with the specified message in a speech
// bubble. If message is empty, a random zen phrase is used.
-func (c *Client) Octocat(message string) (string, *Response, error) {
+func (c *Client) Octocat(ctx context.Context, message string) (string, *Response, error) {
u := "octocat"
if message != "" {
u = fmt.Sprintf("%s?s=%s", u, url.QueryEscape(message))
@@ -138,7 +139,7 @@ func (c *Client) Octocat(message string) (string, *Response, error) {
}
buf := new(bytes.Buffer)
- resp, err := c.Do(req, buf)
+ resp, err := c.Do(ctx, req, buf)
if err != nil {
return "", resp, err
}
@@ -149,14 +150,14 @@ func (c *Client) Octocat(message string) (string, *Response, error) {
// Zen returns a random line from The Zen of GitHub.
//
// see also: http://warpspire.com/posts/taste/
-func (c *Client) Zen() (string, *Response, error) {
+func (c *Client) Zen(ctx context.Context) (string, *Response, error) {
req, err := c.NewRequest("GET", "zen", nil)
if err != nil {
return "", nil, err
}
buf := new(bytes.Buffer)
- resp, err := c.Do(req, buf)
+ resp, err := c.Do(ctx, req, buf)
if err != nil {
return "", resp, err
}
@@ -180,7 +181,7 @@ func (s *ServiceHook) String() string {
// ListServiceHooks lists all of the available service hooks.
//
// GitHub API docs: https://developer.github.com/webhooks/#services
-func (c *Client) ListServiceHooks() ([]*ServiceHook, *Response, error) {
+func (c *Client) ListServiceHooks(ctx context.Context) ([]*ServiceHook, *Response, error) {
u := "hooks"
req, err := c.NewRequest("GET", u, nil)
if err != nil {
@@ -188,7 +189,7 @@ func (c *Client) ListServiceHooks() ([]*ServiceHook, *Response, error) {
}
var hooks []*ServiceHook
- resp, err := c.Do(req, &hooks)
+ resp, err := c.Do(ctx, req, &hooks)
if err != nil {
return nil, resp, err
}