EventController
struct EventController : APIRouteCollection
The collection of /api/v3/events/* route endpoints and handler functions related
to the event schedule.
-
Required. Registers routes to the incoming router.
Declaration
Swift
func registerRoutes(_ app: Application) throws
-
eventsHandler(_:Asynchronous) GET /api/v3/eventsRetrieve a list of scheduled events. By default, this retrieves the entire event schedule.
URL Query Parameters:
- cruiseday=INT Embarkation day is day 1, value should be less than or equal to
Settings.shared.cruiseLengthInDays, which will be 8 for the 2022 cruise. - day=STRING 3 letter day of week abbreviation e.g. “TUE” .Returns events for that day of the cruise in 2022 “SAT” returns events for embarkation day while the current date is earlier than embarkation day, then it returns events for disembarkation day.
- ?date=DATE Returns events occurring on the given day. Empty list if there are no cruise events on that day.
- ?time=DATE Returns events whose startTime is earlier (or equal) to DATE and endTime is later than DATE. Note that this will often include ‘all day’ events.
- ?type=[official, shadow] Only returns events matching the selected type.
- ?search=STRING Returns events whose title or description contain the given string.
The
?day=STRINGquery parameter is intended to make it easy to get schedule events returned even when the cruise is not occurring, for ease of testing. The day and date parameters actually return events from 3AM local time on the given day until 3AM the next day–some events start after midnight and tend to get lost by those looking at daily schedules.All the above parameters filter the set of
See moreEventDataobjects that get returned. Onlly one of [cruiseday, day, date, time] may be used.Declaration
Swift
func eventsHandler(_ req: Request) async throws -> [EventData]Return Value
An array of
EventDatacontaining filtered events. - cruiseday=INT Embarkation day is day 1, value should be less than or equal to
-
singleEventHandler(_:Asynchronous) GET /api/v3/events/IDRetrieve a single event from its database ID or event UID. UID is part of the ICS spec for calendar events (RFC 5545).
Declaration
Swift
func singleEventHandler(_ req: Request) async throws -> EventDataParameters
eventIDin URL path
Return Value
EventDatacontaining event info.
-
favoriteAddHandler(_:Asynchronous) POST /api/v3/events/ID/favoriteAdd the specified
Eventto the user’s tagged events list.Declaration
Swift
func favoriteAddHandler(_ req: Request) async throws -> HTTPStatusParameters
eventIDin URL path
Return Value
201 Created on success; 200 OK if already favorited.
-
favoriteRemoveHandler(_:Asynchronous) POST /api/v3/events/ID/favorite/removeDELETE /api/v3/events/ID/favoriteRemove the specified
Eventfrom the user’s tagged events list.Throws
400 error if the event was not favorited.Declaration
Swift
func favoriteRemoveHandler(_ req: Request) async throws -> HTTPStatusParameters
eventIDin URL path
Return Value
204 No Content on success; 200 OK if event is already not favorited.
-
favoritesHandler(_:Asynchronous)
View on GitHub
EventController Structure Reference