-
Notifications
You must be signed in to change notification settings - Fork 3
/
types.go
68 lines (60 loc) · 2.06 KB
/
types.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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
package maxcdn
import (
"encoding/json"
"net/http"
)
// Error represent a maxcnd error.
type Error struct {
Message string `json:"message,omitempty"`
Type string `json:"type,omitempty"`
}
// Error implements go's error interface.
func (e Error) Error() string {
return e.Type + ": " + e.Message
}
// Response object for all json requests.
type Response struct {
Code int `json:"code,omitempty"`
Data json.RawMessage `json:"data,omitempty"`
Error Error `json:"error,omitempty"`
// Non-JSON data.
Headers http.Header `json:"-"`
}
// Generic is the generic data type for JSON responses from API calls.
type Generic map[string]interface{}
// LogRecord holds the data of a single record.
type LogRecord struct {
Bytes int `json:"bytes"`
CacheStatus string `json:"cache_status"`
ClientAsn string `json:"client_asn"`
ClientCity string `json:"client_city"`
ClientContinent string `json:"client_continent"`
ClientCountry string `json:"client_country"`
ClientDma string `json:"client_dma"`
ClientIP string `json:"client_ip"`
ClientLatitude float64 `json:"client_latitude"`
ClientLongitude float64 `json:"client_longitude"`
ClientState string `json:"client_state"`
CompanyID int `json:"company_id"`
Hostname string `json:"hostname"`
Method string `json:"method"`
OriginTime float64 `json:"origin_time"`
Pop string `json:"pop"`
Protocol string `json:"protocol"`
QueryString string `json:"query_string"`
Referer string `json:"referer"`
Scheme string `json:"scheme"`
Status int `json:"status"`
Time string `json:"time"`
URI string `json:"uri"`
UserAgent string `json:"user_agent"`
ZoneID int `json:"zone_id"`
}
// Logs .
type Logs struct {
Limit int `json:"limit"`
NextPageKey string `json:"next_page_key"`
Page int `json:"page"`
Records []LogRecord `json:"records"`
RequestTime int `json:"request_time"`
}