PersonalEventController
struct PersonalEventController : APIRouteCollection
The collection of /api/v3/personalevents/* route endpoints and handler functions related
to events that are specific to individual users.
-
Required. Registers routes to the incoming router.
Declaration
Swift
func registerRoutes(_ app: Application) throws
-
personalEventsHandler(_:Asynchronous) All handlers in this route group require a valid HTTP Bearer Authentication header in the request.
GET /api/v3/personaleventsRetrieve 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.
Declaration
Swift
func personalEventsHandler(_ req: Request) async throws -> [PersonalEventData]Return Value
An array of
PersonalEeventDatacontaining thePersonalEvents. - ?cruiseday=INT Embarkation day is day 1, value should be less than or equal to
-
personalEventCreateHandler(_:Asynchronous) POST /api/v3/personalevents/createCreate a new PersonalEvent.
Throws
400 error if the supplied data does not validate.Declaration
Swift
func personalEventCreateHandler(_ req: Request) async throws -> ResponseParameters
requestBodyPersonalEventContentDatapayload in the HTTP body.Return Value
201 Created;
PersonalEventDatacontaining the newly created event. -
personalEventHandler(_:Asynchronous) GET /api/v3/personalevents/:eventIDGet a single
PersonalEvent.Throws
403 error if you’re not allowed.Declaration
Swift
func personalEventHandler(_ req: Request) async throws -> PersonalEventDataReturn Value
PersonalEventDatacontaining the event. -
personalEventUpdateHandler(_:Asynchronous) POST /api/v3/personalevents/:eventIDUpdates an existing
PersonalEvent. Note: All fields in the suppliedPersonalEventContentDatamust 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 -> PersonalEventDataParameters
requestBodyPersonalEventContentDatapayload in the HTTP body.Return Value
PersonalEventDatacontaining the updated event. -
personalEventDeleteHandler(_:Asynchronous) POST /api/v3/personalevents/:eventID/deleteDELETE /api/v3/personalevents/:eventIDDeletes the given
PersonalEvent.Throws
403 error if the user is not permitted to delete.Declaration
Swift
func personalEventDeleteHandler(_ req: Request) async throws -> HTTPStatusParameters
eventIDin URL path.
Return Value
204 No Content on success.
-
personalEventUserRemoveHandler(_:Asynchronous) POST /api/v3/personalevents/:eventID/user/:userID/deleteDELETE /api/v3/personalevents/:eventID/user/:userIDRemoves a
Userfrom thePersonalEvent. Intended to be called by theUserif 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 -> HTTPStatusParameters
eventIDin URL path.
userIDin the URL path.
Return Value
204 No Content on success.
-
personalEventReportHandler(_:Asynchronous) POST /api/v3/personalevents/:eventID/reportCreates a
Reportregarding the specifiedPersonalEvent.Note
The accompanying report message is optional on the part of the submitting user, but the
ReportDatais mandatory in order to allow one. If there is no message, send an empty string in the.messagefield.Declaration
Swift
func personalEventReportHandler(_ req: Request) async throws -> HTTPStatusParameters
eventIDin URL path, the PersonalEvent ID to report.
requestBodyReturn Value
201 Created on success.
View on GitHub