fix naming

This commit is contained in:
gohumble 2022-06-12 21:03:37 +02:00
parent 2642965052
commit 0ecbb8d58c

View file

@ -44,7 +44,7 @@ func (c *Client) GetUser(userId string) (user User, err error) {
}
// CreateUserWithInitialWallet creates new user with initial wallet
func (c *Client) CreateUserWithInitialWallet(userName, walletName, adminId string, email string) (wal User, err error) {
func (c *Client) CreateUserWithInitialWallet(userName, walletName, adminId string, email string) (user User, err error) {
resp, err := req.Post(c.url+"/usermanager/api/v1/users", c.header, req.BodyJSON(struct {
WalletName string `json:"wallet_name"`
AdminId string `json:"admin_id"`
@ -61,14 +61,14 @@ func (c *Client) CreateUserWithInitialWallet(userName, walletName, adminId strin
err = reqErr
return
}
err = resp.ToJSON(&wal)
err = resp.ToJSON(&user)
res := gjson.Get(resp.String(), "wallets.0")
if res.Index == 0 {
err = fmt.Errorf("could not create initial wallet")
return
}
wal.Wallet = &Wallet{}
err = json.Unmarshal([]byte(res.Raw), wal.Wallet)
user.Wallet = &Wallet{}
err = json.Unmarshal([]byte(res.Raw), user.Wallet)
return
}