Documentation ¶
Index ¶
- Constants
- Variables
- func CleanAuthWithViper() error
- func NewAuthByToken(accessToken string) runtime.ClientAuthInfoWriter
- func NewAuthFromConfig(cfg common.ToodledoConfig) (runtime.ClientAuthInfoWriter, error)
- func NewAuthWithRefresh(clientID, clientSecret, accessToken, refreshToken string, expiredAt time.Time, ...) (runtime.ClientAuthInfoWriter, error)
- func NewOAuth2ConfigFromConfigs(cfg common.ToodledoConfig) (*oauth2.Config, error)
- func NewOAuth2ConfigFromViper() (*oauth2.Config, error)
- func SaveTokenWithViper(tok *oauth2.Token) error
- func SaveUserIDWithViper(userID string) error
- type SimpleAuth
- type Toodledo
- type TransportConfig
Constants ¶
const ( // DefaultHost is the default Host // found in Meta (info) section of spec file DefaultHost string = "api.toodledo.com" // DefaultBasePath is the default BasePath // found in Meta (info) section of spec file DefaultBasePath string = "/3" )
Variables ¶
var Default = NewHTTPClient(nil)
Default toodledo HTTP client.
var DefaultSchemes = []string{"https"}
DefaultSchemes are the default schemes found in Meta (info) section of spec file
Functions ¶
func CleanAuthWithViper ¶
func CleanAuthWithViper() error
func NewAuthByToken ¶
func NewAuthByToken(accessToken string) runtime.ClientAuthInfoWriter
NewAuthByToken is simple runtime.ClientAuthInfoWriter with accessToken. TODO accessToken cannot refresh
func NewAuthFromConfig ¶
func NewAuthFromConfig(cfg common.ToodledoConfig) (runtime.ClientAuthInfoWriter, error)
NewAuthFromConfig create auth writer from ToodledoConfig.
func NewAuthWithRefresh ¶
func NewAuthWithRefresh(clientID, clientSecret, accessToken, refreshToken string, expiredAt time.Time, saveFn func(newToken *oauth2.Token) error) (runtime.ClientAuthInfoWriter, error)
NewAuthWithRefresh create auth writer by access token and refresh token, it will automatically refresh.
func NewOAuth2ConfigFromConfigs ¶
func NewOAuth2ConfigFromConfigs(cfg common.ToodledoConfig) (*oauth2.Config, error)
func NewOAuth2ConfigFromViper ¶
NewOAuth2ConfigFromViper get oauth2 config from viper. oauth2.Config presumes a login user.
func SaveTokenWithViper ¶
SaveTokenWithViper save new token to yaml TODO refactor
func SaveUserIDWithViper ¶
SaveUserIDWithViper save user id to yaml.
Types ¶
type SimpleAuth ¶
type SimpleAuth struct {
// contains filtered or unexported fields
}
func (*SimpleAuth) AuthenticateRequest ¶
func (a *SimpleAuth) AuthenticateRequest(request runtime.ClientRequest, registry strfmt.Registry) error
type Toodledo ¶
type Toodledo struct { Account account.ClientService Context context.ClientService Folder folder.ClientService Goal goal.ClientService SavedSearch saved_search.ClientService Task task.ClientService Transport runtime.ClientTransport }
Toodledo is a client for toodledo
func New ¶
func New(transport runtime.ClientTransport, formats strfmt.Registry) *Toodledo
New creates a new toodledo client
func NewHTTPClient ¶
NewHTTPClient creates a new toodledo HTTP client.
func NewHTTPClientWithConfig ¶
func NewHTTPClientWithConfig(formats strfmt.Registry, cfg *TransportConfig) *Toodledo
NewHTTPClientWithConfig creates a new toodledo HTTP client, using a customizable transport config.
func NewToodledoClient ¶
func NewToodledoClient() *Toodledo
func (*Toodledo) SetTransport ¶
func (c *Toodledo) SetTransport(transport runtime.ClientTransport)
SetTransport changes the transport on the client and all its subresources
type TransportConfig ¶
TransportConfig contains the transport related info, found in the meta section of the spec file.
func DefaultTransportConfig ¶
func DefaultTransportConfig() *TransportConfig
DefaultTransportConfig creates a TransportConfig with the default settings taken from the meta section of the spec file.
func (*TransportConfig) WithBasePath ¶
func (cfg *TransportConfig) WithBasePath(basePath string) *TransportConfig
WithBasePath overrides the default basePath, provided by the meta section of the spec file.
func (*TransportConfig) WithHost ¶
func (cfg *TransportConfig) WithHost(host string) *TransportConfig
WithHost overrides the default host, provided by the meta section of the spec file.
func (*TransportConfig) WithSchemes ¶
func (cfg *TransportConfig) WithSchemes(schemes []string) *TransportConfig
WithSchemes overrides the default schemes, provided by the meta section of the spec file.