@@ -8,16 +8,17 @@ import (
88)
99
1010type User struct {
11- Id string `json:"id"`
12- Username string `json:"username"`
13- Role string `json:"role"`
14- Email string `json:"email"`
15- AuthType string `json:"authType"`
16- FirstName string `json:"firstName"`
17- LastName string `json:"lastName"`
18- GroupId string `json:"groupId"`
19- Status string `json:"status"`
20- Devices []Device `json:"devices"`
11+ Id string `json:"id"`
12+ Username string `json:"username"`
13+ Role string `json:"role"`
14+ Email string `json:"email"`
15+ AuthType string `json:"authType"`
16+ FirstName string `json:"firstName"`
17+ LastName string `json:"lastName"`
18+ GroupId string `json:"groupId"`
19+ Status string `json:"status"`
20+ AccountStatus string `json:"accountStatus"`
21+ Devices []Device `json:"devices"`
2122}
2223
2324type Device struct {
@@ -88,6 +89,22 @@ func (c *Client) GetUserById(userId string) (*User, error) {
8889 return & u , nil
8990}
9091
92+ func (c * Client ) UpdateUser (user User ) error {
93+ userJson , err := json .Marshal (user )
94+ if err != nil {
95+ return err
96+ }
97+ req , err := http .NewRequest (http .MethodPut , fmt .Sprintf ("%s/api/beta/users/%s" , c .BaseURL , user .Id ), bytes .NewBuffer (userJson ))
98+ if err != nil {
99+ return err
100+ }
101+ _ , err = c .DoRequest (req )
102+ if err != nil {
103+ return err
104+ }
105+ return nil
106+ }
107+
91108func (c * Client ) DeleteUser (userId string ) error {
92109 req , err := http .NewRequest (http .MethodDelete , fmt .Sprintf ("%s/api/beta/users/%s" , c .BaseURL , userId ), nil )
93110 if err != nil {
0 commit comments