cmd

package
v0.0.0-...-ad46a6f Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2022 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddCommand

func AddCommand(cmd *cobra.Command)

AddCommand adds a subcommand.

func Execute

func Execute()

Execute adds all child commands to the root command and sets flags appropriately. This is called by main.main(). It only needs to happen once to the rootCmd.

func RemoveCommand

func RemoveCommand(name string) bool

RemoveCommand removes a subcommand.

Types

type APIKeyProvider

type APIKeyProvider interface {
	// APIKey returns the API key used to authenticate with GMail APIs.
	// Returns an empty string if not available.
	APIKey() string
}

APIKeyProvider is the interface implemented by API providers with an API key.

type GmailAPIProvider

type GmailAPIProvider interface {
	// Service returns the GMail API service.
	Service(ctx context.Context, cfgDir string) (*gmail.Service, error)
	// ResetConfig cleans up the configuration.
	ResetConfig(cfgDir string) error
	// InitConfig initializes the configuration.
	InitConfig(cfgDir string) error
}

GmailAPIProvider is the integration point between gmailctl commands and GMail APIs providers.

var APIProvider GmailAPIProvider

APIProvider is the APIProvider used by all gmailctl commands.

type TokenRefresher

type TokenRefresher interface {
	// RefreshToken refreshes the token if it is expired.
	RefreshToken(ctx context.Context, cfgDir string) error
}

TokenRefresher allows to refresh API tokens if they are expired.

Jump to

Keyboard shortcuts

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