Skip to content

Commit

Permalink
feat: add waiting room turnstile integration fields
Browse files Browse the repository at this point in the history
WR-1796
  • Loading branch information
piperswe committed Dec 27, 2024
1 parent 98a46a7 commit e68377d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
4 changes: 4 additions & 0 deletions waiting_room.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ type WaitingRoom struct {
QueueingStatusCode int `json:"queueing_status_code"`
EnabledOriginCommands []string `json:"enabled_origin_commands,omitempty"`
CookieAttributes *WaitingRoomCookieAttributes `json:"cookie_attributes,omitempty"`
TurnstileMode string `json:"turnstile_mode,omitempty"`
TurnstileAction string `json:"turnstile_action,omitempty"`
}

// WaitingRoomStatus describes the status of a waiting room.
Expand Down Expand Up @@ -70,6 +72,8 @@ type WaitingRoomEvent struct {
DisableSessionRenewal *bool `json:"disable_session_renewal,omitempty"`
Suspended bool `json:"suspended"`
ShuffleAtEventStart bool `json:"shuffle_at_event_start"`
TurnstileMode string `json:"turnstile_mode,omitempty"`
TurnstileAction string `json:"turnstile_action,omitempty"`
}

type WaitingRoomRule struct {
Expand Down
12 changes: 10 additions & 2 deletions waiting_room_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@ var waitingRoomJSON = fmt.Sprintf(`
"cookie_suffix": "example_shop",
"additional_routes": [{"host": "shop2.example.com", "path": "/shop/checkout"}],
"queueing_status_code": 200,
"enabled_origin_commands": ["revoke"]
"enabled_origin_commands": ["revoke"],
"turnstile_mode": "invisible",
"turnstile_action": "log"
}
`, waitingRoomID, testTimestampWaitingRoom.Format(time.RFC3339Nano), testTimestampWaitingRoom.Format(time.RFC3339Nano),
testTimestampWaitingRoomEventStart.Format(time.RFC3339Nano))
Expand All @@ -65,7 +67,9 @@ var waitingRoomEventJSON = fmt.Sprintf(`
"session_duration": null,
"disable_session_renewal": null,
"queueing_method": "random",
"custom_page_html": "{{#waitTimeKnown}} {{waitTime}} mins {{/waitTimeKnown}} {{^waitTimeKnown}} Event is prequeueing / Queue all enabled {{/waitTimeKnown}}"
"custom_page_html": "{{#waitTimeKnown}} {{waitTime}} mins {{/waitTimeKnown}} {{^waitTimeKnown}} Event is prequeueing / Queue all enabled {{/waitTimeKnown}}",
"turnstile_mode": "invisible",
"turnstile_action": "log"
}
`, waitingRoomEventID, testTimestampWaitingRoomEvent.Format(time.RFC3339Nano),
testTimestampWaitingRoomEvent.Format(time.RFC3339Nano),
Expand Down Expand Up @@ -131,6 +135,8 @@ var waitingRoom = WaitingRoom{
AdditionalRoutes: []*WaitingRoomRoute{{Host: "shop2.example.com", Path: "/shop/checkout"}},
QueueingStatusCode: 200,
EnabledOriginCommands: []string{"revoke"},
TurnstileMode: "invisible",
TurnstileAction: "log",
}

var waitingRoomEvent = WaitingRoomEvent{
Expand All @@ -150,6 +156,8 @@ var waitingRoomEvent = WaitingRoomEvent{
DisableSessionRenewal: nil,
QueueingMethod: "random",
CustomPageHTML: "{{#waitTimeKnown}} {{waitTime}} mins {{/waitTimeKnown}} {{^waitTimeKnown}} Event is prequeueing / Queue all enabled {{/waitTimeKnown}}",
TurnstileMode: "invisible",
TurnstileAction: "log",
}

var waitingRoomStatus = WaitingRoomStatus{
Expand Down

0 comments on commit e68377d

Please sign in to comment.