FezController
struct FezController : APIRouteCollectionThe collection of /api/v3/fez/* route endpoints and handler functions related to Looking For Group and Seamail chats.
- 
                  
                  DeclarationSwift struct FezURLQueryStruct : Content
- 
                  
                  Required. Registers routes to the incoming router. DeclarationSwift func registerRoutes(_ app: Application) throws
- 
                  
                  /GET /api/v3/fez/typesRetrieve a list of all values for FezTypeas strings.DeclarationSwift func typesHandler(_ req: Request) throws -> [String]Return ValueAn array of Stringcontaining the.labelvalue for each type.
- 
                  openHandler(_:Asynchronous) GET /api/v3/fez/openRetrieve FriendlyFezzes with open slots and a startTime of no earlier than one hour ago. Results are returned sorted by start time, then by title. URL Query Parameters: - ?cruiseday=INT- Only return fezzes occuring on this day of the cruise. Embarkation Day is day 0.
- ?type=STRING- Only return fezzes of this type, there STRING is a- FezType.fromAPIString()string.
- ?start=INT- The offset to the first result to return in the filtered + sorted array of results.
- ?limit=INT- The maximum number of fezzes to return; defaults to 50.
- ?hidepast=BOOLEAN- Show fezzes that started more than one hour in the past. For this endpoint, this defaults to TRUE.
 Throws A 5xx response should be reported as a likely bug, please and thank you. DeclarationSwift func openHandler(_ req: Request) async throws -> FezListDataReturn ValueAn array of FezDatacontaining current fezzes with open slots.
- 
                  joinedHandler(_:Asynchronous) GET /api/v3/fez/joinedRetrieve all the FriendlyFez chats that the user has joined. Results are sorted by descending fez update time. Query Parameters: - ?cruiseday=INT- Only return fezzes occuring on this day of the cruise. Embarkation Day is day 0.
- ?type=STRING- Only return fezzes of the given fezType. See- FezTypefor a list.
- ?excludetype=STRING- Don’t return fezzes of the given type. See- FezTypefor a list.
- ?onlynew=TRUE- Only return fezzes with unread messages.
- ?start=INT- The offset to the first result to return in the filtered + sorted array of results.
- ?limit=INT- The maximum number of fezzes to return; defaults to 50.
- ?search=STRING- Only show fezzes whose title, info, or any post contains the given string.
- ?hidepast=BOOLEAN- Hide fezzes that started more than one hour in the past. For this endpoint, this defaults to FALSE.
 Moderators and above can use the foruserquery parameter to access pseudo-accounts:- ?foruser=NAME- Access the “moderator” or “twitarrteam” seamail accounts.
 /GET /api/v3/fez/typesis the canonical way to get the list of acceptable values. Type and excludetype are exclusive options, obv.Throws A 5xx response should be reported as a likely bug, please and thank you.DeclarationSwift func joinedHandler(_ req: Request) async throws -> FezListDataReturn ValueAn array of FezDatacontaining all the fezzes joined by the user.
- 
                  ownerHandler(_:Asynchronous) GET /api/v3/fez/ownerRetrieve the FriendlyFez chats created by the user. Note There is no block filtering on this endpoint. In theory, a block could only apply if it were set after the fez had been joined by the second party. The owner of the fez has the ability to remove users if desired, and the fez itself is no longer visible to the non-owning party.Query Parameters: - ?cruiseday=INT- Only return fezzes occuring on this day of the cruise. Embarkation Day is day 0.
- ?type=STRING- Only return fezzes of the given fezType. See- FezTypefor a list.
- ?excludetype=STRING- Don’t return fezzes of the given type. See- FezTypefor a list.
- ?start=INT- The offset to the first result to return in the filtered + sorted array of results.
- ?limit=INT- The maximum number of fezzes to return; defaults to 50.
- ?hidepast=BOOLEAN- Hide fezzes that started more than one hour in the past. For this endpoint, this defaults to FALSE.
 Throws A 5xx response should be reported as a likely bug, please and thank you. DeclarationSwift func ownerHandler(_ req: Request) async throws -> FezListDataReturn ValueAn array of FezDatacontaining all the fezzes created by the user.
- 
                  fezHandler(_:Asynchronous) GET /api/v3/fez/:fez_IDRetrieve information about the specified FriendlyFez. For users that aren’t members of the fez, this info will be the same as the info returned for GET /api/v3/fez/open. For users that have joined the fez theFezData.MembersOnlyDatawill be populated, as will theFezPosts.Query Parameters: - ?start=INT- The offset to the first post to return in the array of posts.
- ?limit=INT- The maximum number of posts to return; defaults to 50.
 Start and limit only have an effect when the user is a member of the Fez. Limit defaults to 50 and start defaults to (readCount / limit) * limit, where readCount is how many posts the user has read already.Moderators and above can use the foruserquery parameter to access pseudo-accounts:- ?foruser=NAME- Access the “moderator” or “twitarrteam” seamail accounts.
 When a member calls this method, it updates the member’s readCount, marking all posts read up tostart + limit. However, the returned readCount is the value before updating. If there’s 5 posts in the chat, and the member has read 3 of them, the returnedFezDatahas 5 posts, we return 3 inFezData.readCountfield, and update the pivot’s readCount to 5.FezPosts are ordered by creation time.Note Posts are subject to block and mute user filtering, but mutewords are ignored in order to not suppress potentially important information. Throws 404 error if a block between the user and fez owner applies. A 5xx response should be reported as a likely bug, please and thank you. DeclarationSwift func fezHandler(_ req: Request) async throws -> FezDataParametersfezIDin the URL path. Return ValueFezDatawith fez info and all discussion posts.
- 
                  joinHandler(_:Asynchronous) POST /api/v3/fez/ID/joinAdd the current user to the FriendlyFez. If the .maxCapacityof the fez has been reached, the user is added to the waiting list.Note A user cannot join a fez that is owned by a blocked or blocking user. If any current participating or waitList user is in the user’s blocks, their identity is replaced by a placeholder in the returned data. It is the user’s responsibility to examine the participant list for conflicts prior to joining or attending. Throws 400 error if the supplied ID is not a fez barrel or user is already in fez. 404 error if a block between the user and fez owner applies. A 5xx response should be reported as a likely bug, please and thank you. DeclarationSwift func joinHandler(_ req: Request) async throws -> ResponseParametersfezIDin the URL path. Return ValueFezDatacontaining the updated fez data.
- 
                  unjoinHandler(_:Asynchronous) POST /api/v3/fez/ID/unjoinRemove the current user from the FriendlyFez. If the .maxCapacityof the fez had previously been reached, the first user from the waiting list, if any, is moved to the participant list.Throws 400 error if the supplied ID is not a fez barrel. A 5xx response should be reported as a likely bug, please and thank you.DeclarationSwift func unjoinHandler(_ req: Request) async throws -> FezDataParametersfezIDin the URL path. Return ValueFezDatacontaining the updated fez data.
- 
                  postAddHandler(_:Asynchronous) POST /api/v3/fez/ID/postAdd a FezPostto the specifiedFriendlyFez.Open fez types are only permitted to have 1 image per post. Private fezzes (aka Seamail) cannot have any images. Throws 404 error if the fez is not available. A 5xx response should be reported as a likely bug, please and thank you.DeclarationSwift func postAddHandler(_ req: Request) async throws -> FezPostDataParametersfezIDin URL path requestBodyReturn ValueFezPostDatacontaining the user’s new post.
- 
                  postDeleteHandler(_:Asynchronous) POST /api/v3/fez/post/ID/deleteDELETE /api/v3/fez/post/IDDelete a FezPost. Must be author of post.Throws 403 error if user is not the post author. 404 error if the fez is not available. A 5xx response should be reported as a likely bug, please and thank you.DeclarationSwift func postDeleteHandler(_ req: Request) async throws -> HTTPStatusParametersfezIDin URL path Return ValueHTTP 204 No Content 
- 
                  reportFezPostHandler(_:Asynchronous) POST /api/v3/fez/post/ID/reportCreates a Reportregarding the specifiedFezPost.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.Throws 400 error if the post is private. Throws 404 error if the parent fez of the post could not be found. DeclarationSwift func reportFezPostHandler(_ req: Request) async throws -> HTTPStatusParameterspostIDin URL path, the ID of the post being reported. requestBodyReportDatapayload in the HTTP body.Return Value201 Created on success. 
- 
                  createHandler(_:Asynchronous) POST /api/v3/fez/createCreate a FriendlyFez. The creating user is automatically added to the participant list.The list of recognized values for use in the .fezTypefield is obtained fromGET /api/v3/fez/types.The startTime,endTime, andlocationfields are optional. Pass nil for these fields if the values are unknown/not applicable. Clients should convert nils in these fields to “TBD” for display.Important Do not pass “0” as the date value. Unless you really are scheduling something for the first stroke of midnight in 1970.A value of 0 in either the .minCapacityor.maxCapacityfields indicates an undefined limit: “there is no minimum”, “there is no maximum”.Throws 400 error if the supplied data does not validate.DeclarationSwift func createHandler(_ req: Request) async throws -> ResponseParametersrequestBodyFezContentDatapayload in the HTTP body.Return Value201 Created; FezDatacontaining the newly created fez.
- 
                  cancelHandler(_:Asynchronous) POST /api/v3/fez/ID/cancelCancel a FriendlyFez. Owner only. Cancelling a Fez is different from deleting it. A canceled fez is still visible; members may still post to it. But, a cenceled fez does not show up in searches for open fezzes, and should be clearly marked in UI to indicate that it’s been canceled. Note Eventually, cancelling a fez should notifiy all members via the notifications endpoint. Throws 403 error if user is not the fez owner. A 5xx response should be reported as a likely bug, please and thank you. DeclarationSwift func cancelHandler(_ req: Request) async throws -> FezDataParametersfezIDin URL path. Return ValueFezDatawith the updated fez info.
- 
                  fezDeleteHandler(_:Asynchronous) POST /api/v3/fez/ID/deleteDELETE /api/v3/fez/IDDelete the specified FriendlyFez. This soft-deletes the fez. Posts are left as-is.To delete, the user must have an access level allowing them to delete the fez. Currently this means moderators and above. The owner of a fez may Cancel the fez, which tells the members the fez was cancelled, but does not delete it. Throws 403 error if the user is not permitted to delete.DeclarationSwift func fezDeleteHandler(_ req: Request) async throws -> HTTPStatusParametersfezIDin URL path. Return Value204 No Content on success. 
- 
                  updateHandler(_:Asynchronous) POST /api/v3/fez/ID/updateUpdate the specified FriendlyFez with the supplied data. Updating a cancelled fez will un-cancel it. Note All fields in the supplied FezContentDatamust be filled, just as if the fez were being created from scratch. If there is demand, using a set of more efficient endpoints instead of this single monolith can be considered.Throws 400 error if the data is not valid. 403 error if user is not fez owner. A 5xx response should be reported as a likely bug, please and thank you. DeclarationSwift func updateHandler(_ req: Request) async throws -> FezDataParametersfezIDin URL path. requestBodyFezContentDatapayload in the HTTP body.Return ValueFezDatacontaining the updated fez info.
- 
                  userAddHandler(_:Asynchronous) POST /api/v3/fez/ID/user/ID/addAdd the specified Userto the specified LFG or open chat. This lets the owner invite others.Throws 400 error if user is already in barrel. 403 error if requester is not fez owner. A 5xx response should be reported as a likely bug, please and thank you.DeclarationSwift func userAddHandler(_ req: Request) async throws -> FezDataParametersfezIDin URL path. userIDin URL path. Return ValueFezDatacontaining the updated fez info.
- 
                  userRemoveHandler(_:Asynchronous) POST /api/v3/fez/ID/user/:userID/removeRemove the specified Userfrom the specified FriendlyFez barrel. This lets a fez owner remove others.Throws 400 error if user is not in the barrel. 403 error if requester is not fez owner. A 5xx response should be reported as a likely bug, please and thank you.DeclarationSwift func userRemoveHandler(_ req: Request) async throws -> FezDataParametersfezIDin URL path. userIDin URL path. Return ValueFezDatacontaining the updated fez info.
- 
                  reportFezHandler(_:Asynchronous) POST /api/v3/fez/ID/reportCreates a Reportregarding the specifiedFez. This reports on the Fez itself, not any of its posts in particular. This could mean a Fez with reportable content in its Title, Info, or Location fields, or a bunch of reportable posts in the fez.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.DeclarationSwift func reportFezHandler(_ req: Request) async throws -> HTTPStatusParametersfezIDin URL path, the Fez ID to report. requestBodyReturn Value201 Created on success. 
- 
                  createFezSocket(_:Asynchronous_: ) WS /api/v3/fez/:fezID/socketOpens a websocket to receive updates on the given fez. At the moment there’s only 2 messages that the client may receive: - SocketFezPostData- sent when a post is added to the fez.
- SocketMemberChangeData- sent when a member joins/leaves the fez.
 Note that there’s a bunch of other state change that can happen with a fez; I haven’t built out code to send socket updates for them. The socket returned by this call is only intended for receiving updates; there are no client-initiated messages defined for this socket. Posting messages, leaving the fez, updating or canceling the fez and any other state changes should be performed using the various POST methods of this controller. The server validates membership before sending out each socket message, but be sure to close the socket if the user leaves the fez. This method is designed to provide updates only while a user is viewing the fez in your app–don’t open one of these sockets for each fez a user joins and keep them open continually. Use WS /api/v3/notification/socketfor long-term status updates.DeclarationSwift func createFezSocket(_ req: Request, _ ws: WebSocket) async
- 
                  
                  DeclarationSwift func forwardPostToSockets(_ fez: FriendlyFez, _ post: FezPost, on req: Request) throws
- 
                  
                  DeclarationSwift func forwardMembershipChangeToSockets(_ fez: FriendlyFez, participantID: UUID, joined: Bool, on req: Request) throws
- 
                  muteAddHandler(_:Asynchronous) POST /api/v3/fez/:fez_ID/muteMute the specified Fezfor the current user.DeclarationSwift func muteAddHandler(_ req: Request) async throws -> HTTPStatusParametersfez_IDIn the URL path. Return Value201 Created on success; 200 OK if already muted. 
- 
                  muteRemoveHandler(_:Asynchronous) POST /api/v3/fez/:fez_ID/mute/removeDELETE /api/v3/fez/:fez_ID/muteUnmute the specified Fezfor the current user.Throws 400 error if the forum was not muted.DeclarationSwift func muteRemoveHandler(_ req: Request) async throws -> HTTPStatusParametersfez_IDIn the URL path. Return Value204 No Content on success; 200 OK if already not muted. 
- 
                  
                  DeclarationSwift func buildFezData( from fez: FriendlyFez, with pivot: FezParticipant? = nil, posts: [FezPostData]? = nil, for cacheUser: UserCacheData, on req: Request ) throws -> FezData
- 
                  buildPostsForFez(_:Asynchronouspivot: on: user: ) DeclarationSwift func buildPostsForFez(_ fez: FriendlyFez, pivot: FezParticipant?, on req: Request, user: UserCacheData) async throws -> ([FezPostData], Paginator)
- 
                  getUserPivot(fez:AsynchronoususerID: on: ) DeclarationSwift func getUserPivot(fez: FriendlyFez, userID: UUID, on db: Database) async throws -> FezParticipant?
- 
                  
                  DeclarationSwift func userCanViewMemberData(user: UserCacheData, fez: FriendlyFez) -> Bool
- 
                  
                  DeclarationSwift func getEffectiveUser(user: UserCacheData, req: Request) throws -> UserCacheData
- 
                  
                  DeclarationSwift func getEffectiveUser(user: UserCacheData, req: Request, fez: FriendlyFez) -> UserCacheData
 View on GitHub
            View on GitHub
           FezController Structure Reference
      FezController Structure Reference