-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinvitations.go
50 lines (44 loc) · 1.5 KB
/
invitations.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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
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 QueryInvitations(config Config) (resp.Invitations, *http.Response) {
path := "/invitations"
response, httpResponse, err := Get(config, path, nil)
ErrorCheck(err)
json, err := resp.InvitationsFromJSON(response)
ErrorCheck(err)
return json, httpResponse
}
func CreateInvitations(config Config, params params.CreateInvitations) (resp.Invitations, *http.Response) {
path := "/invitations"
body, err := query.Values(params)
ErrorCheck(err)
response, httpResponse, err := Post(config, path, body)
ErrorCheck(err)
json, err := resp.InvitationsFromJSON(response)
ErrorCheck(err)
return json, httpResponse
}
func ModifyInvitationsById(config Config, params params.ModifyInvitaions, pathId string) (resp.Invitations, *http.Response) {
path := fmt.Sprintf("/inivations/%s", pathId)
body, err := query.Values(params)
ErrorCheck(err)
response, httpResponse, err := Put(config, path, body)
ErrorCheck(err)
json, err := resp.InvitationsFromJSON(response)
ErrorCheck(err)
return json, httpResponse
}
func DeleteInvitationsById(config Config, pathId string) (resp.Invitations, *http.Response) {
path := fmt.Sprintf("/invitations/%s", pathId)
response, httpResponse, err := Delete(config, path, nil)
ErrorCheck(err)
json, err := resp.InvitationsFromJSON(response)
ErrorCheck(err)
return json, httpResponse
}