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.
    • ?location=STRING Returns events whose room name contains the given string.
    • ?following=TRUE Returns events the user is following, aka favorited.
    • ?dayplanner=TRUE Returns events that should appear in the user’s day planner. Currently this includes events the user’s following and events they signed up to photograph.

    Query Parameters for Shutternauts Only

    • needsPhotographer=BOOL Returns events that a ShutternautManager has marked as needing a photograher.
    • hasPhotographer=BOOL Returns events that have a photographer assigned, including self-assigns

    Needing a photographer and having one are orthogonal values–filtering for ‘needsPhotograher’ will return events that already have a photographer assigned.

    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.

  • POST /api/v3/events/:event_ID/needsphotographer POST /api/v3/events/:event_ID/needsphotographer/remove DELETE /api/v3/events/:event_ID/needsphotographer

    Sets or clears the needsPhotographer flag on the given event. May only be called by members of the shutternautManager group.

    Declaration

    Swift

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

    Parameters

    eventID

    in URL path

    Return Value

    200 OK if flag is set/cleared successfully.

  • POST /api/v3/events/ID/photographer

    Marks the current user as attending the given event as a photographer. Only callable by members of the shutternaut group. This method is how shutternauts can self-report that they’re going to be covering an event and taking pictures.

    Declaration

    Swift

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

    Parameters

    eventID

    in URL path

    Return Value

    201 Created on success; 200 OK if already marked as photographing the given event.

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

    Remove the specified Event from the user’s list of events they’ll be photographing. Only callable by members of the shutternaut group.

    Declaration

    Swift

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

    Parameters

    eventID

    in URL path

    Return Value

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

Utilities