Skip to content

Commit 873e1e2

Browse files
committed
1 parent 8cdac5e commit 873e1e2

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

client.go

+2
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ func (c *Castle) Filter(ctx context.Context, req *Request) (RecommendedAction, e
4242
}
4343
r := &castleAPIRequest{
4444
Type: req.Event.EventType,
45+
Name: req.Event.Name,
4546
Status: req.Event.EventStatus,
4647
RequestToken: req.Context.RequestToken,
4748
User: req.User,
@@ -62,6 +63,7 @@ func (c *Castle) Risk(ctx context.Context, req *Request) (RecommendedAction, err
6263
}
6364
r := &castleAPIRequest{
6465
Type: req.Event.EventType,
66+
Name: req.Event.Name,
6567
Status: req.Event.EventStatus,
6668
RequestToken: req.Context.RequestToken,
6769
User: req.User,

model.go

+4
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ package castle
33
type Event struct {
44
EventType EventType
55
EventStatus EventStatus
6+
// EventName is a $custom event name that can be used to send custom events.
7+
Name string
68
}
79

810
// EventType is an enum defining types of event castle tracks.
@@ -17,6 +19,7 @@ const (
1719
EventTypePasswordResetRequest EventType = "$password_reset_request"
1820
EventTypeChallenge EventType = "$challenge"
1921
EventTypeLogout EventType = "$logout"
22+
EventTypeCustom EventType = "$custom"
2023
)
2124

2225
// EventStatus is an enum defining the statuses for a given event.
@@ -67,6 +70,7 @@ type User struct {
6770

6871
type castleAPIRequest struct {
6972
Type EventType `json:"type"`
73+
Name string `json:"name,omitempty"`
7074
Status EventStatus `json:"status"`
7175
RequestToken string `json:"request_token"`
7276
User User `json:"user"`

0 commit comments

Comments
 (0)