-
Notifications
You must be signed in to change notification settings - Fork 0
/
dataExport.go
48 lines (42 loc) · 1.37 KB
/
dataExport.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
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 QueryDataExport(config Config) (resp.DataExport, *http.Response) {
path := "/data_export"
response, httpResponse, err := Get(config, path, nil)
ErrorCheck(err)
json, err := resp.DataExportFromJSON(response)
ErrorCheck(err)
return json, httpResponse
}
func QueryDataExportById(config Config, pathId string) (resp.DataExport, *http.Response) {
path := fmt.Sprintf("/data_export/%s", pathId)
response, httpResponse, err := Get(config, path, nil)
ErrorCheck(err)
json, err := resp.DataExportFromJSON(response)
ErrorCheck(err)
return json, httpResponse
}
func CreateDataExport(config Config) (resp.DataExport, *http.Response) {
path := "/data_export"
response, httpResponse, err := Post(config, path, nil)
ErrorCheck(err)
json, err := resp.DataExportFromJSON(response)
ErrorCheck(err)
return json, httpResponse
}
func QueryDataExportSchema(config Config, params params.QueryDataExportSchema) (resp.DataExport, *http.Response) {
path := "/data_export_schema"
body, err := query.Values(params)
ErrorCheck(err)
response, httpResponse, err := Get(config, path, body)
ErrorCheck(err)
json, err := resp.DataExportFromJSON(response)
ErrorCheck(err)
return json, httpResponse
}