github

package
v0.0.0-...-3a9407f Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Msg = msg{
	StateInvalid:       "github_state_invalid",
	CodeExchangeFailed: "github_code_exchange_failed",
	GetUserInfoFailed:  "github_get_user_info_failed",
}

Functions

This section is empty.

Types

type AccessRequest

type AccessRequest struct {
	Code  string `json:"code"`
	State string `json:"state"`
}

type Client

type Client interface {
	Access(ctx context.Context, req *AccessRequest) (*User, *i18np.Error)
	CurrentUser(ctx context.Context, token string) (*User, *i18np.Error)
}

func NewClient

func NewClient(config Config) Client

type Config

type Config struct {
	ClientID     string `env:"GITHUB_CLIENT_ID"`
	ClientSecret string `env:"GITHUB_CLIENT_SECRET"`
	RedirectURL  string `env:"GITHUB_REDIRECT_URL"`
}

type User

type User struct {
	Login     string `json:"login"`
	ID        int    `json:"id"`
	AvatarURL string `json:"avatar_url"`
	Email     string `json:"email"`
	Name      string `json:"name"`
	Token     string `json:"-"`
}

Jump to

Keyboard shortcuts

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