ForumController

struct ForumController : APIRouteCollection

The collection of /api/v3/forum/* route endpoints and handler functions related to forums.

Open Access Handlers

  • categoriesHandler(_:) Asynchronous

    GET /api/v3/forum/categories

    Retrieve a list of forum Categorys, sorted by access level and title. Access to certain categories is restricted to users of an appropriate access level, which implies those categories won’t be shown if you don’t provide a login token. Without a token, the ‘accessible to anyone’ categories are returned. You’ll still need to be logged in to see the contents of the categories, or post, or do much anything else.

    URL Query Parameters:

    • ?cat=UUID Only return information about the given category. Will still return an array of CategoryData.

    Declaration

    Swift

    func categoriesHandler(_ req: Request) async throws -> [CategoryData]

    Return Value

    An array of CategoryData containing all category IDs and titles. Or just the one, if you use the ?cat parameter.

Returns Forum Lists

  • GET /api/v3/forum/categories/:ID

    Retrieve a list of forums in the specifiec Category. Will not return forums created by blocked users.

    URL Query Parameters:

    • ?sort=[create, update, title, event] - Sort forums by create time, update time, or title, or the start time of their associated Event.
    • ?order=[ascending, descending] - Specify a sort order. Omit this parameter to use the default ordering for the category type. Create and update return newest forums first. event is only valid for Event categories, is default for them, and returns forums in ascending event start time; secondary sort is alpha on event title. Update is the default for non-event categories.
    • ?start=INT - The index into the sorted list of forums to start returning results. 0 for first item, which is the default.
    • ?limit=INT - The max # of entries to return. Defaults to 50

    beforedate and afterdate set the anchor point for returning threads. By default the anchor is ‘newest create date’. When sorting on update time, these params may be used to ensure a series of calls see (mostly) contiguous resullts. As users keep posting to threads, the sorting for most recently updated threads is constantly changing. A paged UI, for example, may show N threads per page and use beforedate/afterdate as the user moves between pages to ensure continuity. When sorting on update time, afterdate and beforedate operate on the threads’ update time. Create and Alpha sort use create time. These options are mutally exclusive; if both are present, beforeDate will be used.

    • ?afterdate=DATE -
    • ?beforedate=DATE -

    With no parameters, defaults to ?sort=update&start=0&limit=50.

    If you want to ensure you have all the threads in a category, you can sort by create time and ask for threads newer than the last time you asked. If you want to update last post times and post counts, you can sort by update time and get the latest updates.

    Throws

    404 error if the category ID is not valid.

    Declaration

    Swift

    func categoryForumsHandler(_ req: Request) async throws -> CategoryData

    Return Value

    CategoryData containing category forums.

  • forumSearchHandler(_:) Asynchronous

    GET /api/v3/forum/search

    Retrieve all Forums in all categories that match the specified criteria. Results will be sorted by most recent post time by default.. Does not return results from categories for which the user does not have access.

    URL Query Parameters:

    • ?search=STRING - Matches forums with STRING in their title.
    • ?category=UUID - Limit results to forums in given category. Adding this multiple times ORs all categories together
    • ?creatorself - Matches forums created by the current user..
    • ?creator=STRING - Matches forums created by the given username. Adding this multiple times ORs all forum creators together
    • ?creatorid=UUID - Matches forums created by the given userID. Adding this multiple times ORs all forum creators together
    • ?favorite - Limit results to forums that are favorited by the current user.
    • ?mute - Limit results to forums that are muted by the current user.
    • ?searchposts=STRING - Matches FORUMS where any post in the forum contains the given search string.
    • ?unread - Limit resuts to forums that have posts the current user hasn’t read
    • ?posted - Matches forums where the current user posted.

    • ?start=INT - The index into the array of forums to start returning results. 0 for first forum.

    • ?limit=INT - The max # of entries to return. Defaults to 50. Clamped to a max value set in Settings.

    • ?sort=[create, update, title] - Sort forums by create, update, or title. Create and update return newest forums first.\

    • ?order=[ascending, descending] - Specify a sort order. Omit this parameter to use the default ordering.

    See more

    Declaration

    Swift

    func forumSearchHandler(_ req: Request) async throws -> ForumSearchData

    Parameters

    searchString

    In the URL path.

    Return Value

    A ForumSearchData containing all matching forums.

  • ownerHandler(_:) Asynchronous

    GET /api/v3/forum/owner

    Retrieve a list of all Forums created by the user. Default is to be sorted by title.

    URL Query Parameters:

    • ?cat=CATEGORY_ID - Limit returned list to forums in the given category (that were also created by the current user).
    • ?sort=[create, update, title] - Sort forums by create, update, or title. Create and update return newest forums first.
    • ?order=[ascending, descending] - Specify a sort order. Omit this parameter to use the default ordering.
    • ?start=INT - The index into the array of forums to start returning results. 0 for first forum.
    • ?limit=INT - The max # of entries to return. Defaults to 50. Clamped to a max value set in Settings.

    Declaration

    Swift

    func ownerHandler(_ req: Request) async throws -> ForumSearchData

    Return Value

    A ForumSearchData containing all forums created by the user.

  • favoritesHandler(_:) Asynchronous

    GET /api/v3/forum/favorites

    Retrieve the Forums the user has favorited.

    URL Query Parameters:

    • ?cat=CATEGORY_ID - Only show favorites in the given category
    • ?sort=STRING - Sort forums by create, update, or title. Create and update return newest forums first. update is the default.
    • ?order=[ascending, descending] - Specify a sort order. Omit this parameter to use the default ordering.
    • ?start=INT - The index into the sorted list of forums to start returning results. 0 for first item, which is the default.
    • ?limit=INT - The max # of entries to return. Defaults to 50

    Declaration

    Swift

    func favoritesHandler(_ req: Request) async throws -> ForumSearchData

    Return Value

    A ForumSearchData containing the user’s favorited forums.

  • mutesHandler(_:) Asynchronous

    GET /api/v3/forum/mutes

    Retrieve the Forums the user has muted.

    URL Query Parameters:

    • ?cat=CATEGORY_ID - Only show favorites in the given category
    • ?sort=STRING - Sort forums by create, update, or title. Create and update return newest forums first. update is the default.
    • ?order=[ascending, descending] - Specify a sort order. Omit this parameter to use the default ordering.
    • ?start=INT - The index into the sorted list of forums to start returning results. 0 for first item, which is the default.
    • ?limit=INT - The max # of entries to return. Defaults to 50

    Declaration

    Swift

    func mutesHandler(_ req: Request) async throws -> ForumSearchData

    Return Value

    A ForumSearchData containing the user’s muted forums.

  • unreadHandler(_:) Asynchronous

    GET /api/v3/forum/unread

    Retrieve the Forums the user has not read.

    URL Query Parameters:

    • ?cat=CATEGORY_ID - Only show favorites in the given category
    • ?sort=STRING - Sort forums by create, update, or title. Create and update return newest forums first. update is the default.
    • ?order=[ascending, descending] - Specify a sort order. Omit this parameter to use the default ordering.
    • ?start=INT - The index into the sorted list of forums to start returning results. 0 for first item, which is the default.
    • ?limit=INT - The max # of entries to return. Defaults to 50

    Declaration

    Swift

    func unreadHandler(_ req: Request) async throws -> ForumSearchData

    Return Value

    A ForumSearchData containing the user’s muted forums.

  • recentsHandler(_:) Asynchronous

    GET /api/v3/forum/recent

    Retrieve the Forums the user has recently visited. Results are sorted by most recent time each forum was visited.

    URL Query Parameters:

    • ?start=INT - The index into the sorted list of forums to start returning results. 0 for first item, which is the default.
    • ?limit=INT - The max # of entries to return. Defaults to 50

    Declaration

    Swift

    func recentsHandler(_ req: Request) async throws -> ForumSearchData

    Return Value

    A ForumSearchData containing the user’s favorited forums.

Returns Posts

  • forumThreadHandler(_:) Asynchronous

    GET /api/v3/forum/ID

    Retrieve a Forum with all its ForumPosts. Content from blocked or muted users, or containing user’s muteWords, is not returned. Posts are always sorted by creation time.

    URL Query Parameters:

    • ?start=INT - The index into the array of posts to start returning results. 0 for first post. Not compatible with startPost.
    • ?startPost=INT - PostID of a post in the thread. Acts as if start had been used with the index of this post within the thread.
    • ?limit=INT - The max # of entries to return. Defaults to 50. Clamped to a max value set in Settings.

    The first post in the result posts array (assuming it isn’t blocked/muted) will be, in priority order:

    1. The start-th post in the thread (first post has index 0).
    2. The post with id of startPost
    3. The page of thread posts (with limit as pagesize) that contains the last post read by the user.
    4. The first post in the thread.

    Start and Limit may not take all of the forum post filters into account, meaning you may receive fewer posts than requested even if your response doesn’t include the last post. When asking for e.g. the first 50 posts in a thread you may only receive 46 posts, as 4 posts in that batch were filtered out after the database query. To continue reading the thread, ask to start with post 50 (not post 47)–you’ll receive however many posts are viewable by the user in the range 50…99 . Doing it this way makes Forum read counts invariant to blocks–if a user reads a forum, then blocks a user, then comes back to the forum, they should come back to the same place they were in previously.

    Throws

    404 error if the forum is not available.

    Declaration

    Swift

    func forumThreadHandler(_ req: Request) async throws -> ForumData

    Parameters

    forumID

    in URL path

    Return Value

    ForumData containing the forum’s metadata and posts.

  • GET /api/v3/forum/post/ID/forum

    Retrieve the ForumData of the specified ForumPost‘s parent Forum.

    URL Query Parameters:

    • ?start=INT - The index into the array of posts to start returning results. 0 for first post.
    • ?limit=INT - The max # of entries to return. Defaults to 50. Clamped to a max value set in Settings.

    The first post in the result posts array (assuming it isn’t blocked/muted) will be, in priority order: - The start-th post in the thread (first post has index 0). - The post with ID given by the ID path parameter

    Start and Limit do not take blocks and mutes into account, matching the behavior of the totalPosts values. Instead, when asking for e.g. the first 50 posts in a thread, you may only receive 46 posts, as 4 posts in that batch were blocked/muted. To continue reading the thread, ask to start with post 50 (not post 47)–you’ll receive however many posts are viewable by the user in the range 50…99 . Doing it this way makes Forum read counts invariant to blocks–if a user reads a forum, then blocks a user, then comes back to the forum, they should come back to the same place they were in previously.

    Throws

    A 5xx response should be reported as a likely bug, please and thank you.

    Declaration

    Swift

    func postForumThreadHandler(_ req: Request) async throws -> ForumData

    Parameters

    postID

    In the URL path.

    Return Value

    ForumData containing the post’s parent forum.

  • GET /api/v3/forum/forevent/ID

    Retrieve the Forum associated with an Event, with its ForumPosts. Content from blocked or muted users, or containing user’s muteWords, is not returned.

    URL Query Parameters:

    • ?start=INT - The index into the array of posts to start returning results. 0 for first post. Default is the last post the user read, rounded down to a multiple of limit.
    • ?limit=INT - The max # of entries to return. Defaults to 50. Clamped to a max value set in Settings.

    Throws

    A 5xx response should be reported as a likely bug, please and thank you.

    Declaration

    Swift

    func eventForumThreadHandler(_ req: Request) async throws -> ForumData

    Parameters

    eventID

    In the URL path.

    Return Value

    ForumData containing the forum’s metadata and all posts.

  • postHandler(_:) Asynchronous

    GET /api/v3/forum/post/ID

    Retrieve the specified ForumPost with full user LikeType data.

    Throws

    404 error if the post is not available.

    Declaration

    Swift

    func postHandler(_ req: Request) async throws -> PostDetailData

    Parameters

    postID

    In the URL path.

    Return Value

    PostDetailData containing the specified post.

  • postSearchHandler(_:) Asynchronous

    GET /api/v3/forum/post/search

    Search all ForumPosts that match the filters given in the URL query parameters:

    URL Query Parameters:

    • ?search=STRING - Matches posts whose text contains the given search string.
    • ?hashtag=STRING - Matches posts whose text contains the given #hashtag. The leading # is optional in the query parameter.
    • ?mentionname=STRING - Matches posts whose text contains a @mention of the given username. The leading @ is optional in the query parameter.
    • ?mentionid=UUID - Matches posts whose text contains a @mention of the user with the given userID. Do not prefix userID with @.
    • ?mentionself=true - Matches posts whose text contains a @mention of the current user.
    • ?ownreacts=true - Matches posts the current user has reacted to.
    • ?byself=true - Matches posts the current user authored.
    • ?bookmarked=true - Matches posts the user has bookmarked.
    • ?creatorid=STRING - Matches posts created by the given userID.

    Additionally, you can constrain results to either posts in a specific category, or a specific forum. If both are specified, forum is ignored.

    • ?forum=UUID - Confines the search to posts in the given forum thread.
    • ?category=UUID - Confines the search to posts in the given forum category.

    While mentionname does not test whether the @mention matches any user’s username, mentionid does. Also mentionname, mentionid and mentionself are mutually exclusive parameters.

    • ?start=INT - The index into the sorted list of forums to start returning results. 0 for first item, which is the default.
    • ?limit=INT - The max # of entries to return. Defaults to 50

    Declaration

    Swift

    func postSearchHandler(_ req: Request) async throws -> PostSearchData

    Return Value

    PostSearchData containing the search results..

POST and DELETE actions

  • bookmarkAddHandler(_:) Asynchronous

    POST /api/v3/forum/post/ID/bookmark

    Add a bookmark of the specified ForumPost.

    Throws

    400 error if the post is already bookmarked.

    Declaration

    Swift

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

    Parameters

    postID

    In the URL path.

    Return Value

    201 Created on success; 200 OK if already bookmarked.

  • POST /api/v3/forum/post/ID/bookmark/remove DELETE /api/v3/forum/post/ID/bookmark

    Remove a bookmark of the specified ForumPost.

    Throws

    400 error if the user has not bookmarked any posts.

    Declaration

    Swift

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

    Parameters

    postID

    In the URL path.

    Return Value

    204 NoContent on success.

  • favoriteAddHandler(_:) Asynchronous

    POST /api/v3/forum/ID/favorite

    Add the specified Forum to the user’s tagged forums list.

    Declaration

    Swift

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

    Parameters

    forumID

    In the URL path.

    Return Value

    201 Created on success; 200 OK if already favorited.

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

    Remove the specified Forum from the user’s tagged forums list.

    Throws

    400 error if the forum was not favorited.

    Declaration

    Swift

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

    Parameters

    forumID

    In the URL path.

    Return Value

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

  • muteAddHandler(_:) Asynchronous

    POST /api/v3/forum/ID/mute

    Mute the Forum for the current user.

    Declaration

    Swift

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

    Parameters

    forumID

    In the URL path.

    Return Value

    201 Created on success; 200 OK if already muted.

  • muteRemoveHandler(_:) Asynchronous

    DELETE /api/v3/forum/ID/mute

    Unmute the specified Forum for the current user.

    Throws

    400 error if the forum was not muted.

    Declaration

    Swift

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

    Parameters

    forumID

    In the URL path.

    Return Value

    204 No Content on success; 200 OK if already not muted.

  • forumPinAddHandler(_:) Asynchronous

    POST /api/v3/forum/ID/pin

    Pin the forum to the category.

    Declaration

    Swift

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

    Parameters

    forumID

    In the URL path.

    Return Value

    201 Created on success; 200 OK if already pinned.

  • DELETE /api/v3/forum/ID/pin

    Unpin the forum from the category.

    Declaration

    Swift

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

    Parameters

    forumID

    In the URL path.

    Return Value

    204 No Content on success; 200 OK if already not pinned.

  • forumCreateHandler(_:) Asynchronous

    POST /api/v3/forum/categories/ID/create

    Creates a new Forum in the specified Category, and the first ForumPost within the newly created forum. Creating a forum in a category requires a userAccessLevel >= the category’s accessLevelToCreate.

    Note

    Users may be able to add posts to existing forum threads in categories where they don’t have access to create new threads.

    This function intentionally does not generate a ForumReader pivot for the user that created it. https://github.com/jocosocial/swiftarr/issues/168 See SiteForumController.swift for more.

    Throws

    403 error if the user is not authorized to create a forum.

    Declaration

    Swift

    func forumCreateHandler(_ req: Request) async throws -> ForumData

    Parameters

    categoryID

    in URL path

    requestBody

    ForumCreateData payload in the HTTP body.

    Return Value

    ForumData containing the new forum’s contents.

  • forumRenameHandler(_:) Asynchronous

    POST /api/v3/forum/ID/rename/:new_name

    Rename the specified Forum to the specified title string.

    Throws

    403 error if the user does not have credentials to modify the forum. 404 error if the forum ID is not valid.

    Declaration

    Swift

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

    Parameters

    forumID

    in URL path

    new_name

    in URL path; URL-path encoded.

    Return Value

    201 Created on success.

  • forumReportHandler(_:) Asynchronous

    POST /api/v3/forum/ID/report

    Creates a Report regarding the specified Forum. The ‘correct’ use of this method is to report issues with the forum title. However, no amount of guidance is going to get users to not use this method to report on individual posts in the thread, even though there’s a separate reporting API for reporting posts.

    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 forumReportHandler(_ req: Request) async throws -> HTTPStatus

    Parameters

    forumID

    in URL path

    requestBody

    ReportData payload in the HTTP body.

    Return Value

    201 Created on success.

  • forumDeleteHandler(_:) Asynchronous

    POST /api/v3/forum/ID/delete DELETE /api/v3/forum/ID

    Delete the specified Forum. This soft-deletes the forum itself and all the forum’s posts. The posts have to be deleted so they won’t be returned by search methods.

    To delete, the user must have an access level allowing them to delete the forum. Currently this means moderators and above. This means a regular user cannot delete a forum they created themselves.

    Throws

    403 error if the user is not permitted to delete.

    Declaration

    Swift

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

    Parameters

    forumID

    in URL path

    Return Value

    204 No Content on success.

  • postCreateHandler(_:) Asynchronous

    POST /api/v3/forum/ID/create

    Create a new ForumPost in the specified Forum.

    Creating a new post in a forum updates that forum’s lastPostTime timestamp. Editing, deleting, or reacting to posts does not change the timestamp. This behavior sets the sort order for forums in a category when using the update sort order.

    Throws

    403 error if the forum is locked or user is blocked.

    Declaration

    Swift

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

    Parameters

    forumID

    in URL path

    requestBody

    Return Value

    PostData containing the post’s contents and metadata.

  • postDeleteHandler(_:) Asynchronous

    POST /api/v3/forum/post/ID/delete DELETE /api/v3/forum/post/ID

    Delete the specified ForumPost.

    To delete, the user must have an access level allowing them to delete the post, and the forum itself must not be locked or in quarantine.

    Throws

    403 error if the user is not permitted to delete.

    Declaration

    Swift

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

    Parameters

    postID

    in URL path

    Return Value

    204 No Content on success.

  • postReportHandler(_:) Asynchronous

    POST /api/v3/forum/post/ID/report

    Create a Report regarding the specified ForumPost.

    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.

    Throws

    409 error if user has already reported the post.

    Declaration

    Swift

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

    Parameters

    requestBody

    Return Value

    201 Created on success.

  • postLaughHandler(_:) Asynchronous

    POST /api/v3/forum/post/ID/laugh

    Add a “laugh” reaction to the specified ForumPost. If there is an existing LikeType reaction by the user, it is replaced.

    Throws

    403 error if user is the post’s creator.

    Declaration

    Swift

    func postLaughHandler(_ req: Request) async throws -> PostData

    Parameters

    postID

    in URL path

    Return Value

    PostData containing the updated like info.

  • postLikeHandler(_:) Asynchronous

    POST /api/v3/forum/post/ID/like

    Add a “like” reaction to the specified ForumPost. If there is an existing LikeType reaction by the user, it is replaced.

    Throws

    403 error if user is the post’s creator.

    Declaration

    Swift

    func postLikeHandler(_ req: Request) async throws -> PostData

    Parameters

    postID

    in URL path

    Return Value

    PostData containing the updated like info.

  • postLoveHandler(_:) Asynchronous

    POST /api/v3/forum/post/ID/love

    Add a “love” reaction to the specified ForumPost. If there is an existing LikeType reaction by the user, it is replaced.

    Throws

    403 error if user is the post’s creator.

    Declaration

    Swift

    func postLoveHandler(_ req: Request) async throws -> PostData

    Parameters

    postID

    in URL path

    Return Value

    PostData containing the updated like info.

  • Declaration

    Swift

    func postReactHandler(_ req: Request, likeType: LikeType) async throws -> PostData
  • postUnreactHandler(_:) Asynchronous

    POST /api/v3/forum/post/ID/unreact DELETE /api/v3/forum/post/ID/like DELETE /api/v3/forum/post/ID/laugh DELETE /api/v3/forum/post/ID/love

    Remove a LikeType reaction from the specified ForumPost.

    Throws

    403 error if user is the post’s creator.

    Declaration

    Swift

    func postUnreactHandler(_ req: Request) async throws -> PostData

    Parameters

    postID

    in URL path

    Return Value

    PostData containing the updated like info.

  • postUpdateHandler(_:) Asynchronous

    POST /api/v3/forum/post/ID/update

    Update the specified ForumPost.

    Throws

    403 error if user is not post owner or has read-only access.

    Declaration

    Swift

    func postUpdateHandler(_ req: Request) async throws -> PostData

    Parameters

    postID

    in URL path

    requestBody

    Return Value

    PostData containing the post’s contents and metadata.

  • GET /api/v3/forum/:forumID/pinnedposts

    Get a list of all of the pinned posts within this forum. This currently does not implement paginator because if pagination is needed for pinned posts what the frak have you done?

    Declaration

    Swift

    func forumPinnedPostsHandler(_ req: Request) async throws -> [PostData]

    Parameters

    forumID

    In the URL path.

  • POST /api/v3/forum/post/:postID/pin

    Pin the post to the forum.

    Declaration

    Swift

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

    Parameters

    postID

    In the URL path.

    Return Value

    201 Created on success; 200 OK if already pinned.

  • DELETE /api/v3/forum/:postID/ID/pin

    Unpin the post from the forum.

    Declaration

    Swift

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

    Parameters

    postID

    In the URL path.

    Return Value

    204 No Content on success; 200 OK if already not pinned.

  • Ensures the given user has appropriate access to create or edit posts in the given forum. If editing a post, you must pass the post in the editingPost parameter.

    Declaration

    Swift

    func guardUserCanPostInForum(_ user: UserCacheData, in forum: Forum, editingPost: ForumPost? = nil) throws
  • Ensures the given user has the required access to view forums and posts in the given category.

    Declaration

    Swift

    func guardUserCanAccessCategory(_ user: UserCacheData, category: Category) throws
  • Returns a dictionary mapping ForumIDs to ForumPosts, where each ForumPost is the last post made in its Forum by a user who isn’t blocked or muted. The code in the guard works by running a query for each Forum in the array; for 50 forums it takes ~82ms to resolve. The code in the bottom half of the fn uses SQLKit to make a more complicated query, returning answers for all forums in one result set. Takes ~9ms.

    The resulting dictionary may not contain all forum IDs from the input array–a forum with no posts or for which all posts are blocked/muted will have no ‘last post’.

    Declaration

    Swift

    func forumListGetLastPosts(_ forums: [Forum], on req: Request, user: UserCacheData) async throws -> [UUID:
    	ForumPost]
  • Builds an array of ForumListData from the given Forums. ForumListData does not return post content, but does return post counts. eventTime and timeZone only get filled in if there’s a Event join attached to the Forum, which should only happen for forums in Event categories.

    Declaration

    Swift

    func buildForumListData(
    	_ forums: [Forum],
    	on req: Request,
    	user: UserCacheData,
    	forceIsFavorite: Bool? = nil,
    	forceIsMuted: Bool? = nil
    ) async throws -> [ForumListData]
  • Builds a ForumData with the contents of the given Forum. Uses the requests’ “limit” and “start” query parameters to return only a subset of the forums’ posts (for forums where postCount > limit).

    Declaration

    Swift

    func buildForumData(_ forum: Forum, on req: Request, startPostID: Int? = nil) async throws -> ForumData
  • Declaration

    Swift

    func buildPostData(
    	_ posts: [ForumPost],
    	userID: UUID,
    	on req: Request,
    	mutewords: [String]? = nil,
    	assumeBookmarked: Bool? = nil,
    	assumeLikeType: LikeType? = nil,
    	matchHashtag: String? = nil
    ) async throws -> [PostData]
  • Declaration

    Swift

    func processForumMentions(post: ForumPost, editedText: String?, isCreate: Bool = false, on req: Request)
    	async throws
  • Declaration

    Swift

    func processThreadDeleteMentions(posts: [ForumPost], on req: Request) async throws