Skip to content

Commit 0fe96d5

Browse files
committed
add name for custom events
1 parent fd68fe3 commit 0fe96d5

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

castle.go

+3
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@ func getRequestToken(r *http.Request) string {
138138
}
139139

140140
type Request struct {
141+
Name string
141142
Context *Context
142143
Event Event
143144
User User
@@ -155,6 +156,7 @@ type User struct {
155156

156157
type castleAPIRequest struct {
157158
Type EventType `json:"type"`
159+
Name string `json:"name,omitempty"`
158160
Status EventStatus `json:"status"`
159161
RequestToken string `json:"request_token"`
160162
User User `json:"user"`
@@ -264,6 +266,7 @@ func (c *Castle) Risk(ctx context.Context, req *Request) (RecommendedAction, err
264266
return RecommendedActionNone, errors.New("request.Context cannot be nil")
265267
}
266268
e := &castleAPIRequest{
269+
Name: req.Name,
267270
Type: req.Event.EventType,
268271
Status: req.Event.EventStatus,
269272
RequestToken: req.Context.RequestToken,

0 commit comments

Comments
 (0)