PhotostreamController

struct PhotostreamController : APIRouteCollection
  • Required. Registers routes to the incoming router.

    Declaration

    Swift

    func registerRoutes(_ app: Application) throws
  • photostreamHandler(_:) Asynchronous

    GET /api/v3/photostream

    For regular users, returns the last 30 photos uploaded to the photostream, in descending order. Moderators can use the start and limit parameters to page through all the photos. For non-moderators, the pagination struct will always indicate 30 photos or fewer, on one page.

    I’m limitiing pagination to mods because Photostream is supposed to be a sort of snapshot of what’s going on on the boat right now. This may change in the future.

    URL Query Parameters:

    • ?start=INT - Moderators only. The index into the sorted list of photos to start returning results. 0 for most recent photo.
    • ?limit=INT - Moderators only. The max # of entries to return. Defaults to 30.

    Declaration

    Swift

    func photostreamHandler(_ req: Request) async throws -> PhotostreamListData

    Return Value

    PhotostreamListData, a paginated array of PhotostreamImageData

  • getPlacenames(_:) Asynchronous

    GET /api/v3/photostream/placenames

    Returns a list of currently-valid placenames that can be used to tag a photo. This list includes events currently happening as well as a few general ship locations. These values are valid to be returned to /api/v3/photostream/upload. Note that this means the result of this call is ephermal and will change as events end and new ones start. Similar to how the ‘now’ functionality works in Schedule, long-running ‘events’ are filtered out (e.g. “Cosplay Day”, running from 8:00 AM to mindnight).

    Declaration

    Swift

    func getPlacenames(_ req: Request) async throws -> PhotostreamLocationData

    Return Value

    PhotostreamLocationData contining currently-running events and general boat placenames.

  • POST /api/v3/photostream/upload

    Adds the given photo to the photostream. To be valid, either the eventID or the placename should be non-nil, and should equal a value recently returned from /api/v3/photostream/placenames.

    Declaration

    Swift

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

    Return Value

    200 OK if upload successful.

  • POST /api/v3/photostream/:photoID/report

    Create a Report regarding the specified StreamPhoto.

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

    Parameters

    requestBody

    Return Value

    201 Created on success.

Moderator

  • GET /api/v3/mod/photostream/:photo_id

    Moderator only. Returns a photo from the photostream, with associated data for moderation tasks.

    Declaration

    Swift

    func getPhotoModerationData(_ req: Request) async throws -> PhotostreamModerationData

    Return Value

    PhotostreamModerationData on success.

  • DELETE /api/v3/mod/photostream/:photo_id POST /api/v3/mod/photostream/:photo_id/delete

    Moderator only. Soft-deletes the given photo. The deleted phto may still be viewed by moderators, but will no longer be seen by normal users.

    Declaration

    Swift

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

    Return Value

    200 on success.

Utilities