 Documentation
      ¶
      Documentation
      ¶
    
    
  
    
  
    Index ¶
- Constants
- Variables
- func NewError(resp *http.Response) error
- type APIError
- type APIErrors
- type Client
- func (client *Client) CommandLineAuth() (*CommandLineAuth, error)
- func (client *Client) CommandLineToken(ctx context.Context, code string) (*oauth2.Token, error)
- func (client *Client) DeviceAuth() (*DeviceAuth, error)
- func (client *Client) DeviceToken(ctx context.Context, auth *DeviceAuth) (*oauth2.Token, error)
- func (client *Client) Get(path string, out interface{}, opts ...ClientOpt) error
- func (client *Client) Post(path string, in, out interface{}, opts ...ClientOpt) error
- func (client *Client) PostBinary(path string, data io.Reader, out interface{}, opts ...ClientOpt) error
- func (client *Client) ReadToken() (*oauth2.Token, error)
- func (client *Client) String() string
- func (client *Client) Use(ctx context.Context, token *oauth2.Token, endpoint string) error
- func (client *Client) WriteToken(token *oauth2.Token) error
 
- type ClientOpt
- type ClientOptDone
- type CommandLineAuth
- type Config
- type DeviceAuth
- type OAuthError
Constants ¶
      View Source
      
  
const ( ScopeProfile = "https://www.googleapis.com/auth/userinfo.profile" ScopeEmail = "https://www.googleapis.com/auth/userinfo.email" )
Variables ¶
      View Source
      
  
var ( DefaultConfig = Config{ Name: "", Timeout: defaultTimeout, Scopes: []string{ScopeProfile, ScopeEmail}, } )
Functions ¶
Types ¶
type APIError ¶
type Client ¶
func NewClientWithClientSecret ¶
Client with client secret
func (*Client) CommandLineAuth ¶
func (client *Client) CommandLineAuth() (*CommandLineAuth, error)
Start device authentication
func (*Client) CommandLineToken ¶
Start device authentication
func (*Client) DeviceAuth ¶
func (client *Client) DeviceAuth() (*DeviceAuth, error)
Start device authentication
func (*Client) DeviceToken ¶
Wait for user to provide authentication response and return an oauth token
func (*Client) PostBinary ¶
func (client *Client) PostBinary(path string, data io.Reader, out interface{}, opts ...ClientOpt) error
Perform POST with a byte stream
type ClientOptDone ¶
type ClientOptDone func(interface{})
    type CommandLineAuth ¶
type CommandLineAuth struct {
	VerificationURL string `json:"verification_url"`
}
    type Config ¶
type Config struct {
	Name      string        `yaml:"name"`      // Path to application name
	ConfigDir string        `yaml:"configdir"` // Path to configuration path
	CacheDir  string        `yaml:"cachedir"`  // Path to cache path
	Scopes    []string      `yaml:"scopes"`    // Scopes for read, write and share
	Timeout   time.Duration `yaml:"timeout"`   // Client timeout
}
    type DeviceAuth ¶
type DeviceAuth struct {
	DeviceCode      string `json:"device_code"`
	UserCode        string `json:"user_code"`
	VerificationURL string `json:"verification_url"`
	ExpiresIn       int64  `json:"expires_in"`
	Interval        int64  `json:"interval"`
	// contains filtered or unexported fields
}
    func (*DeviceAuth) ExpiryTime ¶
func (code *DeviceAuth) ExpiryTime() time.Time
type OAuthError ¶
func (OAuthError) Error ¶
func (e OAuthError) Error() string
 Click to show internal directories. 
   Click to hide internal directories.