traefik/vendor/github.com/nrdcg/goinwx/account.go

49 lines
1 KiB
Go
Raw Normal View History

2018-11-19 15:40:03 +00:00
package goinwx
const (
methodAccountLogin = "account.login"
methodAccountLogout = "account.logout"
methodAccountLock = "account.lock"
methodAccountUnlock = "account.unlock"
)
2019-02-11 07:52:03 +00:00
// AccountService API access to Account.
type AccountService service
2018-11-19 15:40:03 +00:00
2019-02-11 07:52:03 +00:00
// Login Account login.
func (s *AccountService) Login() error {
2018-11-19 15:40:03 +00:00
req := s.client.NewRequest(methodAccountLogin, map[string]interface{}{
2019-02-11 07:52:03 +00:00
"user": s.client.username,
"pass": s.client.password,
2018-11-19 15:40:03 +00:00
})
_, err := s.client.Do(*req)
return err
}
2019-02-11 07:52:03 +00:00
// Logout Account logout.
func (s *AccountService) Logout() error {
2018-11-19 15:40:03 +00:00
req := s.client.NewRequest(methodAccountLogout, nil)
_, err := s.client.Do(*req)
return err
}
2019-02-11 07:52:03 +00:00
// Lock Account lock.
func (s *AccountService) Lock() error {
2018-11-19 15:40:03 +00:00
req := s.client.NewRequest(methodAccountLock, nil)
_, err := s.client.Do(*req)
return err
}
2019-02-11 07:52:03 +00:00
// Unlock Account unlock.
func (s *AccountService) Unlock(tan string) error {
2018-11-19 15:40:03 +00:00
req := s.client.NewRequest(methodAccountUnlock, map[string]interface{}{
"tan": tan,
})
_, err := s.client.Do(*req)
return err
}