Repository: cloudflare/cloudflare-go
Pull request #1357 (2023-08-05 00:08:30)

Add queueing_status_code to Waiting Room object
<!-- 
Provide a general summary of your changes in the title above. You should
remove this overview, any sections and any section descriptions you
don't need below before submitting. There isn't a strict requirement to
use this template if you can structure your description and still cover
these points. 
-->

## Description

Waiting Room has a new configuration field `queueing_status_code` that determines what HTTP status code is returned to a user while in the queue.

See the [API docs](https://developers.cloudflare.com/api/operations/waiting-room-create-waiting-room#request-body) for more information.

<!--
Describe your changes in detail through motivation and context. Why is
this change required? What problem does it solve? If it fixes an open
issue, link to the issue using GitHub's closing issues keywords[1].
-->
## Has your change been tested?

Yes, relevant unit tests have been updated to handle the addition of this field. Additionally, changes were ran against the pre-existing test suite to verify that no regressions were introduced.

<!--
Explain how the change has been tested and what you ran to confirm your
change affects other parts of the code. Automated tests are generally
expected and changes without tests should explain why they aren't
required.
-->

## Screenshots (if appropriate):

## Types of changes

What sort of change does your code introduce/modify?

- [ ] Bug fix (non-breaking change which fixes an issue)
- [X] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to change)

## Checklist:

- [X] My code follows the code style of this project.
- [ ] My change requires a change to the documentation.
- [X] I have updated the documentation accordingly.
- [X] I have added tests to cover my changes.
- [X] All new and existing tests passed.
- [X] This change is using publicly documented in [cloudflare/api-schemas](https://github.com/cloudflare/api-schemas) 
		and relies on stable APIs.



Patch:
diff --git a/.changelog/1357.txt b/.changelog/1357.txt
new file mode 100644
index 000000000..e6f1f3b8a
--- /dev/null
+++ b/.changelog/1357.txt
@@ -0,0 +1,3 @@
+```release-note:enhancement
+waiting_room: add support for `queueing_status_code`
+```
\ No newline at end of file
diff --git a/waiting_room.go b/waiting_room.go
index fe0ed76f1..e6499d777 100644
--- a/waiting_room.go
+++ b/waiting_room.go
@@ -37,6 +37,7 @@ type WaitingRoom struct {
 	NextEventStartTime         *time.Time          `json:"next_event_start_time,omitempty"`
 	CookieSuffix               string              `json:"cookie_suffix"`
 	AdditionalRoutes           []*WaitingRoomRoute `json:"additional_routes,omitempty"`
+	QueueingStatusCode         int                 `json:"queueing_status_code"`
 }
 
 // WaitingRoomStatus describes the status of a waiting room.


Test patch:
diff --git a/waiting_room_test.go b/waiting_room_test.go
index df7e0da6b..4d5ccf00e 100644
--- a/waiting_room_test.go
+++ b/waiting_room_test.go
@@ -40,8 +40,9 @@ var waitingRoomJSON = fmt.Sprintf(`
       "default_template_language": "en-US",
       "next_event_prequeue_start_time": null,
       "next_event_start_time": "%s",
-			"cookie_suffix": "example_shop",
-			"additional_routes": [{"host": "shop2.example.com", "path": "/shop/checkout"}]
+	  "cookie_suffix": "example_shop",
+	  "additional_routes": [{"host": "shop2.example.com", "path": "/shop/checkout"}],
+	  "queueing_status_code": 200
     }
    `, waitingRoomID, testTimestampWaitingRoom.Format(time.RFC3339Nano), testTimestampWaitingRoom.Format(time.RFC3339Nano),
 	testTimestampWaitingRoomEventStart.Format(time.RFC3339Nano))
@@ -127,6 +128,7 @@ var waitingRoom = WaitingRoom{
 	NextEventPrequeueStartTime: nil,
 	CookieSuffix:               "example_shop",
 	AdditionalRoutes:           []*WaitingRoomRoute{{Host: "shop2.example.com", Path: "/shop/checkout"}},
+	QueueingStatusCode:         200,
 }
 
 var waitingRoomEvent = WaitingRoomEvent{