Cherry pick v1.7 into master
This commit is contained in:
parent
a09dfa3ce1
commit
b6498cdcbc
73 changed files with 6573 additions and 186 deletions
54
vendor/github.com/smueller18/goinwx/account.go
generated
vendored
Normal file
54
vendor/github.com/smueller18/goinwx/account.go
generated
vendored
Normal file
|
@ -0,0 +1,54 @@
|
|||
package goinwx
|
||||
|
||||
const (
|
||||
methodAccountLogin = "account.login"
|
||||
methodAccountLogout = "account.logout"
|
||||
methodAccountLock = "account.lock"
|
||||
methodAccountUnlock = "account.unlock"
|
||||
)
|
||||
|
||||
type AccountService interface {
|
||||
Login() error
|
||||
Logout() error
|
||||
Lock() error
|
||||
Unlock(tan string) error
|
||||
}
|
||||
|
||||
type AccountServiceOp struct {
|
||||
client *Client
|
||||
}
|
||||
|
||||
var _ AccountService = &AccountServiceOp{}
|
||||
|
||||
func (s *AccountServiceOp) Login() error {
|
||||
req := s.client.NewRequest(methodAccountLogin, map[string]interface{}{
|
||||
"user": s.client.Username,
|
||||
"pass": s.client.Password,
|
||||
})
|
||||
|
||||
_, err := s.client.Do(*req)
|
||||
return err
|
||||
}
|
||||
|
||||
func (s *AccountServiceOp) Logout() error {
|
||||
req := s.client.NewRequest(methodAccountLogout, nil)
|
||||
|
||||
_, err := s.client.Do(*req)
|
||||
return err
|
||||
}
|
||||
|
||||
func (s *AccountServiceOp) Lock() error {
|
||||
req := s.client.NewRequest(methodAccountLock, nil)
|
||||
|
||||
_, err := s.client.Do(*req)
|
||||
return err
|
||||
}
|
||||
|
||||
func (s *AccountServiceOp) Unlock(tan string) error {
|
||||
req := s.client.NewRequest(methodAccountUnlock, map[string]interface{}{
|
||||
"tan": tan,
|
||||
})
|
||||
|
||||
_, err := s.client.Do(*req)
|
||||
return err
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue