system

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: May 19, 2019 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type RealSystem

type RealSystem struct {
}

RealSystem is how the hosting system works in real life

func (RealSystem) ExchangeToken

func (rs RealSystem) ExchangeToken(config *oauth2.Config, code string) (*oauth2.Token, error)

ExchangeToken calls google auth server returns a oauth2 token if authentication succeeded

func (RealSystem) HomeDir

func (rs RealSystem) HomeDir() string

HomeDir is the home directory of current user depending of the running system

func (RealSystem) Now

func (rs RealSystem) Now() time.Time

Now return the current date and time

func (RealSystem) OpenBrowser

func (rs RealSystem) OpenBrowser(authURL string) error

OpenBrowser opens a browser in order to login and authorize bpal to use oauth2 secured apis.

func (RealSystem) Prompt

func (rs RealSystem) Prompt() (string, error)

Prompt asks user the auth code returned by oauth server.

type System

type System interface {
	Now() time.Time
	HomeDir() string
	Prompt() (string, error)
	OpenBrowser(url string) error
	ExchangeToken(config *oauth2.Config, code string) (*oauth2.Token, error)
}

System holds system-dependant methods which are hard to test/mock

Jump to

Keyboard shortcuts

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