AlertController

struct AlertController : APIRouteCollection

The collection of alert endpoints, with routes for: - getting server time,, - getting public address-style announcements,, - getting notifications on alertwords, - getting notificaitons on incoming Fez messages.

Hashtags

  • getHashtagsHandler(_:) Asynchronous

    GET /api/v3/notification/hashtags

    Retrieve info on hashtags that have been used.

    Throws

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

    Declaration

    Swift

    func getHashtagsHandler(_ req: Request) async throws -> [String]

    Parameters

    searchString

    Partial Hashtag string. Must have at least 1 character.

    Return Value

Notifications

Announcements

  • createAnnouncement(_:) Asynchronous

    POST /api/v3/notification/announcement/create

    Create a new announcement. Requires TwitarrTeam access and above. When a new announcement is created the notification endpoints will start indicating the new announcement to all users.

    Declaration

    Swift

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

    Parameters

    requestBody

    Return Value

    HTTPStatus 201 on success.

  • getAnnouncements(_:) Asynchronous

    GET /api/v3/notification/announcements

    Returns all active announcements, sorted by creation time, by default.

    URL Query Parameters

    • ?inactives=true Also return expired and deleted announcements. TwitarrTeam and above only.

    The purpose of the inactives flag is to allow for finding an expired announcement and re-activating it by changing its expire time. Doing so does not re-alert users who have already read it.

    Declaration

    Swift

    func getAnnouncements(_ req: Request) async throws -> [AnnouncementData]

    Return Value

    Array of AnnouncementData

  • GET /api/v3/notification/announcement/ID

    Returns a single announcement, identified by its ID. TwitarrTeam and above only. Others should just use /api/v3/notification/announcements. Will return AnnouncementData for deleted announcements.

    Announcements shouldn’t be large, and there shouldn’t be many of them active at once (Less than 1KB each, if there’s more than 5 active at once people likely won’t read them). This endpoint really exists to support admins editing announcements.

    Throws

    403 error if the user doesn’t have TwitarrTeam or higher access. 404 if no announcement with the given ID is found.

    Declaration

    Swift

    func getSingleAnnouncement(_ req: Request) async throws -> AnnouncementData

    Parameters

    announcementID

    The announcement to find

    Return Value

    AnnouncementData

  • editAnnouncement(_:) Asynchronous

    POST /api/v3/notification/announcement/ID/edit

    Edits an existing announcement. Editing a deleted announcement will un-delete it. Editing an announcement does not change any user’s notification status for that announcement: if a user has seen the announcement already, editing it will not cause the user to be notified that they should read it again.

    Throws

    403 error if the user is not permitted to edit.

    Declaration

    Swift

    func editAnnouncement(_ req: Request) async throws -> AnnouncementData

    Parameters

    announcementID

    The announcement to edit. Must exist.

    requestBody

    Return Value

    The updated AnnouncementCreateData

  • deleteAnnouncement(_:) Asynchronous

    POST /api/v3/notification/announcement/ID/delete DELETE /api/v3/notification/announcement/ID

    Deletes an existing announcement. Editing a deleted announcement will un-delete it TwitarrTeam and above only.

    Throws

    403 error if the user is not permitted to delete.

    Declaration

    Swift

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

    Parameters

    announcementIDParam

    The announcement to delete.

    Return Value

    204 NoContent on success.

Daily Themes

  • getDailyThemes(_:) Asynchronous

    GET /api/v3/notification/dailythemes

    Returns information about all the daily themes currently registered.

    Throws

    403 error if the user is not permitted to delete.

    Declaration

    Swift

    func getDailyThemes(_ req: Request) async throws -> [DailyThemeData]

    Return Value

    An array of DailyThemeData on success.