-
Notifications
You must be signed in to change notification settings - Fork 6
/
response.go
69 lines (61 loc) · 1.92 KB
/
response.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
69
// Copyright 2016 Nevio Vesic
// Please check out LICENSE file for more information about what you CAN and what you CANNOT do!
// MIT License
package sift
import (
"net/http"
"time"
)
// Label -
type Label struct {
IsBad bool `json:"is_bad,omitempty"`
Time time.Duration `json:"time,omitempty"`
Reasons []string `json:"reasons,omitempty"`
Description string `json:"description,omitempty"`
}
// Reason -
type Reason struct {
Name string `json:"name,omitempty"`
Value string `json:"value,omitempty"`
Details struct {
Users string `json:"users,omitempty"`
} `json:"details,omitempty"`
}
// Trigger -
type Trigger struct {
Type string `json:"type,omitempty"`
Source string `json:"source,omitempty"`
Trigger struct {
ID string `json:"id,omitempty"`
} `json:"trigger,omitempty"`
}
// Action -
type Action struct {
ID string `json:"id,omitempty"`
Action struct {
ID string `json:"id,omitempty"`
} `json:"action,omitempty"`
Entity struct {
ID string `json:"id,omitempty"`
}
Time time.Duration `json:"time,omitempty"`
Triggers []Trigger `json:"triggers,omitempty"`
}
// Response -
type Response struct {
// Used for debugging purposes I guess....
HTTPStatus string `json:"-"`
HTTPStatusCode int `json:"-"`
HTTPStatusHeader http.Header `json:"-"`
HTTPResponseBody string `json:"-"`
// ------------------------------------------------------------
Status int `json:"status,omitempty"`
UserID string `json:"user_id,omitempty"`
ErrorMessage string `json:"error_message,omitempty"`
Time time.Duration `json:"time,omitempty"`
Score float64 `json:"score,omitempty"`
Request string `json:"request,omitempty"`
Actions []Action `json:"actions,omitempty"`
LatestLabel Label `json:"latest_label,omitempty"`
Reasons []Reason `json:"reasons,omitempty"`
}