-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaccount.go
31 lines (27 loc) · 862 Bytes
/
account.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
31
package wrikego
import (
"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 QueryAccount(config Config, params params.QueryAccount) (resp.Account, *http.Response) {
path := "/account"
body, err := query.Values(params)
ErrorCheck(err)
response, httpResponse, err := Get(config, path, body)
ErrorCheck(err)
json, err := resp.AccountFromJSON(response)
ErrorCheck(err)
return json, httpResponse
}
func ModifyAccount(config Config, params params.QueryAccount) (resp.Account, *http.Response) {
path := "/account"
body, err := query.Values(params)
ErrorCheck(err)
response, httpResponse, err := Put(config, path, body)
ErrorCheck(err)
json, err := resp.AccountFromJSON(response)
ErrorCheck(err)
return json, httpResponse
}