-
Notifications
You must be signed in to change notification settings - Fork 0
/
users.go
30 lines (26 loc) · 857 Bytes
/
users.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
package wrikego
import (
"fmt"
"net/http"
params "github.com/TGoers-FNSB/WrikeGo/parameters"
resp "github.com/TGoers-FNSB/WrikeGo/response"
query "github.com/TGoers-FNSB/go-querystring-wrike/query"
)
func QueryUsersById(config Config, pathId string) (resp.Users, *http.Response) {
path := fmt.Sprintf("/users/%s", pathId)
response, httpResponse, err := Get(config, path, nil)
ErrorCheck(err)
json, err := resp.UsersFromJSON(response)
ErrorCheck(err)
return json, httpResponse
}
func ModifyUsersById(config Config, params params.ModifyUsers, pathId string) (resp.Users, *http.Response) {
path := fmt.Sprintf("/users/%s", pathId)
body, err := query.Values(params)
ErrorCheck(err)
response, httpResponse, err := Put(config, path, body)
ErrorCheck(err)
json, err := resp.UsersFromJSON(response)
ErrorCheck(err)
return json, httpResponse
}