EventController

struct EventController : APIRouteCollection

The collection of /api/v3/events/* route endpoints and handler functions related to the event schedule.

Open Access Handlers

  • eventsHandler(_:) Asynchronous

    GET /api/v3/events

    Retrieve 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=STRING query 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 EventData objects that get returned. Onlly one of [cruiseday, day, date, time] may be used.

    See more

    Declaration

    Swift

    func eventsHandler(_ req: Request) async throws -> [EventData]

    Return Value

    An array of EventData containing filtered events.

  • singleEventHandler(_:) Asynchronous

    GET /api/v3/events/ID

    Retrieve 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 -> EventData

    Parameters

    eventID

    in URL path

    Return Value

    EventData containing event info.

tokenAuthGroup Handlers (logged in)

  • favoriteAddHandler(_:) Asynchronous

    POST /api/v3/events/ID/favorite

    Add the specified Event to the user’s tagged events list.

    Declaration

    Swift

    func favoriteAddHandler(_ req: Request) async throws -> HTTPStatus

    Parameters

    eventID

    in URL path

    Return Value

    201 Created on success; 200 OK if already favorited.

  • POST /api/v3/events/ID/favorite/remove DELETE /api/v3/events/ID/favorite

    Remove the specified Event from the user’s tagged events list.

    Throws

    400 error if the event was not favorited.

    Declaration

    Swift

    func favoriteRemoveHandler(_ req: Request) async throws -> HTTPStatus

    Parameters

    eventID

    in URL path

    Return Value

    204 No Content on success; 200 OK if event is already not favorited.

  • favoritesHandler(_:) Asynchronous

    GET /api/v3/events/favorites

    Retrieve the Events the user has favorited, sorted by .startTime.

    Declaration

    Swift

    func favoritesHandler(_ req: Request) async throws -> [EventData]

    Return Value

    An array of EventData containing the user’s favorite events.