google

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2021 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MimeTypeFolder = "application/vnd.google-apps.folder"
)

Variables

This section is empty.

Functions

func NewCredentialsManager

func NewCredentialsManager(path string) *credentialsManager

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

func NewClient

func NewClient(logger *log.Logger, config *oauth2.Config, options ...ClientOption) (*Client, error)

func NewClientFromFile

func NewClientFromFile(logger *log.Logger, path string, options ...ClientOption) (*Client, error)

func NewClientFromReader

func NewClientFromReader(logger *log.Logger, r io.Reader, options ...ClientOption) (*Client, error)

func (*Client) HasCreds

func (c *Client) HasCreds() bool

func (*Client) ListFiles

func (c *Client) ListFiles(ctx context.Context, q string, pageToken string) (*drive.FileList, error)

func (*Client) OauthHandler

func (c *Client) OauthHandler() func(w http.ResponseWriter, r *http.Request)

TODO: use / validate state token

func (*Client) OauthRedirect

func (c *Client) OauthRedirect(w http.ResponseWriter, r *http.Request)

func (*Client) Service

func (c *Client) Service(ctx context.Context) (*drive.Service, error)

type ClientOption

type ClientOption func(*Client)

func CustomHTTPClientOption

func CustomHTTPClientOption(httpClient *http.Client) ClientOption

type Config

type Config struct {
	ClientID     string   `json:"client_id"`
	ClientSecret string   `json:"client_secret"`
	RedirectURIs []string `json:"redirect_uris"`
	AuthURI      string   `json:"auth_uri"`
	TokenURI     string   `json:"token_uri"`
}

Config is a google-defined client_credentials.json format. Duplicated from golang.org/x/oauth2/google since it is not exported.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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