PersonalEventController

struct PersonalEventController : APIRouteCollection

The collection of /api/v3/personalevents/* route endpoints and handler functions related to events that are specific to individual users.

tokenAuthGroup Handlers (logged in)

  • All handlers in this route group require a valid HTTP Bearer Authentication header in the request. GET /api/v3/personalevents

    Retrieve the PersonalEvents the user has access to, sorted by .startTime. By default this returns all events that the user has created or was added to.

    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.
    • ?search=STRING Returns events whose title or description contain the given string.
    • ?owned=BOOLEAN Returns events only that the user has created. Mutually exclusive with joined.
    • ?joined=BOOLEAN Returns events only that the user has joined. Mutually exclusive with owned.

    See more

    Declaration

    Swift

    func personalEventsHandler(_ req: Request) async throws -> [PersonalEventData]

    Return Value

    An array of PersonalEeventData containing the PersonalEvents.

  • POST /api/v3/personalevents/create

    Create a new PersonalEvent.

    Throws

    400 error if the supplied data does not validate.

    Declaration

    Swift

    func personalEventCreateHandler(_ req: Request) async throws -> Response

    Parameters

    requestBody

    PersonalEventContentData payload in the HTTP body.

    Return Value

    201 Created; PersonalEventData containing the newly created event.

  • GET /api/v3/personalevents/:eventID

    Get a single PersonalEvent.

    Throws

    403 error if you’re not allowed.

    Declaration

    Swift

    func personalEventHandler(_ req: Request) async throws -> PersonalEventData

    Return Value

    PersonalEventData containing the event.

  • POST /api/v3/personalevents/:eventID

    Updates an existing PersonalEvent. Note: All fields in the supplied PersonalEventContentData must be filled, just as if the event were being created from scratch.

    Throws

    400 error if the supplied data does not validate.

    Declaration

    Swift

    func personalEventUpdateHandler(_ req: Request) async throws -> PersonalEventData

    Parameters

    requestBody

    PersonalEventContentData payload in the HTTP body.

    Return Value

    PersonalEventData containing the updated event.

  • POST /api/v3/personalevents/:eventID/delete DELETE /api/v3/personalevents/:eventID

    Deletes the given PersonalEvent.

    Throws

    403 error if the user is not permitted to delete.

    Declaration

    Swift

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

    Parameters

    eventID

    in URL path.

    Return Value

    204 No Content on success.

  • POST /api/v3/personalevents/:eventID/user/:userID/delete DELETE /api/v3/personalevents/:eventID/user/:userID

    Removes a User from the PersonalEvent. Intended to be called by the User if they do not want to see this event.

    Throws

    403 error if the user is not permitted to delete.

    Declaration

    Swift

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

    Parameters

    eventID

    in URL path.

    userID

    in the URL path.

    Return Value

    204 No Content on success.

  • POST /api/v3/personalevents/:eventID/report

    Creates a Report regarding the specified PersonalEvent.

    Note

    The accompanying report message is optional on the part of the submitting user, but the ReportData is mandatory in order to allow one. If there is no message, send an empty string in the .message field.

    Declaration

    Swift

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

    Parameters

    eventID

    in URL path, the PersonalEvent ID to report.

    requestBody

    Return Value

    201 Created on success.

Utility Functions