Merge v1.2.1-master
Signed-off-by: Emile Vauge <emile@vauge.com>
This commit is contained in:
parent
a590155b0b
commit
aeb17182b4
396 changed files with 27271 additions and 9969 deletions
35
vendor/github.com/google/go-github/github/misc.go
generated
vendored
35
vendor/github.com/google/go-github/github/misc.go
generated
vendored
|
@ -7,13 +7,14 @@ package github
|
|||
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"fmt"
|
||||
"net/url"
|
||||
)
|
||||
|
||||
// MarkdownOptions specifies optional parameters to the Markdown method.
|
||||
type MarkdownOptions struct {
|
||||
// Mode identifies the rendering mode. Possible values are:
|
||||
// Mode identifies the rendering mode. Possible values are:
|
||||
// markdown - render a document as plain Markdown, just like
|
||||
// README files are rendered.
|
||||
//
|
||||
|
@ -25,7 +26,7 @@ type MarkdownOptions struct {
|
|||
// Default is "markdown".
|
||||
Mode string
|
||||
|
||||
// Context identifies the repository context. Only taken into account
|
||||
// Context identifies the repository context. Only taken into account
|
||||
// when rendering as "gfm".
|
||||
Context string
|
||||
}
|
||||
|
@ -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
|
||||
}
|
||||
|
@ -125,8 +126,8 @@ 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) {
|
||||
// bubble. If message is empty, a random zen phrase is used.
|
||||
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,18 +181,18 @@ 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 {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
hooks := new([]*ServiceHook)
|
||||
resp, err := c.Do(req, hooks)
|
||||
var hooks []*ServiceHook
|
||||
resp, err := c.Do(ctx, req, &hooks)
|
||||
if err != nil {
|
||||
return nil, resp, err
|
||||
}
|
||||
|
||||
return *hooks, resp, err
|
||||
return hooks, resp, nil
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue