feat(client): support SetUser api
This commit is contained in:
parent
f2dd36c630
commit
c2673cd416
6 changed files with 64 additions and 8 deletions
|
@ -7,6 +7,7 @@ import (
|
|||
|
||||
"github.com/ihexxa/quickshare/src/handlers"
|
||||
"github.com/ihexxa/quickshare/src/handlers/multiusers"
|
||||
"github.com/ihexxa/quickshare/src/userstore"
|
||||
"github.com/parnurzeal/gorequest"
|
||||
)
|
||||
|
||||
|
@ -52,6 +53,17 @@ func (cl *SingleUserClient) SetPwd(oldPwd, newPwd string, token *http.Cookie) (*
|
|||
End()
|
||||
}
|
||||
|
||||
func (cl *SingleUserClient) SetUser(ID uint64, role string, quota *userstore.Quota, token *http.Cookie) (*http.Response, string, []error) {
|
||||
return cl.r.Patch(cl.url("/v1/users/")).
|
||||
Send(multiusers.SetUserReq{
|
||||
ID: ID,
|
||||
Role: role,
|
||||
Quota: quota,
|
||||
}).
|
||||
AddCookie(token).
|
||||
End()
|
||||
}
|
||||
|
||||
func (cl *SingleUserClient) AddUser(name, pwd, role string, token *http.Cookie) (*http.Response, *multiusers.AddUserResp, []error) {
|
||||
resp, body, errs := cl.r.Post(cl.url("/v1/users/")).
|
||||
AddCookie(token).
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue