Files
go-fa-api/models.go
2026-05-25 22:27:18 +02:00

73 lines
2.0 KiB
Go

package fa
import "time"
// UserRef is a lightweight reference to a user that appears next to other
// entities (a submission's author, a comment's author, etc.). Use [Client.GetUser]
// to load the full [User].
type UserRef struct {
// Name is the URL-safe login name FA uses for routing. Always lowercase.
Name string
// DisplayName preserves the user's chosen capitalisation and styling.
DisplayName string
// AvatarURL points to the user's avatar image on the CDN.
AvatarURL string
}
// SubmissionRef is a thin reference to another submission, used for things
// like a user's featured submission preview where we only want a handful of
// fields without paying for a full submission fetch.
type SubmissionRef struct {
ID SubmissionID
Title string
ThumbURL string
}
// FolderRef identifies a gallery folder a submission appears in.
type FolderRef struct {
Name string
URL string
}
// SubmissionStats are the headline counts shown in the submission sidebar.
type SubmissionStats struct {
Views int
Favorites int
Comments int
}
// UserStats are the per-user counts shown on the profile page.
type UserStats struct {
Submissions int
Favorites int
Views int
Comments int
Journals int
Watchers int
Watching int
}
// UserContact is one row of the "Contact Information" table on a profile,
// e.g. {Site: "Twitter", Handle: "@someone", URL: "https://twitter.com/someone"}.
type UserContact struct {
Site string
Handle string
URL string
}
// Shout is one entry from the shouts/guestbook on a user's profile.
type Shout struct {
Author UserRef
PostedAt time.Time
BodyHTML string
}
// SiteBanner is the image rendered in the page header of a user's profile.
// FA always shows one: either the artist's own banner uploaded via
// /controls/profilebanner/, or if none is set FA's site-wide promo
// banner. IsCustom distinguishes the two.
type SiteBanner struct {
ImageURL string // absolute CDN URL of the banner image
IsCustom bool // true when the artist set their own banner
}