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