users

package
v1.4.2 Latest Latest
Warning

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

Go to latest
Published: Dec 31, 2025 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Settings  = "settings:pippy"
	Scope     = "repo workflow user:email read:org read:user"
	GrantType = "urn:ietf:params:oauth:grant-type:device_code"
)

Variables

View Source
var (
	NameCtx  = &contextKey{"UserName"}
	EmailCtx = &contextKey{"UserEmail"}
)
View Source
var ClientID string = "46ca5443da5014f4f00f"

Functions

func CacheTokens

func CacheTokens(cacheStore *UserStore) error

func Command

func Command() *cli.Command

func GetCachedAccessToken

func GetCachedAccessToken() (string, error)

func GetJSON

func GetJSON(url, token string, value interface{}) error

func GithubPrimaryEmail

func GithubPrimaryEmail(accessToken string) (string, error)

func GithubUser

func GithubUser(accessToken string) (*githubUser, error)

Types

type HttpError

type HttpError struct {
	Message string `json:"message"`
}

type UserStore

type UserStore struct {
	AccessToken           string     `json:"access_token"`
	ExpiresIn             int64      `json:"expires_in"`
	RefreshToken          string     `json:"refresh_token"`
	RefreshTokenExpiresIn int64      `json:"refresh_token_expires_in"`
	RefreshTime           int64      `json:"refresh_time"`
	GithubUser            githubUser `json:"user"`
}

userStore caches accesstoken and apikey in ~/.pippy/db

func GetCachedTokens

func GetCachedTokens() (*UserStore, error)

func LoginUser

func LoginUser() (*UserStore, error)

LoginUser logs user into pippy and generates api key for usage Apikey is typically valid for predetermined time, key is automatically refreshed by client if signup is true, signs up user automatically

func RefreshAccessToken

func RefreshAccessToken(clientID, clientSecret, refreshToken string) (*UserStore, error)

Jump to

Keyboard shortcuts

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