client0

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2023 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
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

View Source
var Default = NewHTTPClient(nil)

Default toodledo HTTP client.

View Source
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

func NewOAuth2ConfigFromViper() (*oauth2.Config, error)

NewOAuth2ConfigFromViper get oauth2 config from viper. oauth2.Config presumes a login user.

func SaveTokenWithViper

func SaveTokenWithViper(tok *oauth2.Token) error

SaveTokenWithViper save new token to yaml TODO refactor

func SaveUserIDWithViper

func SaveUserIDWithViper(userID string) error

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

func NewHTTPClient(formats strfmt.Registry) *Toodledo

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

type TransportConfig struct {
	Host     string
	BasePath string
	Schemes  []string
}

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.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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