github

package
v0.0.0-...-bfa56d4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 12, 2015 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EmailResponse

type EmailResponse struct {
	Email    string `json:"email"`
	Primary  bool   `json:"primary"`
	Verified bool   `json:"verified"`
}

EmailResponse represents the response for an email entity

type TokenRequest

type TokenRequest struct {
	ClientID     string `json:"client_id"`
	ClientSecret string `json:"client_secret"`
	Code         string `json:"code"`
}

TokenRequest represents the data that must be sent to GitHub to get a token.

type TokenResponse

type TokenResponse struct {
	AccessToken string `json:"access_token"`
	Scope       string `json:"scope"`
	TokenType   string `json:"token_type"`
}

TokenResponse represents the response from GitHub.

type User

type User struct {
	AccessToken string
	Scope       string
	Email       string
	Name        string
	ID          int64
	Login       string
	AvatarURL   string
	HTMLURL     string
}

User organizes the data we care about for the GitHub user.

func GetUserFromCode

func GetUserFromCode(code string) (*User, error)

GetUserFromCode retrieves the access token and user from GitHub https://github.com/login/oauth/authorize?client_id=&scope=user:email&state=random

type UserResponse

type UserResponse struct {
	Email     string `json:"email"`
	Name      string `json:"name"`
	Login     string `json:"login"`
	ID        int64  `json:"id"`
	AvatarURL string `json:"avatar_url"`
	HTMLURL   string `json:"html_url"`
}

UserResponse represents the GitHub user response.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL