Documentation ¶
Index ¶
- Constants
- Variables
- type Authorization
- type Authorizer
- type Client
- func (c *Client) CreateAuthorization(opts CreateAuthorizationOpts) (*Authorization, error)
- func (c *Client) Do(req *http.Request, v interface{}) (*http.Response, error)
- func (c *Client) GetUser(token string) (*User, error)
- func (c *Client) IsMember(organization, token string) (bool, error)
- func (c *Client) NewRequest(method, path string, v interface{}) (*http.Request, error)
- type CreateAuthorizationOpts
- type User
Constants ¶
View Source
const ( // HeaderTwoFactor is the HTTP header that github users for two factor // authentication. // // In a request, the value of this header should be the two factor auth // code. In a response, the presence of this header indicates that two // factor authentication is required for the user. See // http://goo.gl/h7al6K for more information. HeaderTwoFactor = "X-GitHub-OTP" )
Variables ¶
View Source
var (
// DefaultURL is the default location for the GitHub API.
DefaultURL = "https://api.github.com"
)
Functions ¶
This section is empty.
Types ¶
type Authorization ¶
type Authorization struct {
Token string `json:"token"`
}
Authorization represents a GitHub Authorization. See http://goo.gl/bs9I3o for more information.
type Authorizer ¶
type Authorizer struct { // OAuth scopes that should be granted with the access token. Scopes []string // The oauth application client id. ClientID string // The oauth application client secret. ClientSecret string // If provided, it will ensure that the user is a member of this // organization. Organization string // The oauth application URL. ApiURL string // contains filtered or unexported fields }
Authorizer is an implementation of the authorization.Authorizer interface backed by GitHub's Non-Web Application Flow, which can be found at http://goo.gl/onpQKM.
type Client ¶
type Client struct { // The github api url. The zero value is https://api.github.com. URL string // contains filtered or unexported fields }
Client is a github client.
func (*Client) CreateAuthorization ¶
func (c *Client) CreateAuthorization(opts CreateAuthorizationOpts) (*Authorization, error)
CreateAuthorization creates a new GitHub authorization (or returns the existing authorization if present) for the GitHub OAuth application. See http://goo.gl/bs9I3o.
Click to show internal directories.
Click to hide internal directories.