invoker

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2023 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultPath

func DefaultPath() string

Types

type Config

type Config struct {
	User    *User     `json:"user,omitempty"`
	RSA     RsaConfig `json:"rsa,omitempty"`
	SSON    string    `json:"sson,omitempty"`
	Auth    string    `json:"auth,omitempty"`
	Session *Session  `json:"session,omitempty"`
	// contains filtered or unexported fields
}

func OpenConfig

func OpenConfig(path string) (*Config, error)

func (*Config) Save

func (config *Config) Save() error

type Invoker

type Invoker struct {
	Refresh func() error
	// contains filtered or unexported fields
}

func NewInvoker

func NewInvoker(apiUrl string, refresh func() error, conf *Config) *Invoker

func (*Invoker) Cookie

func (i *Invoker) Cookie(raw, name string) string

func (*Invoker) Cookies

func (i *Invoker) Cookies(url *url.URL) []*http.Cookie

func (*Invoker) Do

func (i *Invoker) Do(req *http.Request, data interface{}, retry int) error

func (*Invoker) Fetch

func (i *Invoker) Fetch(path string) (*http.Response, error)

func (*Invoker) Get

func (i *Invoker) Get(path string, params url.Values, data interface{}) error

func (*Invoker) Post

func (i *Invoker) Post(path string, params url.Values, data interface{}) error

func (*Invoker) PwdLogin

func (i *Invoker) PwdLogin(link string, params url.Values, user *User) (result *LoginResult, err error)

func (*Invoker) Send

func (i *Invoker) Send(req *http.Request) (*http.Response, error)

func (*Invoker) SetPrepare

func (i *Invoker) SetPrepare(prepare func(req *http.Request))

type LoginResult

type LoginResult struct {
	Result int    `json:"result,omitempty"`
	Msg    string `json:"msg,omitempty"`
	ToUrl  string `json:"toUrl,omitempty"`
	SSON   string
}

type RsaConfig

type RsaConfig struct {
	ResCode int32  `json:"res_code,omitempty"`
	Expire  int64  `json:"expire,omitempty"`
	PkId    string `json:"pkId,omitempty"`
	PubKey  string `json:"pubKey,omitempty"`
}

func (*RsaConfig) Encrypt

func (r *RsaConfig) Encrypt(data string) []byte

type Session

type Session struct {
	Key    string `json:"key,omitempty"`
	Secret string `json:"secret,omitempty"`
}

type User

type User struct {
	Name     string `json:"name,omitempty"`
	Password string `json:"password,omitempty"`
}

Jump to

Keyboard shortcuts

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