forked from preichenberger/go-coinbasepro
-
Notifications
You must be signed in to change notification settings - Fork 0
/
report.go
47 lines (37 loc) · 1.01 KB
/
report.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
package coinbasepro
import (
"fmt"
"time"
)
type ReportParams struct {
StartDate time.Time
EndDate time.Time
}
type CreateReportParams struct {
Start time.Time
End time.Time
}
type Report struct {
ID string `json:"id"`
Type string `json:"type"`
Status string `json:"status"`
CreatedAt Time `json:"created_at,string"`
CompletedAt Time `json:"completed_at,string,"`
ExpiresAt Time `json:"expires_at,string"`
FileURL string `json:"file_url"`
Params ReportParams `json:"params"`
StartDate time.Time
EndDate time.Time
}
func (c *Client) CreateReport(newReport *Report) (Report, error) {
var savedReport Report
url := fmt.Sprintf("/reports")
_, err := c.Request("POST", url, newReport, &savedReport)
return savedReport, err
}
func (c *Client) GetReportStatus(id string) (Report, error) {
report := Report{}
url := fmt.Sprintf("/reports/%s", id)
_, err := c.Request("GET", url, nil, &report)
return report, err
}