gmail

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2020 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OAUTH2_SCOPE            = "https://mail.google.com/ email"
	OAUTH2_REDIRECT_URI_CLI = "urn:ietf:wg:oauth:2.0:oob"

	OAUTH2_AUTH_BASE_URL  = "https://accounts.google.com/o/oauth2/auth"
	OAUTH2_TOKEN_BASE_URL = "https://accounts.google.com/o/oauth2/token"

	GMAIL_INFO_URL = "https://www.googleapis.com/userinfo/email"
)

Variables

This section is empty.

Functions

func XOAuth2Auth

func XOAuth2Auth(user, accessToken string) smtp.Auth

Types

type Gmail

type Gmail struct {
}

func New

func New() *Gmail

func (*Gmail) EmailAddress

func (g *Gmail) EmailAddress(accessToken string) (string, error)

func (*Gmail) FetchAccessToken

func (g *Gmail) FetchAccessToken(clientID, clientSecret, refreshToken string) (string, error)

func (*Gmail) FetchRefreshToken

func (g *Gmail) FetchRefreshToken(clientID, clientSecret, authCode, redirectURI string) (string, error)

func (*Gmail) GetAuthURI

func (g *Gmail) GetAuthURI(clientID, scope, redirectURI string) string

type OAuth2AuthedTokens

type OAuth2AuthedTokens struct {
	RefreshToken string `json:"refresh_token"`
	AccessToken  string `json:"access_token"`
}

type OAuth2Email

type OAuth2Email struct {
	Data struct {
		Email      string `json:"email"`
		IsVerified bool   `json:"isVerified"`
	} `json:"data"`
}

Jump to

Keyboard shortcuts

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