api

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2018 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Authenticator

type Authenticator interface {
	// API creates a GmailAPI instance from a token JSON file contents.
	//
	// If no token is available, AuthURL and CacheToken can be used to
	// obtain one.
	API(ctx context.Context, token io.Reader) (GmailAPI, error)

	// AuthURL returns the URL the user has to visit to authorize the
	// application and obtain an auth code.
	AuthURL() string
	// CacheToken creates and caches a token JSON file from an auth code.
	//
	// The token can be subsequently used to authorize a GmailAPI instance.
	CacheToken(ctx context.Context, authCode string, token io.Writer) error
}

Authenticator encapsulates authentication operations for Gmail APIs.

func NewAuthenticator

func NewAuthenticator(credentials io.Reader) (Authenticator, error)

NewAuthenticator creates an Authenticator instance from credentials JSON file contents.

Credentials can be obtained by creating a new OAuth client ID at the Google API console https://console.developers.google.com/apis/credentials.

type GmailAPI

type GmailAPI interface {
	ListFilters() (filter.Filters, error)
	DeleteFilters(ids []string) error
	AddFilters(fs filter.Filters) error

	ListLabels() ([]filter.Label, error)
	LabelMap() (exportapi.LabelMap, error)
}

GmailAPI is a wrapper around the Gmail APIs.

Jump to

Keyboard shortcuts

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