arn

package module
v1.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 1, 2019 License: MIT Imports: 43 Imported by: 3

README

arn

Godoc Report Tests Coverage Sponsor

This library provides direct access to the Anime Notifier database. It is not an API client.

Style

Please take a look at the style guidelines if you'd like to make a pull request.

Sponsors

Cedric Fung Scott Rayapoullé Eduard Urbach
Cedric Fung Scott Rayapoullé Eduard Urbach

Want to see your own name here?

Documentation

Index

Constants

View Source
const (
	// AnimeImageLargeWidth is the minimum width in pixels of a large anime image.
	AnimeImageLargeWidth = 250

	// AnimeImageLargeHeight is the minimum height in pixels of a large anime image.
	AnimeImageLargeHeight = 350

	// AnimeImageMediumWidth is the minimum width in pixels of a medium anime image.
	AnimeImageMediumWidth = 142

	// AnimeImageMediumHeight is the minimum height in pixels of a medium anime image.
	AnimeImageMediumHeight = 200

	// AnimeImageSmallWidth is the minimum width in pixels of a small anime image.
	AnimeImageSmallWidth = 55

	// AnimeImageSmallHeight is the minimum height in pixels of a small anime image.
	AnimeImageSmallHeight = 78

	// AnimeImageWebPQuality is the WebP quality of anime images.
	AnimeImageWebPQuality = 70

	// AnimeImageJPEGQuality is the JPEG quality of anime images.
	AnimeImageJPEGQuality = 70

	// AnimeImageQualityBonusLowDPI ...
	AnimeImageQualityBonusLowDPI = 10

	// AnimeImageQualityBonusLarge ...
	AnimeImageQualityBonusLarge = 5

	// AnimeImageQualityBonusMedium ...
	AnimeImageQualityBonusMedium = 10

	// AnimeImageQualityBonusSmall ...
	AnimeImageQualityBonusSmall = 10
)
View Source
const (
	AnimeListStatusWatching  = "watching"
	AnimeListStatusCompleted = "completed"
	AnimeListStatusPlanned   = "planned"
	AnimeListStatusHold      = "hold"
	AnimeListStatusDropped   = "dropped"
)

AnimeListStatus values for anime list items

View Source
const (
	// CharacterImageLargeWidth is the minimum width in pixels of a large character image.
	// We subtract 6 pixels due to border removal which can remove up to 6 pixels.
	CharacterImageLargeWidth = 225 - 6

	// CharacterImageLargeHeight is the minimum height in pixels of a large character image.
	// We subtract 6 pixels due to border removal which can remove up to 6 pixels.
	CharacterImageLargeHeight = 350 - 6

	// CharacterImageMediumWidth is the minimum width in pixels of a medium character image.
	CharacterImageMediumWidth = 112

	// CharacterImageMediumHeight is the minimum height in pixels of a medium character image.
	CharacterImageMediumHeight = 112

	// CharacterImageSmallWidth is the minimum width in pixels of a small character image.
	CharacterImageSmallWidth = 56

	// CharacterImageSmallHeight is the minimum height in pixels of a small character image.
	CharacterImageSmallHeight = 56

	// CharacterImageWebPQuality is the WebP quality of character images.
	CharacterImageWebPQuality = 70

	// CharacterImageJPEGQuality is the JPEG quality of character images.
	CharacterImageJPEGQuality = 70

	// CharacterImageQualityBonusLowDPI ...
	CharacterImageQualityBonusLowDPI = 12

	// CharacterImageQualityBonusLarge ...
	CharacterImageQualityBonusLarge = 10

	// CharacterImageQualityBonusMedium ...
	CharacterImageQualityBonusMedium = 15

	// CharacterImageQualityBonusSmall ...
	CharacterImageQualityBonusSmall = 15
)
View Source
const (
	// GroupImageSmallWidth is the minimum width in pixels of a small group image.
	GroupImageSmallWidth = 70

	// GroupImageSmallHeight is the minimum height in pixels of a small group image.
	GroupImageSmallHeight = 70

	// GroupImageLargeWidth is the minimum width in pixels of a large group image.
	GroupImageLargeWidth = 280

	// GroupImageLargeHeight is the minimum height in pixels of a large group image.
	GroupImageLargeHeight = 280

	// GroupImageWebPQuality is the WebP quality of group images.
	GroupImageWebPQuality = 70

	// GroupImageJPEGQuality is the JPEG quality of group images.
	GroupImageJPEGQuality = 70

	// GroupImageQualityBonusLowDPI ...
	GroupImageQualityBonusLowDPI = 12

	// GroupImageQualityBonusLarge ...
	GroupImageQualityBonusLarge = 10

	// GroupImageQualityBonusSmall ...
	GroupImageQualityBonusSmall = 15
)
View Source
const (
	NotificationTypeTest          = "test"
	NotificationTypeAnimeEpisode  = "anime-episode"
	NotificationTypeAnimeFinished = "anime-finished"
	NotificationTypeForumReply    = "forum-reply"
	NotificationTypeFollow        = "follow"
	NotificationTypeLike          = "like"
	NotificationTypePurchase      = "purchase"
	NotificationTypePackageTest   = "package-test"
	NotificationTypeGroupJoin     = "group-join"
)

NotificationType values

View Source
const (
	// SortByAiringDate sorts your watching list by airing date.
	SortByAiringDate = "airing date"

	// SortByTitle sorts your watching list alphabetically.
	SortByTitle = "title"

	// SortByRating sorts your watching list by rating.
	SortByRating = "rating"
)
View Source
const (
	// TitleLanguageCanonical ...
	TitleLanguageCanonical = "canonical"

	// TitleLanguageRomaji ...
	TitleLanguageRomaji = "romaji"

	// TitleLanguageEnglish ...
	TitleLanguageEnglish = "english"

	// TitleLanguageJapanese ...
	TitleLanguageJapanese = "japanese"
)
View Source
const (
	// ShopItemRarityCommon ...
	ShopItemRarityCommon = "common"

	// ShopItemRaritySuperior ...
	ShopItemRaritySuperior = "superior"

	// ShopItemRarityRare ...
	ShopItemRarityRare = "rare"

	// ShopItemRarityUnique ...
	ShopItemRarityUnique = "unique"

	// ShopItemRarityLegendary ...
	ShopItemRarityLegendary = "legendary"
)
View Source
const (
	// AvatarSmallSize is the minimum size in pixels of an avatar.
	AvatarSmallSize = 100

	// AvatarMaxSize is the maximum size in pixels of an avatar.
	AvatarMaxSize = 560

	// AvatarWebPQuality is the WebP quality of avatars.
	AvatarWebPQuality = 80

	// AvatarJPEGQuality is the JPEG quality of avatars.
	AvatarJPEGQuality = 80
)
View Source
const (
	// CoverMaxWidth is the maximum size for covers.
	CoverMaxWidth = 1920

	// CoverMaxHeight is the maximum height for covers.
	CoverMaxHeight = 450

	// CoverSmallWidth is the width used for mobile phones.
	CoverSmallWidth = 640

	// CoverSmallHeight is the height used for mobile phones.
	CoverSmallHeight = 640

	// CoverWebPQuality is the WebP quality of cover images.
	CoverWebPQuality = AvatarWebPQuality

	// CoverJPEGQuality is the JPEG quality of cover images.
	CoverJPEGQuality = CoverWebPQuality
)
View Source
const AnimeDateFormat = validate.DateFormat

AnimeDateFormat describes the anime date format for the date conversion.

View Source
const AverageRating = 5.0

AverageRating is the center rating in the system. Note that the mathematically correct center would be a little higher, but we don't care about these slight offsets.

View Source
const BotUserID = "3wUBnfUkR"

BotUserID is the user ID of the anime notifier bot.

View Source
const DefaultInventorySlotCount = 24

DefaultInventorySlotCount tells you how many slots are available by default in an inventory.

View Source
const DefaultRating = 0.0

DefaultRating is the default rating value.

View Source
const EarthRadius = 6371

EarthRadius is the radius of the earth in kilometers.

View Source
const IgnoreAnimeDifferenceEditorScore = 2

IgnoreAnimeDifferenceEditorScore represents how many points you get for a diff ignore.

View Source
const MaxRating = 10.0

MaxRating is the maximum rating users can give.

View Source
const RatingCountThreshold = 4

RatingCountThreshold is the number of users threshold that, when passed, doesn't dampen the result.

Variables

View Source
var API = api.New("/api/", DB)

API ...

View Source
var AnimeSourceHumanReadable = map[string]string{}

AnimeSourceHumanReadable maps the anime source to a human readable version.

DB is the main database client.

View Source
var DataLists = map[string][]*Option{}

DataLists maps an ID to a list of keys and values. Used for selection lists in UIs.

View Source
var Genres []string

Genres ...

View Source
var JapaneseTokenizer = &client.Tokenizer{
	Endpoint: "http://127.0.0.1:6000/",
}

JapaneseTokenizer tokenizes a sentence via the HTTP API.

View Source
var Kitsu = Node.Namespace("kitsu").RegisterTypes(
	(*kitsu.Anime)(nil),
	(*kitsu.Mapping)(nil),
	(*kitsu.Character)(nil),
)

Kitsu is the client for the Kitsu database.

View Source
var MAL = Node.Namespace("mal").RegisterTypes(
	(*mal.Anime)(nil),
	(*mal.Character)(nil),
)

MAL is the client for the MyAnimeList database.

View Source
var (
	// MediaHost is the host we use to link image files.
	MediaHost = "media.notify.moe"
)
View Source
var Node = nano.New(nano.Configuration{
	Port: 5000,
})

Node represents the database node.

View Source
var Nyaa = new(nyaaAnimeProvider)

Nyaa anime provider (singleton)

View Source
var OriginalImageExtensions = []string{
	".jpg",
	".png",
	".gif",
}

OriginalImageExtensions includes all the formats that an avatar source could have sent to us.

View Source
var Root = os.Getenv("ARN_ROOT")

Root is the full path to the root directory of notify.moe repository.

Functions

func AddAction

func AddAction() *api.Action

AddAction returns an API action that adds a new item to the IDCollection.

func AgeInYears

func AgeInYears(birthDayString string) int

AgeInYears returns the person's age in years.

func AllKitsuAnime

func AllKitsuAnime() []*kitsu.Anime

AllKitsuAnime returns a slice of all Kitsu anime.

func AniListAnimeListStatus

func AniListAnimeListStatus(item *anilist.AnimeListItem) string

AniListAnimeListStatus returns the ARN version of the anime status.

func AnimeRatingStars

func AnimeRatingStars(rating float64) string

AnimeRatingStars displays the rating in Unicode stars.

func AuthorizeIfLoggedIn

func AuthorizeIfLoggedIn(ctx aero.Context) error

AuthorizeIfLoggedIn authorizes the given request if a user is logged in.

func AuthorizeIfLoggedInAndOwnData

func AuthorizeIfLoggedInAndOwnData(ctx aero.Context, userIDParameterName string) error

AuthorizeIfLoggedInAndOwnData authorizes the given request if a user is logged in and the user ID matches the ID in the request.

func BroadcastEvent

func BroadcastEvent(event *aero.Event)

BroadcastEvent sends the given event to the event streams of all users.

func Contains

func Contains(collection []string, t string) bool

Contains ...

func CreateDifferenceID

func CreateDifferenceID(animeID string, dataProvider string, malAnimeID string, typeName string) string

CreateDifferenceID ...

func DateTimeUTC

func DateTimeUTC() string

DateTimeUTC returns the current UTC time in RFC3339 format.

func DateToSeason

func DateToSeason(date time.Time) string

DateToSeason returns the season of the year for the given date.

func EpisodeCountMax

func EpisodeCountMax(episodes int) string

EpisodeCountMax is used for the max value of number input on episodes.

func EpisodesToString

func EpisodesToString(episodes int) string

EpisodesToString shows a question mark if the episode count is zero.

func FilterIDTags

func FilterIDTags(tags []string, idType string) []string

FilterIDTags returns all IDs of the given type in the tag list.

func FilterKitsuAnime

func FilterKitsuAnime(filter func(*kitsu.Anime) bool) []*kitsu.Anime

FilterKitsuAnime filters all Kitsu anime by a custom function.

func FilterKitsuMappings

func FilterKitsuMappings(filter func(*kitsu.Mapping) bool) []*kitsu.Mapping

FilterKitsuMappings filters all Kitsu mappings by a custom function.

func FindFileWithExtension

func FindFileWithExtension(baseName string, dir string, extensions []string) string

FindFileWithExtension tries to test different file extensions.

func FixAnimeDescription

func FixAnimeDescription(description string) string

FixAnimeDescription ...

func FixGender

func FixGender(gender string) string

FixGender ...

func GenerateID

func GenerateID(collection string) string

GenerateID generates a unique ID for a given collection.

func GetCompanyToAnimeMap

func GetCompanyToAnimeMap() map[string][]*Anime

GetCompanyToAnimeMap returns a map that contains company IDs as keys and their anime as values.

func GetForumIcon

func GetForumIcon(category string) string

GetForumIcon returns the unprefixed icon class name for the forum.

func GetGenreIDByName

func GetGenreIDByName(genre string) string

GetGenreIDByName ...

func GetGenreIcon

func GetGenreIcon(genre string) string

GetGenreIcon returns the unprefixed icon class name for the genre.

func GetObjectLink(typeName string, id string) string

GetObjectLink ...

func GetObjectTitle

func GetObjectTitle(typeName string, id string) string

GetObjectTitle ...

func HostName

func HostName() string

HostName returns the hostname.

func HumanReadableAnimeRelation

func HumanReadableAnimeRelation(relationName string) string

HumanReadableAnimeRelation ...

func IndexOf

func IndexOf(collection []string, t string) int

IndexOf ...

func IsAnimeDifferenceIgnored

func IsAnimeDifferenceIgnored(animeID string, dataProvider string, malAnimeID string, typeName string, hash uint64) bool

IsAnimeDifferenceIgnored tells you whether the given difference is being ignored.

func IsDevelopment

func IsDevelopment() bool

IsDevelopment returns true if the hostname does not contain "arn".

func IsIPv6

func IsIPv6(ip string) bool

IsIPv6 tells you whether the given address is IPv6 encoded.

func IsLocked

func IsLocked(obj interface{}) bool

IsLocked returns true if the given object is locked.

func IsProduction

func IsProduction() bool

IsProduction returns true if the hostname contains "arn".

func IsTest

func IsTest() bool

IsTest returns true if the program is currently running in the "go test" tool.

func JSON

func JSON(obj interface{}) string

JSON turns the object into a JSON string.

func JoinAction

func JoinAction() *api.Action

JoinAction returns an API action that lets the user join the object.

func KitsuStatusToARNStatus

func KitsuStatusToARNStatus(status string) string

KitsuStatusToARNStatus ...

func LeaveAction

func LeaveAction() *api.Action

LeaveAction returns an API action that unpublishes the object.

func LikeAction

func LikeAction() *api.Action

LikeAction ...

func ListItemStatusName

func ListItemStatusName(status string) string

ListItemStatusName ...

func LoadImage

func LoadImage(path string) (img image.Image, format string, err error)

LoadImage loads an image from the given path.

func LockAction

func LockAction() *api.Action

LockAction ...

func MyAnimeListStatusToARNStatus

func MyAnimeListStatusToARNStatus(status int) string

MyAnimeListStatusToARNStatus ...

func NewAnimeFromKitsuAnime

func NewAnimeFromKitsuAnime(kitsuAnime *kitsu.Anime) (*Anime, *AnimeCharacters, *AnimeRelations, *AnimeEpisodes)

NewAnimeFromKitsuAnime ...

func OverallRatingName

func OverallRatingName(episodes int) string

OverallRatingName returns Overall in general, but Hype when episodes watched is zero.

func PanicOnError

func PanicOnError(err error)

PanicOnError will panic if the error is not nil.

func PayPal

func PayPal() (*paypalsdk.Client, error)

PayPal returns the new PayPal SDK client.

func PublishAction

func PublishAction() *api.Action

PublishAction returns an API action that publishes the object.

func RGBToHSL

func RGBToHSL(r, g, b float64) (h, s, l float64)

RGBToHSL converts RGB to HSL (RGB input and HSL output are floats in the 0..1 range). Original source: https://github.com/gerow/go-color

func RegisterUser

func RegisterUser(user *User)

RegisterUser registers a new user in the database and sets up all the required references.

func RemoveAction

func RemoveAction() *api.Action

RemoveAction returns an API action that removes an item from the IDCollection.

func SetObjectProperties

func SetObjectProperties(rootObj interface{}, updates map[string]interface{}) error

SetObjectProperties updates the object with the given map[string]interface{}

func SortActivitiesLatestFirst

func SortActivitiesLatestFirst(entries []Activity)

SortActivitiesLatestFirst puts the latest entries on top.

func SortAnimeByPopularity

func SortAnimeByPopularity(animes []*Anime)

SortAnimeByPopularity sorts the given slice of anime by popularity.

func SortAnimeByQuality

func SortAnimeByQuality(animes []*Anime)

SortAnimeByQuality sorts the given slice of anime by quality.

func SortAnimeByQualityDetailed

func SortAnimeByQualityDetailed(animes []*Anime, filterStatus string)

SortAnimeByQualityDetailed sorts the given slice of anime by quality.

func SortCharactersByLikes

func SortCharactersByLikes(characters []*Character)

SortCharactersByLikes sorts the given slice of characters by the amount of likes.

func SortCompaniesPopularFirst

func SortCompaniesPopularFirst(companies []*Company)

SortCompaniesPopularFirst ...

func SortEditLogEntriesLatestFirst

func SortEditLogEntriesLatestFirst(entries []*EditLogEntry)

SortEditLogEntriesLatestFirst puts the latest entries on top.

func SortPersonsByLikes

func SortPersonsByLikes(persons []*Person)

SortPersonsByLikes sorts the given slice of persons by the amount of likes.

func SortPostablesLatestFirst

func SortPostablesLatestFirst(posts []Postable)

SortPostablesLatestFirst ...

func SortPostsLatestFirst

func SortPostsLatestFirst(posts []*Post)

SortPostsLatestFirst sorts the slice of posts.

func SortPostsLatestLast

func SortPostsLatestLast(posts []*Post)

SortPostsLatestLast sorts the slice of posts.

func SortQuotesLatestFirst

func SortQuotesLatestFirst(quotes []*Quote)

SortQuotesLatestFirst ...

func SortQuotesPopularFirst

func SortQuotesPopularFirst(quotes []*Quote)

SortQuotesPopularFirst ...

func SortSoundTracksLatestFirst

func SortSoundTracksLatestFirst(tracks []*SoundTrack)

SortSoundTracksLatestFirst ...

func SortSoundTracksPopularFirst

func SortSoundTracksPopularFirst(tracks []*SoundTrack)

SortSoundTracksPopularFirst ...

func SortThreads

func SortThreads(threads []*Thread)

SortThreads sorts a slice of threads for the forum view (stickies first).

func SortThreadsLatestFirst

func SortThreadsLatestFirst(threads []*Thread)

SortThreadsLatestFirst sorts a slice of threads by creation date.

func SortUsersFollowers

func SortUsersFollowers(users []*User)

SortUsersFollowers sorts a list of users by their number of followers.

func SortUsersLastSeenFirst

func SortUsersLastSeenFirst(users []*User)

SortUsersLastSeenFirst sorts a list of users by their last seen date.

func SortUsersLastSeenLast

func SortUsersLastSeenLast(users []*User)

SortUsersLastSeenLast sorts a list of users by their last seen date.

func StreamAMVs

func StreamAMVs() <-chan *AMV

StreamAMVs returns a stream of all AMVs.

func StreamActivities

func StreamActivities() <-chan Activity

StreamActivities returns a stream of all activities.

func StreamActivityCreates

func StreamActivityCreates() <-chan *ActivityCreate

StreamActivityCreates returns a stream of all ActivityCreate objects.

func StreamAnalytics

func StreamAnalytics() <-chan *Analytics

StreamAnalytics returns a stream of all analytics.

func StreamAnime

func StreamAnime() <-chan *Anime

StreamAnime returns a stream of all anime.

func StreamAnimeCharacters

func StreamAnimeCharacters() <-chan *AnimeCharacters

StreamAnimeCharacters returns a stream of all anime characters.

func StreamAnimeEpisodes

func StreamAnimeEpisodes() <-chan *AnimeEpisodes

StreamAnimeEpisodes returns a stream of all anime episodes.

func StreamAnimeLists

func StreamAnimeLists() <-chan *AnimeList

StreamAnimeLists returns a stream of all anime.

func StreamAnimeRelations

func StreamAnimeRelations() <-chan *AnimeRelations

StreamAnimeRelations returns a stream of all anime relations.

func StreamCharacters

func StreamCharacters() <-chan *Character

StreamCharacters returns a stream of all characters.

func StreamClientErrorReports

func StreamClientErrorReports() <-chan *ClientErrorReport

StreamClientErrorReports returns a stream of all characters.

func StreamCompanies

func StreamCompanies() <-chan *Company

StreamCompanies returns a stream of all companies.

func StreamEditLogEntries

func StreamEditLogEntries() <-chan *EditLogEntry

StreamEditLogEntries returns a stream of all log entries.

func StreamGroups

func StreamGroups() <-chan *Group

StreamGroups returns a stream of all groups.

func StreamIgnoreAnimeDifferences

func StreamIgnoreAnimeDifferences() <-chan *IgnoreAnimeDifference

StreamIgnoreAnimeDifferences returns a stream of all ignored differences.

func StreamKitsuAnime

func StreamKitsuAnime() <-chan *kitsu.Anime

StreamKitsuAnime returns a stream of all Kitsu anime.

func StreamKitsuMappings

func StreamKitsuMappings() <-chan *kitsu.Mapping

StreamKitsuMappings returns a stream of all Kitsu mappings.

func StreamNotifications

func StreamNotifications() <-chan *Notification

StreamNotifications returns a stream of all notifications.

func StreamPayPalPayments

func StreamPayPalPayments() <-chan *PayPalPayment

StreamPayPalPayments returns a stream of all paypal payments.

func StreamPersons

func StreamPersons() <-chan *Person

StreamPersons returns a stream of all persons.

func StreamPosts

func StreamPosts() <-chan *Post

StreamPosts returns a stream of all posts.

func StreamPurchases

func StreamPurchases() <-chan *Purchase

StreamPurchases returns a stream of all purchases.

func StreamQuotes

func StreamQuotes() <-chan *Quote

StreamQuotes returns a stream of all quotes.

func StreamShopItems

func StreamShopItems() <-chan *ShopItem

StreamShopItems returns a stream of all shop items.

func StreamSoundTracks

func StreamSoundTracks() <-chan *SoundTrack

StreamSoundTracks returns a stream of all soundtracks.

func StreamThreads

func StreamThreads() <-chan *Thread

StreamThreads ...

func StreamUserFollows

func StreamUserFollows() <-chan *UserFollows

StreamUserFollows returns a stream of all user follows.

func StreamUserNotifications

func StreamUserNotifications() <-chan *UserNotifications

StreamUserNotifications returns a stream of all user notifications.

func StreamUsers

func StreamUsers() <-chan *User

StreamUsers returns a stream of all users.

func UnlikeAction

func UnlikeAction() *api.Action

UnlikeAction ...

func UnlockAction

func UnlockAction() *api.Action

UnlockAction ...

func UnpublishAction

func UnpublishAction() *api.Action

UnpublishAction returns an API action that unpublishes the object.

func UserFollowerCountMap

func UserFollowerCountMap() map[string]int

UserFollowerCountMap returns a map of user ID keys and their corresping number of followers as the value.

Types

type AMV

type AMV struct {
	File           string     `json:"file" editable:"true" type:"upload" filetype:"video" endpoint:"/api/upload/amv/:id/file"`
	Title          AMVTitle   `json:"title" editable:"true"`
	MainAnimeID    string     `json:"mainAnimeId" editable:"true"`
	ExtraAnimeIDs  []string   `json:"extraAnimeIds" editable:"true"`
	VideoEditorIDs []string   `json:"videoEditorIds" editable:"true"`
	Links          []Link     `json:"links" editable:"true"`
	Tags           []string   `json:"tags" editable:"true"`
	Info           video.Info `json:"info"`
	// contains filtered or unexported fields
}

AMV is an anime music video.

func AllAMVs

func AllAMVs() []*AMV

AllAMVs returns a slice of all AMVs.

func FilterAMVs

func FilterAMVs(filter func(*AMV) bool) []*AMV

FilterAMVs filters all AMVs by a custom function.

func GetAMV

func GetAMV(id string) (*AMV, error)

GetAMV returns the AMV with the given ID.

func (*AMV) AddPost added in v1.1.25

func (obj *AMV) AddPost(postID string)

AddPost adds a post to the object.

func (*AMV) Authorize

func (amv *AMV) Authorize(ctx aero.Context, action string) error

Authorize returns an error if the given API POST request is not authorized.

func (*AMV) CountLikes added in v1.1.25

func (obj *AMV) CountLikes() int

CountLikes returns the number of likes the object has received.

func (*AMV) CountPosts added in v1.1.25

func (obj *AMV) CountPosts() int

CountPosts returns the number of posts written for this object.

func (*AMV) Create

func (amv *AMV) Create(ctx aero.Context) error

Create sets the data for a new AMV with data we received from the API request.

func (*AMV) Creator added in v1.1.25

func (obj *AMV) Creator() *User

Creator returns the user who created this object.

func (*AMV) CreatorID added in v1.1.25

func (obj *AMV) CreatorID() UserID

CreatorID returns the ID of the user who created this object.

func (*AMV) Delete

func (amv *AMV) Delete() error

Delete deletes the object from the database.

func (*AMV) DeleteInContext

func (amv *AMV) DeleteInContext(ctx aero.Context) error

DeleteInContext deletes the amv in the given context.

func (*AMV) Edit

func (amv *AMV) Edit(ctx aero.Context, key string, value reflect.Value, newValue reflect.Value) (consumed bool, err error)

Edit creates an edit log entry.

func (*AMV) Editor added in v1.1.25

func (obj *AMV) Editor() *User

Editor returns the user who last edited this object.

func (*AMV) ExtraAnime

func (amv *AMV) ExtraAnime() []*Anime

ExtraAnime returns main anime for the AMV, if available.

func (*AMV) GetCreated added in v1.1.25

func (obj *AMV) GetCreated() string

GetCreated returns the creation time of the object.

func (*AMV) GetCreatedBy added in v1.1.25

func (obj *AMV) GetCreatedBy() UserID

GetCreatedBy returns the ID of the user who created this object.

func (*AMV) GetCreatedTime added in v1.1.25

func (obj *AMV) GetCreatedTime() time.Time

GetCreatedTime returns the creation time of the object as a time struct.

func (*AMV) GetID added in v1.1.25

func (obj *AMV) GetID() string

GetID returns the ID.

func (*AMV) GetIsDraft added in v1.1.25

func (obj *AMV) GetIsDraft() bool

GetIsDraft tells you whether the object is a draft or not.

func (*AMV) Like added in v1.1.25

func (obj *AMV) Like(userID UserID)

Like makes the given user ID like the object.

func (*AMV) LikedBy added in v1.1.25

func (obj *AMV) LikedBy(userID UserID) bool

LikedBy checks to see if the user has liked the object.

func (amv *AMV) Link() string

Link returns the permalink for the AMV.

func (*AMV) MainAnime

func (amv *AMV) MainAnime() *Anime

MainAnime returns main anime for the AMV, if available.

func (*AMV) OnAppend

func (amv *AMV) OnAppend(ctx aero.Context, key string, index int, obj interface{})

OnAppend saves a log entry.

func (*AMV) OnLike

func (amv *AMV) OnLike(likedBy *User)

OnLike is called when the AMV receives a like.

func (*AMV) OnRemove

func (amv *AMV) OnRemove(ctx aero.Context, key string, index int, obj interface{})

OnRemove saves a log entry.

func (*AMV) Posts added in v1.1.25

func (obj *AMV) Posts() []*Post

Posts returns a slice of all posts.

func (*AMV) PostsRelevantFirst added in v1.1.25

func (obj *AMV) PostsRelevantFirst(count int) []*Post

PostsRelevantFirst returns a slice of all posts sorted by relevance.

func (*AMV) Publish

func (amv *AMV) Publish() error

Publish turns the draft into a published object.

func (*AMV) RefreshInfo

func (amv *AMV) RefreshInfo() error

RefreshInfo refreshes the information about the video file.

func (*AMV) RemovePost added in v1.1.25

func (obj *AMV) RemovePost(postID string) bool

RemovePost removes a post from the object.

func (*AMV) Save

func (amv *AMV) Save()

Save saves the amv object in the database.

func (*AMV) Self added in v1.1.17

func (amv *AMV) Self() Loggable

Self returns the object itself.

func (*AMV) SetIsDraft added in v1.1.25

func (obj *AMV) SetIsDraft(isDraft bool)

SetIsDraft sets the draft state for this object.

func (*AMV) SetVideoBytes

func (amv *AMV) SetVideoBytes(data []byte) error

SetVideoBytes sets the bytes for the video file.

func (*AMV) String

func (amv *AMV) String() string

String implements the default string serialization.

func (*AMV) TitleByUser

func (amv *AMV) TitleByUser(user *User) string

TitleByUser returns the preferred title for the given user.

func (*AMV) TypeName

func (amv *AMV) TypeName() string

TypeName returns the type name.

func (*AMV) Unlike added in v1.1.25

func (obj *AMV) Unlike(userID UserID)

Unlike makes the given user ID unlike the object.

func (*AMV) Unpublish

func (amv *AMV) Unpublish() error

Unpublish turns the object back into a draft.

func (*AMV) VideoEditors

func (amv *AMV) VideoEditors() []*User

VideoEditors returns a slice of all the users involved in creating the AMV.

type AMVTitle

type AMVTitle SoundTrackTitle

AMVTitle is the same as a soundtrack title.

func (*AMVTitle) ByUser

func (title *AMVTitle) ByUser(user *User) string

ByUser returns the preferred title for the given user.

func (*AMVTitle) String

func (title *AMVTitle) String() string

String is the default representation of the title.

type APIKeysData

type APIKeysData struct {
	Google struct {
		ID     string `json:"id"`
		Secret string `json:"secret"`
	} `json:"google"`

	Facebook struct {
		ID     string `json:"id"`
		Secret string `json:"secret"`
	} `json:"facebook"`

	Twitter struct {
		ID     string `json:"id"`
		Secret string `json:"secret"`
	} `json:"twitter"`

	Discord struct {
		ID     string `json:"id"`
		Secret string `json:"secret"`
		Token  string `json:"token"`
	} `json:"discord"`

	SoundCloud struct {
		ID     string `json:"id"`
		Secret string `json:"secret"`
	} `json:"soundcloud"`

	GoogleAPI struct {
		Key string `json:"key"`
	} `json:"googleAPI"`

	IPInfoDB struct {
		ID string `json:"id"`
	} `json:"ipInfoDB"`

	AniList struct {
		ID     string `json:"id"`
		Secret string `json:"secret"`
	} `json:"anilist"`

	Osu struct {
		Secret string `json:"secret"`
	} `json:"osu"`

	PayPal struct {
		ID     string `json:"id"`
		Secret string `json:"secret"`
	} `json:"paypal"`

	VAPID struct {
		Subject    string `json:"subject"`
		PublicKey  string `json:"publicKey"`
		PrivateKey string `json:"privateKey"`
	} `json:"vapid"`

	SMTP struct {
		Server   string `json:"server"`
		Address  string `json:"address"`
		Password string `json:"password"`
	} `json:"smtp"`

	S3 struct {
		ID     string `json:"id"`
		Secret string `json:"secret"`
	} `json:"s3"`
}

APIKeysData ...

var APIKeys APIKeysData

APIKeys are global API keys for several services

type Activity

type Activity interface {
	Creator() *User
	TypeName() string
	GetID() string
	GetCreated() string
	GetCreatedBy() UserID
	GetCreatedTime() time.Time
}

Activity is a user activity that appears in the follower's feeds.

func AllActivities

func AllActivities() []Activity

AllActivities returns a slice of all activities.

func FilterActivities

func FilterActivities(filter func(Activity) bool) []Activity

FilterActivities filters all Activities by a custom function.

type ActivityConsumeAnime

type ActivityConsumeAnime struct {
	AnimeID     string `json:"animeId"`
	FromEpisode int    `json:"fromEpisode"`
	ToEpisode   int    `json:"toEpisode"`
	// contains filtered or unexported fields
}

ActivityConsumeAnime is a user activity that consumes anime.

func FilterActivitiesConsumeAnime

func FilterActivitiesConsumeAnime(filter func(*ActivityConsumeAnime) bool) []*ActivityConsumeAnime

FilterActivitiesConsumeAnime filters all anime consumption activities by a custom function.

func NewActivityConsumeAnime

func NewActivityConsumeAnime(animeID string, fromEpisode int, toEpisode int, userID UserID) *ActivityConsumeAnime

NewActivityConsumeAnime creates a new activity.

func (*ActivityConsumeAnime) Anime

func (activity *ActivityConsumeAnime) Anime() *Anime

Anime returns the anime.

func (*ActivityConsumeAnime) Authorize

func (activity *ActivityConsumeAnime) Authorize(ctx aero.Context, action string) error

Authorize returns an error if the given API POST request is not authorized.

func (*ActivityConsumeAnime) CountLikes added in v1.1.25

func (obj *ActivityConsumeAnime) CountLikes() int

CountLikes returns the number of likes the object has received.

func (*ActivityConsumeAnime) Creator added in v1.1.25

func (obj *ActivityConsumeAnime) Creator() *User

Creator returns the user who created this object.

func (*ActivityConsumeAnime) CreatorID added in v1.1.25

func (obj *ActivityConsumeAnime) CreatorID() UserID

CreatorID returns the ID of the user who created this object.

func (*ActivityConsumeAnime) Delete

func (activity *ActivityConsumeAnime) Delete() error

Delete deletes the object from the database.

func (*ActivityConsumeAnime) DeleteInContext

func (activity *ActivityConsumeAnime) DeleteInContext(ctx aero.Context) error

DeleteInContext deletes the activity in the given context.

func (*ActivityConsumeAnime) GetCreated added in v1.1.25

func (obj *ActivityConsumeAnime) GetCreated() string

GetCreated returns the creation time of the object.

func (*ActivityConsumeAnime) GetCreatedBy added in v1.1.25

func (obj *ActivityConsumeAnime) GetCreatedBy() UserID

GetCreatedBy returns the ID of the user who created this object.

func (*ActivityConsumeAnime) GetCreatedTime added in v1.1.25

func (obj *ActivityConsumeAnime) GetCreatedTime() time.Time

GetCreatedTime returns the creation time of the object as a time struct.

func (*ActivityConsumeAnime) GetID added in v1.1.25

func (obj *ActivityConsumeAnime) GetID() string

GetID returns the ID.

func (*ActivityConsumeAnime) Like added in v1.1.25

func (obj *ActivityConsumeAnime) Like(userID UserID)

Like makes the given user ID like the object.

func (*ActivityConsumeAnime) LikedBy added in v1.1.25

func (obj *ActivityConsumeAnime) LikedBy(userID UserID) bool

LikedBy checks to see if the user has liked the object.

func (*ActivityConsumeAnime) Save

func (activity *ActivityConsumeAnime) Save()

Save saves the activity object in the database.

func (*ActivityConsumeAnime) Self added in v1.1.17

func (activity *ActivityConsumeAnime) Self() Loggable

Self returns the object itself.

func (*ActivityConsumeAnime) TypeName

func (activity *ActivityConsumeAnime) TypeName() string

TypeName returns the type name.

func (*ActivityConsumeAnime) Unlike added in v1.1.25

func (obj *ActivityConsumeAnime) Unlike(userID UserID)

Unlike makes the given user ID unlike the object.

type ActivityCreate

type ActivityCreate struct {
	ObjectType string `json:"objectType"`
	ObjectID   string `json:"objectId"`
	// contains filtered or unexported fields
}

ActivityCreate is a user activity that creates something.

func NewActivityCreate

func NewActivityCreate(objectType string, objectID string, userID UserID) *ActivityCreate

NewActivityCreate creates a new activity.

func (*ActivityCreate) Creator added in v1.1.25

func (obj *ActivityCreate) Creator() *User

Creator returns the user who created this object.

func (*ActivityCreate) CreatorID added in v1.1.25

func (obj *ActivityCreate) CreatorID() UserID

CreatorID returns the ID of the user who created this object.

func (*ActivityCreate) Delete

func (activity *ActivityCreate) Delete() error

Delete deletes the activity object from the database.

func (*ActivityCreate) GetCreated added in v1.1.25

func (obj *ActivityCreate) GetCreated() string

GetCreated returns the creation time of the object.

func (*ActivityCreate) GetCreatedBy added in v1.1.25

func (obj *ActivityCreate) GetCreatedBy() UserID

GetCreatedBy returns the ID of the user who created this object.

func (*ActivityCreate) GetCreatedTime added in v1.1.25

func (obj *ActivityCreate) GetCreatedTime() time.Time

GetCreatedTime returns the creation time of the object as a time struct.

func (*ActivityCreate) GetID added in v1.1.25

func (obj *ActivityCreate) GetID() string

GetID returns the ID.

func (*ActivityCreate) Object

func (activity *ActivityCreate) Object() Likeable

Object returns the object that was created.

func (*ActivityCreate) Postable

func (activity *ActivityCreate) Postable() Postable

Postable casts the object to the Postable interface.

func (*ActivityCreate) Save

func (activity *ActivityCreate) Save()

Save saves the activity object in the database.

func (*ActivityCreate) Self added in v1.1.17

func (activity *ActivityCreate) Self() Loggable

Self returns the object itself.

func (*ActivityCreate) TypeName

func (activity *ActivityCreate) TypeName() string

TypeName returns the type name.

type AiringDate

type AiringDate struct {
	Start string `json:"start" editable:"true"`
	End   string `json:"end" editable:"true"`
}

AiringDate represents the airing date of an anime.

func (*AiringDate) EndDateHuman

func (airing *AiringDate) EndDateHuman() string

EndDateHuman returns the end date of the anime in human readable form.

func (*AiringDate) EndTimeHuman

func (airing *AiringDate) EndTimeHuman() string

EndTimeHuman returns the end time of the anime in human readable form.

func (*AiringDate) StartDateHuman

func (airing *AiringDate) StartDateHuman() string

StartDateHuman returns the start date of the anime in human readable form.

func (*AiringDate) StartTimeHuman

func (airing *AiringDate) StartTimeHuman() string

StartTimeHuman returns the start time of the anime in human readable form.

type Analytics

type Analytics struct {
	UserID     string              `json:"userId"`
	General    GeneralAnalytics    `json:"general"`
	Screen     ScreenAnalytics     `json:"screen"`
	System     SystemAnalytics     `json:"system"`
	Connection ConnectionAnalytics `json:"connection"`
}

Analytics stores user-related statistics.

func AllAnalytics

func AllAnalytics() []*Analytics

AllAnalytics returns a slice of all analytics.

func GetAnalytics

func GetAnalytics(userID UserID) (*Analytics, error)

GetAnalytics returns the analytics for the given user ID.

func (*Analytics) Authorize

func (analytics *Analytics) Authorize(ctx aero.Context, action string) error

Authorize returns an error if the given API POST request is not authorized.

func (*Analytics) Create

func (analytics *Analytics) Create(ctx aero.Context) error

Create creates a new analytics object.

func (*Analytics) Save

func (analytics *Analytics) Save()

Save saves the analytics in the database.

type AnalyticsItem

type AnalyticsItem struct {
	Key   string
	Value float64
}

AnalyticsItem ...

type AniListAnimeFinder

type AniListAnimeFinder struct {
	// contains filtered or unexported fields
}

AniListAnimeFinder holds an internal map of ID to anime mappings and is therefore very efficient to use when trying to find anime by a given service and ID.

func NewAniListAnimeFinder

func NewAniListAnimeFinder() *AniListAnimeFinder

NewAniListAnimeFinder creates a new finder for Anilist anime.

func (*AniListAnimeFinder) GetAnime

func (finder *AniListAnimeFinder) GetAnime(id string, malID string) *Anime

GetAnime tries to find an AniList anime in our anime database.

type AniListMatch

type AniListMatch struct {
	AniListItem *anilist.AnimeListItem `json:"anilistItem"`
	ARNAnime    *Anime                 `json:"arnAnime"`
}

AniListMatch ...

func (*AniListMatch) JSON

func (match *AniListMatch) JSON() string

JSON ...

type Anime

type Anime struct {
	Type          string           `json:"type" editable:"true" datalist:"anime-types"`
	Title         *AnimeTitle      `json:"title" editable:"true"`
	Summary       string           `json:"summary" editable:"true" type:"textarea"`
	Status        string           `json:"status" editable:"true" datalist:"anime-status"`
	Genres        []string         `json:"genres" editable:"true"`
	StartDate     string           `json:"startDate" editable:"true"`
	EndDate       string           `json:"endDate" editable:"true"`
	EpisodeCount  int              `json:"episodeCount" editable:"true"`
	EpisodeLength int              `json:"episodeLength" editable:"true"`
	Source        string           `json:"source" editable:"true" datalist:"anime-sources"`
	Image         AnimeImage       `json:"image"`
	FirstChannel  string           `json:"firstChannel"`
	Rating        *AnimeRating     `json:"rating"`
	Popularity    *AnimePopularity `json:"popularity"`
	Trailers      []*ExternalMedia `json:"trailers" editable:"true"`

	// Company IDs
	StudioIDs   []string `json:"studios" editable:"true"`
	ProducerIDs []string `json:"producers" editable:"true"`
	LicensorIDs []string `json:"licensors" editable:"true"`

	// Links to external websites
	Links []*Link `json:"links" editable:"true"`
	// contains filtered or unexported fields
}

Anime represents an anime.

func AllAnime

func AllAnime() []*Anime

AllAnime returns a slice of all anime.

func FilterAnime

func FilterAnime(filter func(*Anime) bool) []*Anime

FilterAnime filters all anime by a custom function.

func GetAnime

func GetAnime(id string) (*Anime, error)

GetAnime gets the anime with the given ID.

func NewAnime

func NewAnime() *Anime

NewAnime creates a new anime.

func (*Anime) AddLicensor

func (anime *Anime) AddLicensor(companyID string)

AddLicensor adds the company ID to the licensor ID list if it doesn't exist already.

func (*Anime) AddPost added in v1.1.25

func (obj *Anime) AddPost(postID string)

AddPost adds a post to the object.

func (*Anime) AddProducer

func (anime *Anime) AddProducer(companyID string)

AddProducer adds the company ID to the producer ID list if it doesn't exist already.

func (*Anime) AddStudio

func (anime *Anime) AddStudio(companyID string)

AddStudio adds the company ID to the studio ID list if it doesn't exist already.

func (*Anime) Authorize

func (anime *Anime) Authorize(ctx aero.Context, action string) error

Authorize returns an error if the given API POST request is not authorized.

func (*Anime) AverageColor

func (anime *Anime) AverageColor() string

AverageColor returns the average color of the image.

func (*Anime) CalculatedStatus

func (anime *Anime) CalculatedStatus() string

CalculatedStatus returns the status of the anime inferred by the start and end date.

func (*Anime) Characters

func (anime *Anime) Characters() *AnimeCharacters

Characters ...

func (*Anime) CountLikes added in v1.1.25

func (obj *Anime) CountLikes() int

CountLikes returns the number of likes the object has received.

func (*Anime) CountPosts added in v1.1.25

func (obj *Anime) CountPosts() int

CountPosts returns the number of posts written for this object.

func (*Anime) Creator added in v1.1.25

func (obj *Anime) Creator() *User

Creator returns the user who created this object.

func (*Anime) CreatorID added in v1.1.25

func (obj *Anime) CreatorID() UserID

CreatorID returns the ID of the user who created this object.

func (*Anime) Delete

func (anime *Anime) Delete() error

Delete deletes the anime from the database.

func (*Anime) DeleteInContext

func (anime *Anime) DeleteInContext(ctx aero.Context) error

DeleteInContext deletes the anime in the given context.

func (*Anime) Edit

func (anime *Anime) Edit(ctx aero.Context, key string, value reflect.Value, newValue reflect.Value) (consumed bool, err error)

Edit creates an edit log entry.

func (*Anime) Editor added in v1.1.25

func (obj *Anime) Editor() *User

Editor returns the user who last edited this object.

func (*Anime) EndDateTime

func (anime *Anime) EndDateTime() time.Time

EndDateTime returns the end date as a time object.

func (*Anime) EpisodeByNumber

func (anime *Anime) EpisodeByNumber(number int) *AnimeEpisode

EpisodeByNumber returns the episode with the given number.

func (*Anime) EpisodeCountString

func (anime *Anime) EpisodeCountString() string

EpisodeCountString ...

func (*Anime) Episodes

func (anime *Anime) Episodes() *AnimeEpisodes

Episodes returns the anime episodes wrapper.

func (*Anime) GetCreated added in v1.1.25

func (obj *Anime) GetCreated() string

GetCreated returns the creation time of the object.

func (*Anime) GetCreatedBy added in v1.1.25

func (obj *Anime) GetCreatedBy() UserID

GetCreatedBy returns the ID of the user who created this object.

func (*Anime) GetCreatedTime added in v1.1.25

func (obj *Anime) GetCreatedTime() time.Time

GetCreatedTime returns the creation time of the object as a time struct.

func (*Anime) GetID added in v1.1.25

func (obj *Anime) GetID() string

GetID returns the ID.

func (*Anime) GetIsDraft added in v1.1.25

func (obj *Anime) GetIsDraft() bool

GetIsDraft tells you whether the object is a draft or not.

func (*Anime) GetMapping added in v1.1.25

func (obj *Anime) GetMapping(name string) string

GetMapping returns the external ID for the given service.

func (*Anime) HasImage

func (anime *Anime) HasImage() bool

HasImage returns whether the anime has an image or not.

func (anime *Anime) ImageLink(size string) string

ImageLink ...

func (*Anime) ImportKitsuMapping

func (anime *Anime) ImportKitsuMapping(mapping *kitsu.Mapping)

ImportKitsuMapping imports the given Kitsu mapping.

func (*Anime) Licensors

func (anime *Anime) Licensors() []*Company

Licensors returns the list of licensors for this anime.

func (*Anime) Like added in v1.1.25

func (obj *Anime) Like(userID UserID)

Like makes the given user ID like the object.

func (*Anime) LikedBy added in v1.1.25

func (obj *Anime) LikedBy(userID UserID) bool

LikedBy checks to see if the user has liked the object.

func (anime *Anime) Link() string

Link returns the URI to the anime page.

func (*Anime) OnAppend

func (anime *Anime) OnAppend(ctx aero.Context, key string, index int, obj interface{})

OnAppend saves a log entry.

func (*Anime) OnRemove

func (anime *Anime) OnRemove(ctx aero.Context, key string, index int, obj interface{})

OnRemove saves a log entry.

func (*Anime) Posts added in v1.1.25

func (obj *Anime) Posts() []*Post

Posts returns a slice of all posts.

func (*Anime) PostsRelevantFirst added in v1.1.25

func (obj *Anime) PostsRelevantFirst(count int) []*Post

PostsRelevantFirst returns a slice of all posts sorted by relevance.

func (*Anime) Prequels

func (anime *Anime) Prequels() []*Anime

Prequels returns the list of prequels for that anime.

func (*Anime) Producers

func (anime *Anime) Producers() []*Company

Producers returns the list of producers for this anime.

func (*Anime) RefreshAnimeCharacters

func (anime *Anime) RefreshAnimeCharacters() (*AnimeCharacters, error)

RefreshAnimeCharacters ...

func (*Anime) RefreshEpisodes

func (anime *Anime) RefreshEpisodes() error

RefreshEpisodes will refresh the episode data.

func (*Anime) Relations

func (anime *Anime) Relations() *AnimeRelations

Relations ...

func (*Anime) RemoveMapping added in v1.1.25

func (obj *Anime) RemoveMapping(name string) bool

RemoveMapping removes all mappings with the given service name and ID.

func (*Anime) RemovePost added in v1.1.25

func (obj *Anime) RemovePost(postID string) bool

RemovePost removes a post from the object.

func (*Anime) Save

func (anime *Anime) Save()

Save saves the anime in the database.

func (*Anime) Score

func (anime *Anime) Score() float64

Score returns the score used for the anime ranking.

func (*Anime) ScoreHumanReadable

func (anime *Anime) ScoreHumanReadable() string

ScoreHumanReadable returns the score used for the anime ranking in human readable format.

func (*Anime) Season

func (anime *Anime) Season() string

Season returns the season the anime started airing in.

func (*Anime) Self added in v1.1.17

func (anime *Anime) Self() Loggable

Self returns the object itself.

func (*Anime) SetImage

func (anime *Anime) SetImage(metaImage *imageserver.MetaImage) error

SetImage sets the anime image to the given MetaImage.

func (*Anime) SetImageBytes

func (anime *Anime) SetImageBytes(data []byte) error

SetImageBytes accepts a byte buffer that represents an image file and updates the anime image.

func (*Anime) SetIsDraft added in v1.1.25

func (obj *Anime) SetIsDraft(isDraft bool)

SetIsDraft sets the draft state for this object.

func (*Anime) SetMapping added in v1.1.25

func (obj *Anime) SetMapping(serviceName string, serviceID string)

SetMapping sets the ID of an external site to the obj.

func (*Anime) ShoboiEpisodes

func (anime *Anime) ShoboiEpisodes() ([]*AnimeEpisode, error)

ShoboiEpisodes returns a slice of episode info from cal.syoboi.jp.

func (*Anime) StartDateTime

func (anime *Anime) StartDateTime() time.Time

StartDateTime returns the start date as a time object.

func (*Anime) StatusHumanReadable

func (anime *Anime) StatusHumanReadable() string

StatusHumanReadable ...

func (*Anime) String

func (anime *Anime) String() string

String implements the default string serialization.

func (*Anime) Studios

func (anime *Anime) Studios() []*Company

Studios returns the list of studios for this anime.

func (*Anime) TitleByUser

func (anime *Anime) TitleByUser(user *User) string

TitleByUser returns the preferred title for the given user.

func (*Anime) TwistEpisodes

func (anime *Anime) TwistEpisodes() ([]*AnimeEpisode, error)

TwistEpisodes returns a slice of episode info from twist.moe.

func (*Anime) TypeHumanReadable

func (anime *Anime) TypeHumanReadable() string

TypeHumanReadable ...

func (*Anime) TypeName

func (anime *Anime) TypeName() string

TypeName returns the type name.

func (*Anime) Unlike added in v1.1.25

func (obj *Anime) Unlike(userID UserID)

Unlike makes the given user ID unlike the object.

func (*Anime) UpcomingEpisode

func (anime *Anime) UpcomingEpisode() *UpcomingEpisode

UpcomingEpisode ...

func (*Anime) UpcomingEpisodes

func (anime *Anime) UpcomingEpisodes() []*UpcomingEpisode

UpcomingEpisodes ...

func (*Anime) UsersWatchingOrPlanned

func (anime *Anime) UsersWatchingOrPlanned() []*User

UsersWatchingOrPlanned returns a list of users who are watching the anime right now.

type AnimeCharacter

type AnimeCharacter struct {
	CharacterID string `json:"characterId" editable:"true"`
	Role        string `json:"role" editable:"true" datalist:"anime-character-roles"`
}

AnimeCharacter ...

func (*AnimeCharacter) Character

func (char *AnimeCharacter) Character() *Character

Character ...

func (*AnimeCharacter) Create added in v1.1.16

func (character *AnimeCharacter) Create(ctx aero.Context) error

Create sets the data for new anime characters.

type AnimeCharacters

type AnimeCharacters struct {
	AnimeID string            `json:"animeId" mainID:"true"`
	Items   []*AnimeCharacter `json:"items" editable:"true"`

	sync.Mutex
}

AnimeCharacters is a list of characters for an anime.

func GetAnimeCharacters

func GetAnimeCharacters(animeID string) (*AnimeCharacters, error)

GetAnimeCharacters ...

func (*AnimeCharacters) Add

func (characters *AnimeCharacters) Add(animeCharacter *AnimeCharacter) error

Add adds an anime character to the list.

func (*AnimeCharacters) Anime

func (characters *AnimeCharacters) Anime() *Anime

Anime returns the anime the characters refer to.

func (*AnimeCharacters) Authorize

func (characters *AnimeCharacters) Authorize(ctx aero.Context, action string) error

Authorize returns an error if the given API POST request is not authorized.

func (*AnimeCharacters) Contains

func (characters *AnimeCharacters) Contains(characterID string) bool

Contains tells you whether the given character ID exists.

func (*AnimeCharacters) Delete

func (characters *AnimeCharacters) Delete() error

Delete deletes the character list from the database.

func (*AnimeCharacters) Edit

func (characters *AnimeCharacters) Edit(ctx aero.Context, key string, value reflect.Value, newValue reflect.Value) (consumed bool, err error)

Edit creates an edit log entry.

func (*AnimeCharacters) FindByMapping

func (characters *AnimeCharacters) FindByMapping(service string, serviceID string) *AnimeCharacter

FindByMapping finds an anime character by the given mapping.

func (*AnimeCharacters) First

func (characters *AnimeCharacters) First(count int) []*AnimeCharacter

First gives you the first "count" anime characters.

func (*AnimeCharacters) GetID

func (characters *AnimeCharacters) GetID() string

GetID returns the anime ID.

func (characters *AnimeCharacters) Link() string

Link returns the link for that object.

func (*AnimeCharacters) OnAppend

func (characters *AnimeCharacters) OnAppend(ctx aero.Context, key string, index int, obj interface{})

OnAppend saves a log entry.

func (*AnimeCharacters) OnRemove

func (characters *AnimeCharacters) OnRemove(ctx aero.Context, key string, index int, obj interface{})

OnRemove saves a log entry.

func (*AnimeCharacters) Save

func (characters *AnimeCharacters) Save()

Save saves the character in the database.

func (*AnimeCharacters) Self added in v1.1.17

func (characters *AnimeCharacters) Self() Loggable

Self returns the object itself.

func (*AnimeCharacters) String

func (characters *AnimeCharacters) String() string

String implements the default string serialization.

func (*AnimeCharacters) TypeName

func (characters *AnimeCharacters) TypeName() string

TypeName returns the type name.

type AnimeEpisode

type AnimeEpisode struct {
	Number     int               `json:"number" editable:"true"`
	Title      EpisodeTitle      `json:"title" editable:"true"`
	AiringDate AiringDate        `json:"airingDate" editable:"true"`
	Links      map[string]string `json:"links"`
}

AnimeEpisode ...

func NewAnimeEpisode

func NewAnimeEpisode() *AnimeEpisode

NewAnimeEpisode creates an empty anime episode.

func (*AnimeEpisode) Available

func (a *AnimeEpisode) Available() bool

Available tells you whether the episode is available (triggered when it has a link).

func (*AnimeEpisode) AvailableOn

func (a *AnimeEpisode) AvailableOn(serviceName string) bool

AvailableOn tells you whether the episode is available on a given service.

func (*AnimeEpisode) Merge

func (a *AnimeEpisode) Merge(b *AnimeEpisode)

Merge combines the data of both episodes to one.

type AnimeEpisodes

type AnimeEpisodes struct {
	AnimeID string          `json:"animeId" mainID:"true"`
	Items   []*AnimeEpisode `json:"items" editable:"true"`

	sync.Mutex
}

AnimeEpisodes is a list of episodes for an anime.

func GetAnimeEpisodes

func GetAnimeEpisodes(id string) (*AnimeEpisodes, error)

GetAnimeEpisodes ...

func (*AnimeEpisodes) Anime

func (episodes *AnimeEpisodes) Anime() *Anime

Anime returns the anime the episodes refer to.

func (*AnimeEpisodes) Authorize

func (episodes *AnimeEpisodes) Authorize(ctx aero.Context, action string) error

Authorize returns an error if the given API POST request is not authorized.

func (*AnimeEpisodes) AvailableCount

func (episodes *AnimeEpisodes) AvailableCount() int

AvailableCount counts the number of available episodes.

func (*AnimeEpisodes) Delete

func (episodes *AnimeEpisodes) Delete() error

Delete deletes the episode list from the database.

func (*AnimeEpisodes) Edit

func (episodes *AnimeEpisodes) Edit(ctx aero.Context, key string, value reflect.Value, newValue reflect.Value) (consumed bool, err error)

Edit creates an edit log entry.

func (*AnimeEpisodes) Find

func (episodes *AnimeEpisodes) Find(episodeNumber int) (*AnimeEpisode, int)

Find finds the given episode number.

func (*AnimeEpisodes) GetID

func (episodes *AnimeEpisodes) GetID() string

GetID returns the anime ID.

func (*AnimeEpisodes) Last

func (episodes *AnimeEpisodes) Last(count int) []*AnimeEpisode

Last returns the last n items.

func (episodes *AnimeEpisodes) Link() string

Link returns the link for that object.

func (*AnimeEpisodes) ListString

func (episodes *AnimeEpisodes) ListString() string

ListString returns a text representation of the anime episodes.

func (*AnimeEpisodes) Merge

func (episodes *AnimeEpisodes) Merge(b []*AnimeEpisode)

Merge combines the data of both episode slices to one.

func (*AnimeEpisodes) OnAppend

func (episodes *AnimeEpisodes) OnAppend(ctx aero.Context, key string, index int, obj interface{})

OnAppend saves a log entry.

func (*AnimeEpisodes) OnRemove

func (episodes *AnimeEpisodes) OnRemove(ctx aero.Context, key string, index int, obj interface{})

OnRemove saves a log entry.

func (*AnimeEpisodes) Save

func (episodes *AnimeEpisodes) Save()

Save saves the episodes in the database.

func (*AnimeEpisodes) Self added in v1.1.17

func (episodes *AnimeEpisodes) Self() Loggable

Self returns the object itself.

func (*AnimeEpisodes) Sort

func (episodes *AnimeEpisodes) Sort()

Sort sorts the episodes by episode number.

func (*AnimeEpisodes) String

func (episodes *AnimeEpisodes) String() string

String implements the default string serialization.

func (*AnimeEpisodes) TypeName

func (episodes *AnimeEpisodes) TypeName() string

TypeName returns the type name.

type AnimeFinder

type AnimeFinder struct {
	// contains filtered or unexported fields
}

AnimeFinder holds an internal map of ID to anime mappings and is therefore very efficient to use when trying to find anime by a given service and ID.

func NewAnimeFinder

func NewAnimeFinder(mappingName string) *AnimeFinder

NewAnimeFinder creates a new finder for external anime.

func (*AnimeFinder) GetAnime

func (finder *AnimeFinder) GetAnime(id string) *Anime

GetAnime tries to find an external anime in our anime database.

type AnimeImage

type AnimeImage struct {
	Extension    string   `json:"extension"`
	Width        int      `json:"width"`
	Height       int      `json:"height"`
	AverageColor HSLColor `json:"averageColor"`
	LastModified int64    `json:"lastModified"`
}

AnimeImage ...

type AnimeList

type AnimeList struct {
	UserID UserID           `json:"userId"`
	Items  []*AnimeListItem `json:"items"`

	sync.Mutex
}

AnimeList is a list of anime list items.

func AllAnimeLists

func AllAnimeLists() ([]*AnimeList, error)

AllAnimeLists returns a slice of all anime.

func GetAnimeList

func GetAnimeList(userID UserID) (*AnimeList, error)

GetAnimeList ...

func (*AnimeList) Add

func (list *AnimeList) Add(animeID string) error

Add adds an anime to the list if it hasn't been added yet.

func (*AnimeList) Authorize

func (list *AnimeList) Authorize(ctx aero.Context, action string) error

Authorize returns an error if the given API request is not authorized.

func (*AnimeList) Contains

func (list *AnimeList) Contains(animeID string) bool

Contains checks if the list contains the anime ID already.

func (*AnimeList) FilterStatus

func (list *AnimeList) FilterStatus(status string) *AnimeList

FilterStatus ...

func (*AnimeList) Find

func (list *AnimeList) Find(animeID string) *AnimeListItem

Find returns the list item with the specified anime ID, if available.

func (*AnimeList) Genres

func (list *AnimeList) Genres() map[string][]*AnimeListItem

Genres returns a map of genre names mapped to the list items that belong to that genre.

func (*AnimeList) GetID added in v1.1.17

func (list *AnimeList) GetID() string

GetID returns the anime ID.

func (*AnimeList) HasItemsWithStatus

func (list *AnimeList) HasItemsWithStatus(status string) bool

HasItemsWithStatus checks if the list contains an anime with the given status.

func (*AnimeList) Import

func (list *AnimeList) Import(item *AnimeListItem)

Import adds an anime to the list if it hasn't been added yet and if it did exist it will update episode, rating and notes.

func (*AnimeList) NormalizeRatings

func (list *AnimeList) NormalizeRatings()

NormalizeRatings normalizes all ratings so that they are perfectly stretched among the full scale.

func (*AnimeList) Remove

func (list *AnimeList) Remove(animeID string) bool

Remove removes the anime ID from the list.

func (*AnimeList) RemoveDuplicates

func (list *AnimeList) RemoveDuplicates()

RemoveDuplicates removes duplicate entries.

func (*AnimeList) Save

func (list *AnimeList) Save()

Save saves the anime list in the database.

func (*AnimeList) Self added in v1.1.17

func (list *AnimeList) Self() Loggable

Self returns the object itself.

func (*AnimeList) Sort

func (list *AnimeList) Sort()

Sort ...

func (*AnimeList) SortByRating

func (list *AnimeList) SortByRating()

SortByRating sorts the anime list by overall rating.

func (*AnimeList) SplitByStatus

func (list *AnimeList) SplitByStatus() map[string]*AnimeList

SplitByStatus splits the anime list into multiple ones by status.

func (*AnimeList) Top

func (list *AnimeList) Top(count int) []*AnimeListItem

Top returns the top entries.

func (*AnimeList) TopGenres

func (list *AnimeList) TopGenres(count int) []string

TopGenres returns the most liked genres for the user's anime list.

func (*AnimeList) TypeName

func (list *AnimeList) TypeName() string

TypeName returns the type name.

func (*AnimeList) User

func (list *AnimeList) User() *User

User returns the user this anime list belongs to.

func (*AnimeList) Watching

func (list *AnimeList) Watching() *AnimeList

Watching ...

func (*AnimeList) WithoutPrivateItems

func (list *AnimeList) WithoutPrivateItems() *AnimeList

WithoutPrivateItems returns a new anime list with the private items removed.

type AnimeListItem

type AnimeListItem struct {
	AnimeID      string              `json:"animeId"`
	Status       string              `json:"status" editable:"true"`
	Episodes     int                 `json:"episodes" editable:"true"`
	Rating       AnimeListItemRating `json:"rating"`
	Notes        string              `json:"notes" editable:"true"`
	RewatchCount int                 `json:"rewatchCount" editable:"true"`
	Private      bool                `json:"private" editable:"true"`
	Created      string              `json:"created"`
	Edited       string              `json:"edited"`
}

AnimeListItem ...

func (*AnimeListItem) AfterEdit

func (item *AnimeListItem) AfterEdit(ctx aero.Context) error

AfterEdit is called after the item is edited.

func (*AnimeListItem) Anime

func (item *AnimeListItem) Anime() *Anime

Anime fetches the associated anime data.

func (*AnimeListItem) Edit

func (item *AnimeListItem) Edit(ctx aero.Context, key string, value reflect.Value, newValue reflect.Value) (bool, error)

Edit ...

func (item *AnimeListItem) Link(userNick string) string

Link returns the URI for the given item.

func (*AnimeListItem) OnEpisodesChange

func (item *AnimeListItem) OnEpisodesChange()

OnEpisodesChange is called when the watched episode count changes.

func (*AnimeListItem) OnStatusChange

func (item *AnimeListItem) OnStatusChange()

OnStatusChange is called when the status changes.

func (*AnimeListItem) StatusHumanReadable

func (item *AnimeListItem) StatusHumanReadable() string

StatusHumanReadable returns the human readable representation of the status.

type AnimeListItemRating

type AnimeListItemRating struct {
	Overall    float64 `json:"overall" editable:"true"`
	Story      float64 `json:"story" editable:"true"`
	Visuals    float64 `json:"visuals" editable:"true"`
	Soundtrack float64 `json:"soundtrack" editable:"true"`
}

AnimeListItemRating ...

func (*AnimeListItemRating) Clamp

func (rating *AnimeListItemRating) Clamp()

Clamp ...

func (*AnimeListItemRating) IsNotRated

func (rating *AnimeListItemRating) IsNotRated() bool

IsNotRated tells you whether all ratings are zero.

func (*AnimeListItemRating) Reset

func (rating *AnimeListItemRating) Reset()

Reset sets all values to the default anime average rating.

type AnimePopularity

type AnimePopularity struct {
	Watching  int `json:"watching"`
	Completed int `json:"completed"`
	Planned   int `json:"planned"`
	Hold      int `json:"hold"`
	Dropped   int `json:"dropped"`
}

AnimePopularity shows how many users have that anime in a certain list.

func (*AnimePopularity) Total

func (p *AnimePopularity) Total() int

Total returns the total number of users that added this anime to their collection.

type AnimeRating

type AnimeRating struct {
	AnimeListItemRating

	// The amount of people who rated
	Count AnimeRatingCount `json:"count"`
}

AnimeRating ...

type AnimeRatingCount

type AnimeRatingCount struct {
	Overall    int `json:"overall"`
	Story      int `json:"story"`
	Visuals    int `json:"visuals"`
	Soundtrack int `json:"soundtrack"`
}

AnimeRatingCount ...

type AnimeRelation

type AnimeRelation struct {
	AnimeID string `json:"animeId" editable:"true"`
	Type    string `json:"type" editable:"true" datalist:"anime-relation-types"`
}

AnimeRelation ...

func (*AnimeRelation) Anime

func (relation *AnimeRelation) Anime() *Anime

Anime ...

func (*AnimeRelation) HumanReadableType

func (relation *AnimeRelation) HumanReadableType() string

HumanReadableType ...

type AnimeRelations

type AnimeRelations struct {
	AnimeID string           `json:"animeId" mainID:"true"`
	Items   []*AnimeRelation `json:"items" editable:"true"`

	sync.Mutex
}

AnimeRelations is a list of relations for an anime.

func GetAnimeRelations

func GetAnimeRelations(animeID string) (*AnimeRelations, error)

GetAnimeRelations ...

func (*AnimeRelations) Anime

func (relations *AnimeRelations) Anime() *Anime

Anime returns the anime the relations list refers to.

func (*AnimeRelations) Authorize

func (relations *AnimeRelations) Authorize(ctx aero.Context, action string) error

Authorize returns an error if the given API POST request is not authorized.

func (*AnimeRelations) Delete

func (relations *AnimeRelations) Delete() error

Delete deletes the relation list from the database.

func (*AnimeRelations) Edit

func (relations *AnimeRelations) Edit(ctx aero.Context, key string, value reflect.Value, newValue reflect.Value) (consumed bool, err error)

Edit creates an edit log entry.

func (*AnimeRelations) Find

func (relations *AnimeRelations) Find(animeID string) *AnimeRelation

Find returns the relation with the specified anime ID, if available.

func (*AnimeRelations) GetID

func (relations *AnimeRelations) GetID() string

GetID returns the anime ID.

func (relations *AnimeRelations) Link() string

Link returns the link for that object.

func (*AnimeRelations) OnAppend

func (relations *AnimeRelations) OnAppend(ctx aero.Context, key string, index int, obj interface{})

OnAppend saves a log entry.

func (*AnimeRelations) OnRemove

func (relations *AnimeRelations) OnRemove(ctx aero.Context, key string, index int, obj interface{})

OnRemove saves a log entry.

func (*AnimeRelations) Remove

func (relations *AnimeRelations) Remove(animeID string) bool

Remove removes the anime ID from the relations.

func (*AnimeRelations) Save

func (relations *AnimeRelations) Save()

Save saves the anime relations object in the database.

func (*AnimeRelations) Self added in v1.1.17

func (relations *AnimeRelations) Self() Loggable

Self returns the object itself.

func (*AnimeRelations) SortByStartDate

func (relations *AnimeRelations) SortByStartDate()

SortByStartDate ...

func (*AnimeRelations) String

func (relations *AnimeRelations) String() string

String implements the default string serialization.

func (*AnimeRelations) TypeName

func (relations *AnimeRelations) TypeName() string

TypeName returns the type name.

type AnimeTitle

type AnimeTitle struct {
	Canonical string   `json:"canonical" editable:"true"`
	Romaji    string   `json:"romaji" editable:"true"`
	English   string   `json:"english" editable:"true"`
	Japanese  string   `json:"japanese" editable:"true"`
	Hiragana  string   `json:"hiragana" editable:"true"`
	Synonyms  []string `json:"synonyms" editable:"true"`
}

AnimeTitle ...

func (*AnimeTitle) ByUser

func (title *AnimeTitle) ByUser(user *User) string

ByUser returns the preferred title for the given user.

type AvatarSettings

type AvatarSettings struct {
	Source    string `json:"source" editable:"true"`
	SourceURL string `json:"sourceUrl" editable:"true"`
}

AvatarSettings ...

type CSSPosition

type CSSPosition struct {
	X string `json:"x"`
	Y string `json:"y"`
}

CSSPosition ...

type CalendarSettings added in v1.1.5

type CalendarSettings struct {
	ShowAddedAnimeOnly bool `json:"showAddedAnimeOnly" editable:"true"`
}

CalendarSettings ...

type Character

type Character struct {
	Name        CharacterName         `json:"name" editable:"true"`
	Image       CharacterImage        `json:"image"`
	MainQuoteID string                `json:"mainQuoteId" editable:"true"`
	Description string                `json:"description" editable:"true" type:"textarea"`
	Spoilers    []Spoiler             `json:"spoilers" editable:"true"`
	Attributes  []*CharacterAttribute `json:"attributes" editable:"true"`
	// contains filtered or unexported fields
}

Character represents an anime or manga character.

func AllCharacters

func AllCharacters() []*Character

AllCharacters returns a slice of all characters.

func FilterCharacters

func FilterCharacters(filter func(*Character) bool) []*Character

FilterCharacters filters all characters by a custom function.

func GetCharacter

func GetCharacter(id string) (*Character, error)

GetCharacter ...

func NewCharacter

func NewCharacter() *Character

NewCharacter creates a new character.

func (*Character) AddPost added in v1.1.25

func (obj *Character) AddPost(postID string)

AddPost adds a post to the object.

func (*Character) Anime

func (character *Character) Anime() []*Anime

Anime returns a list of all anime the character appears in.

func (*Character) Authorize

func (character *Character) Authorize(ctx aero.Context, action string) error

Authorize returns an error if the given API request is not authorized.

func (*Character) AverageColor

func (character *Character) AverageColor() string

AverageColor returns the average color of the image.

func (*Character) CountLikes added in v1.1.25

func (obj *Character) CountLikes() int

CountLikes returns the number of likes the object has received.

func (*Character) CountPosts added in v1.1.25

func (obj *Character) CountPosts() int

CountPosts returns the number of posts written for this object.

func (*Character) Create

func (character *Character) Create(ctx aero.Context) error

Create sets the data for a new character with data we received from the API request.

func (*Character) Creator added in v1.1.25

func (obj *Character) Creator() *User

Creator returns the user who created this object.

func (*Character) CreatorID added in v1.1.25

func (obj *Character) CreatorID() UserID

CreatorID returns the ID of the user who created this object.

func (*Character) Delete

func (character *Character) Delete() error

Delete deletes the object from the database.

func (*Character) DeleteImages

func (character *Character) DeleteImages()

DeleteImages deletes all images for the character.

func (*Character) DeleteInContext

func (character *Character) DeleteInContext(ctx aero.Context) error

DeleteInContext deletes the character in the given context.

func (*Character) DownloadImage

func (character *Character) DownloadImage(url string) error

DownloadImage ...

func (*Character) Edit

func (character *Character) Edit(ctx aero.Context, key string, value reflect.Value, newValue reflect.Value) (consumed bool, err error)

Edit creates an edit log entry.

func (*Character) Editor added in v1.1.25

func (obj *Character) Editor() *User

Editor returns the user who last edited this object.

func (*Character) GetCreated added in v1.1.25

func (obj *Character) GetCreated() string

GetCreated returns the creation time of the object.

func (*Character) GetCreatedBy added in v1.1.25

func (obj *Character) GetCreatedBy() UserID

GetCreatedBy returns the ID of the user who created this object.

func (*Character) GetCreatedTime added in v1.1.25

func (obj *Character) GetCreatedTime() time.Time

GetCreatedTime returns the creation time of the object as a time struct.

func (*Character) GetID added in v1.1.25

func (obj *Character) GetID() string

GetID returns the ID.

func (*Character) GetIsDraft added in v1.1.25

func (obj *Character) GetIsDraft() bool

GetIsDraft tells you whether the object is a draft or not.

func (*Character) GetMapping added in v1.1.25

func (obj *Character) GetMapping(name string) string

GetMapping returns the external ID for the given service.

func (*Character) HasImage

func (character *Character) HasImage() bool

HasImage returns true if the character has an image.

func (character *Character) ImageLink(size string) string

ImageLink ...

func (*Character) Like added in v1.1.25

func (obj *Character) Like(userID UserID)

Like makes the given user ID like the object.

func (*Character) LikedBy added in v1.1.25

func (obj *Character) LikedBy(userID UserID) bool

LikedBy checks to see if the user has liked the object.

func (character *Character) Link() string

Link ...

func (*Character) MainQuote

func (character *Character) MainQuote() *Quote

MainQuote ...

func (*Character) Merge

func (character *Character) Merge(target *Character)

Merge deletes the character and moves all existing references to the new character.

func (*Character) OnAppend

func (character *Character) OnAppend(ctx aero.Context, key string, index int, obj interface{})

OnAppend saves a log entry.

func (*Character) OnRemove

func (character *Character) OnRemove(ctx aero.Context, key string, index int, obj interface{})

OnRemove saves a log entry.

func (*Character) Posts added in v1.1.25

func (obj *Character) Posts() []*Post

Posts returns a slice of all posts.

func (*Character) PostsRelevantFirst added in v1.1.25

func (obj *Character) PostsRelevantFirst(count int) []*Post

PostsRelevantFirst returns a slice of all posts sorted by relevance.

func (*Character) Publish

func (character *Character) Publish() error

Publish publishes the character draft.

func (*Character) Quotes

func (character *Character) Quotes() []*Quote

Quotes returns the list of quotes for this character.

func (*Character) RemoveMapping added in v1.1.25

func (obj *Character) RemoveMapping(name string) bool

RemoveMapping removes all mappings with the given service name and ID.

func (*Character) RemovePost added in v1.1.25

func (obj *Character) RemovePost(postID string) bool

RemovePost removes a post from the object.

func (*Character) Save

func (character *Character) Save()

Save saves the character in the database.

func (*Character) Self added in v1.1.17

func (character *Character) Self() Loggable

Self returns the object itself.

func (*Character) SetImage

func (character *Character) SetImage(metaImage *imageserver.MetaImage) error

SetImage sets the character image to the given MetaImage.

func (*Character) SetImageBytes

func (character *Character) SetImageBytes(data []byte) error

SetImageBytes accepts a byte buffer that represents an image file and updates the character image.

func (*Character) SetIsDraft added in v1.1.25

func (obj *Character) SetIsDraft(isDraft bool)

SetIsDraft sets the draft state for this object.

func (*Character) SetMapping added in v1.1.25

func (obj *Character) SetMapping(serviceName string, serviceID string)

SetMapping sets the ID of an external site to the obj.

func (*Character) String

func (character *Character) String() string

String returns the canonical name of the character.

func (*Character) TitleByUser

func (character *Character) TitleByUser(user *User) string

TitleByUser returns the preferred title for the given user.

func (*Character) TypeName

func (character *Character) TypeName() string

TypeName returns the type name.

func (*Character) Unlike added in v1.1.25

func (obj *Character) Unlike(userID UserID)

Unlike makes the given user ID unlike the object.

func (*Character) Unpublish

func (character *Character) Unpublish() error

Unpublish turns the character into a draft.

type CharacterAttribute

type CharacterAttribute struct {
	Name  string `json:"name" editable:"true"`
	Value string `json:"value" editable:"true"`
}

CharacterAttribute describes one attribute of a character, e.g. height or age.

type CharacterFinder

type CharacterFinder struct {
	// contains filtered or unexported fields
}

CharacterFinder holds an internal map of ID to anime mappings and is therefore very efficient to use when trying to find anime by a given service and ID.

func NewCharacterFinder

func NewCharacterFinder(mappingName string) *CharacterFinder

NewCharacterFinder creates a new finder for external characters.

func (*CharacterFinder) Add

func (finder *CharacterFinder) Add(character *Character)

Add adds a character to the search pool.

func (*CharacterFinder) GetCharacter

func (finder *CharacterFinder) GetCharacter(id string) *Character

GetCharacter tries to find an external anime in our anime database.

type CharacterImage

type CharacterImage AnimeImage

CharacterImage ...

type CharacterName

type CharacterName struct {
	Canonical string   `json:"canonical" editable:"true"`
	English   string   `json:"english" editable:"true"`
	Japanese  string   `json:"japanese" editable:"true"`
	Synonyms  []string `json:"synonyms" editable:"true"`
}

CharacterName ...

func (*CharacterName) ByUser

func (name *CharacterName) ByUser(user *User) string

ByUser returns the preferred name for the given user.

type ClientErrorReport

type ClientErrorReport struct {
	ID           string `json:"id"`
	Message      string `json:"message"`
	Stack        string `json:"stack"`
	FileName     string `json:"fileName"`
	LineNumber   int    `json:"lineNumber"`
	ColumnNumber int    `json:"columnNumber"`
	// contains filtered or unexported fields
}

ClientErrorReport saves JavaScript errors that happen in web clients like browsers.

func AllClientErrorReports

func AllClientErrorReports() []*ClientErrorReport

AllClientErrorReports returns a slice of all characters.

func (*ClientErrorReport) Authorize

func (report *ClientErrorReport) Authorize(ctx aero.Context, action string) error

Authorize returns an error if the given API request is not authorized.

func (*ClientErrorReport) Create

func (report *ClientErrorReport) Create(ctx aero.Context) error

Create sets the data for a new report with data we received from the API request.

func (*ClientErrorReport) Creator added in v1.1.25

func (obj *ClientErrorReport) Creator() *User

Creator returns the user who created this object.

func (*ClientErrorReport) CreatorID added in v1.1.25

func (obj *ClientErrorReport) CreatorID() UserID

CreatorID returns the ID of the user who created this object.

func (*ClientErrorReport) GetCreated added in v1.1.25

func (obj *ClientErrorReport) GetCreated() string

GetCreated returns the creation time of the object.

func (*ClientErrorReport) GetCreatedBy added in v1.1.25

func (obj *ClientErrorReport) GetCreatedBy() UserID

GetCreatedBy returns the ID of the user who created this object.

func (*ClientErrorReport) GetCreatedTime added in v1.1.25

func (obj *ClientErrorReport) GetCreatedTime() time.Time

GetCreatedTime returns the creation time of the object as a time struct.

func (*ClientErrorReport) Save

func (report *ClientErrorReport) Save()

Save saves the client error report in the database.

type Company

type Company struct {
	Name        CompanyName `json:"name" editable:"true"`
	Description string      `json:"description" editable:"true" type:"textarea"`
	Email       string      `json:"email" editable:"true"`
	Links       []*Link     `json:"links" editable:"true"`

	// Other editable fields
	Location *Location `json:"location" editable:"true"`
	Tags     []string  `json:"tags" editable:"true"`
	// contains filtered or unexported fields
}

Company represents an anime studio, producer or licensor.

func AllCompanies

func AllCompanies() []*Company

AllCompanies returns a slice of all companies.

func FilterCompanies

func FilterCompanies(filter func(*Company) bool) []*Company

FilterCompanies filters all companies by a custom function.

func GetCompany

func GetCompany(id string) (*Company, error)

GetCompany returns a single company.

func NewCompany

func NewCompany() *Company

NewCompany creates a new company.

func (*Company) Anime

func (company *Company) Anime() (studioAnime []*Anime, producedAnime []*Anime, licensedAnime []*Anime)

Anime returns the anime connected with this company.

func (*Company) Authorize

func (company *Company) Authorize(ctx aero.Context, action string) error

Authorize returns an error if the given API request is not authorized.

func (*Company) CountLikes added in v1.1.25

func (obj *Company) CountLikes() int

CountLikes returns the number of likes the object has received.

func (*Company) Create

func (company *Company) Create(ctx aero.Context) error

Create sets the data for a new company with data we received from the API request.

func (*Company) Creator added in v1.1.25

func (obj *Company) Creator() *User

Creator returns the user who created this object.

func (*Company) CreatorID added in v1.1.25

func (obj *Company) CreatorID() UserID

CreatorID returns the ID of the user who created this object.

func (*Company) Delete

func (company *Company) Delete() error

Delete deletes the object from the database.

func (*Company) DeleteInContext

func (company *Company) DeleteInContext(ctx aero.Context) error

DeleteInContext deletes the company in the given context.

func (*Company) Edit

func (company *Company) Edit(ctx aero.Context, key string, value reflect.Value, newValue reflect.Value) (consumed bool, err error)

Edit creates an edit log entry.

func (*Company) Editor added in v1.1.25

func (obj *Company) Editor() *User

Editor returns the user who last edited this object.

func (*Company) GetCreated added in v1.1.25

func (obj *Company) GetCreated() string

GetCreated returns the creation time of the object.

func (*Company) GetCreatedBy added in v1.1.25

func (obj *Company) GetCreatedBy() UserID

GetCreatedBy returns the ID of the user who created this object.

func (*Company) GetCreatedTime added in v1.1.25

func (obj *Company) GetCreatedTime() time.Time

GetCreatedTime returns the creation time of the object as a time struct.

func (*Company) GetID added in v1.1.25

func (obj *Company) GetID() string

GetID returns the ID.

func (*Company) GetIsDraft added in v1.1.25

func (obj *Company) GetIsDraft() bool

GetIsDraft tells you whether the object is a draft or not.

func (*Company) GetMapping added in v1.1.25

func (obj *Company) GetMapping(name string) string

GetMapping returns the external ID for the given service.

func (*Company) Like added in v1.1.25

func (obj *Company) Like(userID UserID)

Like makes the given user ID like the object.

func (*Company) LikedBy added in v1.1.25

func (obj *Company) LikedBy(userID UserID) bool

LikedBy checks to see if the user has liked the object.

func (company *Company) Link() string

Link returns a single company.

func (*Company) OnAppend

func (company *Company) OnAppend(ctx aero.Context, key string, index int, obj interface{})

OnAppend saves a log entry.

func (*Company) OnRemove

func (company *Company) OnRemove(ctx aero.Context, key string, index int, obj interface{})

OnRemove saves a log entry.

func (*Company) Publish

func (company *Company) Publish() error

Publish publishes the company draft.

func (*Company) RemoveMapping added in v1.1.25

func (obj *Company) RemoveMapping(name string) bool

RemoveMapping removes all mappings with the given service name and ID.

func (*Company) Save

func (company *Company) Save()

Save saves the company in the database.

func (*Company) Self added in v1.1.17

func (company *Company) Self() Loggable

Self returns the object itself.

func (*Company) SetIsDraft added in v1.1.25

func (obj *Company) SetIsDraft(isDraft bool)

SetIsDraft sets the draft state for this object.

func (*Company) SetMapping added in v1.1.25

func (obj *Company) SetMapping(serviceName string, serviceID string)

SetMapping sets the ID of an external site to the obj.

func (*Company) String

func (company *Company) String() string

String implements the default string serialization.

func (*Company) TypeName

func (company *Company) TypeName() string

TypeName returns the type name.

func (*Company) Unlike added in v1.1.25

func (obj *Company) Unlike(userID UserID)

Unlike makes the given user ID unlike the object.

func (*Company) Unpublish

func (company *Company) Unpublish() error

Unpublish turns the company into a draft.

type CompanyName

type CompanyName struct {
	English  string   `json:"english" editable:"true"`
	Japanese string   `json:"japanese" editable:"true"`
	Synonyms []string `json:"synonyms" editable:"true"`
}

CompanyName ...

type ConnectionAnalytics

type ConnectionAnalytics struct {
	DownLink      float64 `json:"downLink"`
	RoundTripTime float64 `json:"roundTripTime"`
	EffectiveType string  `json:"effectiveType"`
}

ConnectionAnalytics stores information about connection speed and ping.

type DraftIndex

type DraftIndex struct {
	UserID       string `json:"userId"`
	GroupID      string `json:"groupId"`
	SoundTrackID string `json:"soundTrackId"`
	CompanyID    string `json:"companyId"`
	QuoteID      string `json:"quoteId"`
	CharacterID  string `json:"characterId"`
	AnimeID      string `json:"animeId"`
	AMVID        string `json:"amvId"`
}

DraftIndex has references to unpublished drafts a user created.

func GetDraftIndex

func GetDraftIndex(id string) (*DraftIndex, error)

GetDraftIndex ...

func NewDraftIndex

func NewDraftIndex(userID UserID) *DraftIndex

NewDraftIndex ...

func (*DraftIndex) GetID

func (index *DraftIndex) GetID(typeName string) (string, error)

GetID gets the ID for the given type name.

func (*DraftIndex) Save

func (index *DraftIndex) Save()

Save saves the index in the database.

func (*DraftIndex) SetID

func (index *DraftIndex) SetID(typeName string, id string) error

SetID sets the ID for the given type name.

type Draftable

type Draftable interface {
	GetIsDraft() bool
	SetIsDraft(bool)
}

Draftable describes a type where drafts can be created.

type EditLogEntry

type EditLogEntry struct {
	ID         string `json:"id"`
	UserID     string `json:"userId"`
	Action     string `json:"action"`
	ObjectType string `json:"objectType"` // The typename of what was edited
	ObjectID   string `json:"objectId"`   // The ID of what was edited
	Key        string `json:"key"`
	OldValue   string `json:"oldValue"`
	NewValue   string `json:"newValue"`
	Created    string `json:"created"`
}

EditLogEntry is an entry in the editor log.

func AllEditLogEntries

func AllEditLogEntries() []*EditLogEntry

AllEditLogEntries returns a slice of all log entries.

func FilterEditLogEntries

func FilterEditLogEntries(filter func(*EditLogEntry) bool) []*EditLogEntry

FilterEditLogEntries filters all log entries by a custom function.

func NewEditLogEntry

func NewEditLogEntry(userID, action, objectType, objectID, key, oldValue, newValue string) *EditLogEntry

NewEditLogEntry ...

func (*EditLogEntry) ActionHumanReadable

func (entry *EditLogEntry) ActionHumanReadable() string

ActionHumanReadable returns the human readable version of the action.

func (*EditLogEntry) EditorScore

func (entry *EditLogEntry) EditorScore() int

EditorScore returns the editing score for this log entry.

func (*EditLogEntry) Object

func (entry *EditLogEntry) Object() interface{}

Object returns the object the log entry refers to.

func (*EditLogEntry) Save

func (entry *EditLogEntry) Save()

Save saves the log entry in the database.

func (*EditLogEntry) User

func (entry *EditLogEntry) User() *User

User returns the user the log entry belongs to.

type EditorFilterSettings

type EditorFilterSettings struct {
	Year   string `json:"year" editable:"true"`
	Season string `json:"season" editable:"true"`
	Status string `json:"status" editable:"true"`
	Type   string `json:"type" editable:"true"`
}

EditorFilterSettings ...

func (*EditorFilterSettings) Suffix

func (filter *EditorFilterSettings) Suffix() string

Suffix returns the URL suffix.

type EditorSettings

type EditorSettings struct {
	Filter EditorFilterSettings `json:"filter"`
}

EditorSettings ...

type EmailToUser

type EmailToUser struct {
	Email  string `json:"email"`
	UserID UserID `json:"userId"`
}

EmailToUser stores the user ID for an email address.

type EpisodeTitle

type EpisodeTitle struct {
	Romaji   string `json:"romaji" editable:"true"`
	English  string `json:"english" editable:"true"`
	Japanese string `json:"japanese" editable:"true"`
}

EpisodeTitle ...

type ExternalMedia

type ExternalMedia struct {
	Service   string `json:"service" editable:"true" datalist:"media-services"`
	ServiceID string `json:"serviceId" editable:"true"`
}

ExternalMedia ...

func GetYoutubeMedia

func GetYoutubeMedia(url string) (*ExternalMedia, error)

GetYoutubeMedia returns an ExternalMedia object for the given Youtube link.

func (*ExternalMedia) Create added in v1.1.16

func (media *ExternalMedia) Create(ctx aero.Context) error

Create sets the data for new external media.

func (media *ExternalMedia) EmbedLink() string

EmbedLink returns the embed link used in iframes for the given media.

type FacebookToUser

type FacebookToUser GoogleToUser

FacebookToUser stores the user ID by Facebook user ID.

type FormatSettings

type FormatSettings struct {
	RatingsPrecision int `json:"ratingsPrecision" editable:"true"`
}

FormatSettings ...

type GeneralAnalytics

type GeneralAnalytics struct {
	TimezoneOffset int `json:"timezoneOffset"`
}

GeneralAnalytics stores general information.

type GoogleToUser

type GoogleToUser struct {
	ID     string `json:"id"`
	UserID UserID `json:"userId"`
}

GoogleToUser stores the user ID by Google user ID.

type Group

type Group struct {
	Name        string         `json:"name" editable:"true"`
	Tagline     string         `json:"tagline" editable:"true"`
	Image       GroupImage     `json:"image"`
	Description string         `json:"description" editable:"true" type:"textarea"`
	Rules       string         `json:"rules" editable:"true" type:"textarea"`
	Restricted  bool           `json:"restricted" editable:"true" tooltip:"Restricted groups can only be joined with the founder's permission."`
	Tags        []string       `json:"tags" editable:"true"`
	Members     []*GroupMember `json:"members"`
	Neighbors   []string       `json:"neighbors"`
	// contains filtered or unexported fields
}

Group represents a group of users.

func AllGroups

func AllGroups() []*Group

AllGroups returns a slice of all groups.

func FilterGroups

func FilterGroups(filter func(*Group) bool) []*Group

FilterGroups filters all groups by a custom function.

func GetGroup

func GetGroup(id string) (*Group, error)

GetGroup ...

func (*Group) AddPost added in v1.1.25

func (obj *Group) AddPost(postID string)

AddPost adds a post to the object.

func (*Group) Authorize

func (group *Group) Authorize(ctx aero.Context, action string) error

Authorize returns an error if the given API POST request is not authorized.

func (*Group) AverageColor

func (group *Group) AverageColor() string

AverageColor returns the average color of the image.

func (*Group) CountPosts added in v1.1.25

func (obj *Group) CountPosts() int

CountPosts returns the number of posts written for this object.

func (*Group) Create

func (group *Group) Create(ctx aero.Context) error

Create ...

func (*Group) Creator added in v1.1.25

func (obj *Group) Creator() *User

Creator returns the user who created this object.

func (*Group) CreatorID added in v1.1.25

func (obj *Group) CreatorID() UserID

CreatorID returns the ID of the user who created this object.

func (*Group) Delete

func (group *Group) Delete() error

Delete deletes the object from the database.

func (*Group) DeleteImages

func (group *Group) DeleteImages()

DeleteImages deletes all images for the group.

func (*Group) DeleteInContext

func (group *Group) DeleteInContext(ctx aero.Context) error

DeleteInContext deletes the amv in the given context.

func (*Group) Edit

func (group *Group) Edit(ctx aero.Context, key string, value reflect.Value, newValue reflect.Value) (consumed bool, err error)

Edit creates an edit log entry.

func (*Group) Editor added in v1.1.25

func (obj *Group) Editor() *User

Editor returns the user who last edited this object.

func (*Group) FindMember

func (group *Group) FindMember(userID UserID) *GroupMember

FindMember returns the group member by user ID, if available.

func (*Group) GetCreated added in v1.1.25

func (obj *Group) GetCreated() string

GetCreated returns the creation time of the object.

func (*Group) GetCreatedBy added in v1.1.25

func (obj *Group) GetCreatedBy() UserID

GetCreatedBy returns the ID of the user who created this object.

func (*Group) GetCreatedTime added in v1.1.25

func (obj *Group) GetCreatedTime() time.Time

GetCreatedTime returns the creation time of the object as a time struct.

func (*Group) GetID added in v1.1.25

func (obj *Group) GetID() string

GetID returns the ID.

func (*Group) GetIsDraft added in v1.1.25

func (obj *Group) GetIsDraft() bool

GetIsDraft tells you whether the object is a draft or not.

func (*Group) HasImage

func (group *Group) HasImage() bool

HasImage returns true if the group has an image.

func (*Group) HasMember

func (group *Group) HasMember(userID UserID) bool

HasMember returns true if the user is a member of the group.

func (group *Group) ImageLink(size string) string

ImageLink returns a link to the group image.

func (*Group) Join

func (group *Group) Join(user *User) error

Join makes the given user join the group.

func (*Group) Leave

func (group *Group) Leave(user *User) error

Leave makes the given user leave the group.

func (group *Group) Link() string

Link returns the URI to the group page.

func (*Group) OnAppend

func (group *Group) OnAppend(ctx aero.Context, key string, index int, obj interface{})

OnAppend saves a log entry.

func (*Group) OnJoin

func (group *Group) OnJoin(user *User)

OnJoin sends notifications to the creator.

func (*Group) OnRemove

func (group *Group) OnRemove(ctx aero.Context, key string, index int, obj interface{})

OnRemove saves a log entry.

func (*Group) Posts added in v1.1.25

func (obj *Group) Posts() []*Post

Posts returns a slice of all posts.

func (*Group) PostsRelevantFirst added in v1.1.25

func (obj *Group) PostsRelevantFirst(count int) []*Post

PostsRelevantFirst returns a slice of all posts sorted by relevance.

func (*Group) Publish

func (group *Group) Publish() error

Publish ...

func (*Group) RemovePost added in v1.1.25

func (obj *Group) RemovePost(postID string) bool

RemovePost removes a post from the object.

func (*Group) Save

func (group *Group) Save()

Save saves the group in the database.

func (*Group) Self added in v1.1.17

func (group *Group) Self() Loggable

Self returns the object itself.

func (*Group) SendNotification

func (group *Group) SendNotification(notification *PushNotification, excludeUserID UserID)

SendNotification sends a notification to all group members except for the excluded user ID.

func (*Group) SetImage

func (group *Group) SetImage(metaImage *imageserver.MetaImage) error

SetImage sets the group image to the given MetaImage.

func (*Group) SetImageBytes

func (group *Group) SetImageBytes(data []byte) error

SetImageBytes accepts a byte buffer that represents an image file and updates the group image.

func (*Group) SetIsDraft added in v1.1.25

func (obj *Group) SetIsDraft(isDraft bool)

SetIsDraft sets the draft state for this object.

func (*Group) String

func (group *Group) String() string

String is the default text representation of the group.

func (*Group) TitleByUser

func (group *Group) TitleByUser(user *User) string

TitleByUser returns the preferred title for the given user.

func (*Group) TypeName

func (group *Group) TypeName() string

TypeName returns the type name.

func (*Group) Unpublish

func (group *Group) Unpublish() error

Unpublish ...

func (*Group) Users

func (group *Group) Users() []*User

Users returns a slice of all users in the group.

type GroupImage

type GroupImage AnimeImage

GroupImage ...

type GroupMember

type GroupMember struct {
	UserID UserID `json:"userId"`
	Role   string `json:"role"`
	Joined string `json:"joined"`
	// contains filtered or unexported fields
}

GroupMember ...

func (*GroupMember) User

func (member *GroupMember) User() *User

User returns the user.

type HSLColor

type HSLColor struct {
	Hue        float64 `json:"hue"`
	Saturation float64 `json:"saturation"`
	Lightness  float64 `json:"lightness"`
}

HSLColor ...

func GetAverageColor

func GetAverageColor(img image.Image) HSLColor

GetAverageColor returns the average color of an image in HSL format.

func (HSLColor) String

func (color HSLColor) String() string

String returns a representation like hsl(0, 0%, 0%).

func (HSLColor) StringWithAlpha

func (color HSLColor) StringWithAlpha(alpha float64) string

StringWithAlpha returns a representation like hsla(0, 0%, 0%, 0.5).

type IDCollection

type IDCollection interface {
	Add(id string) error
	Remove(id string) bool
	Save()
}

IDCollection ...

type IDList

type IDList []string

IDList stores lists of IDs that are retrievable by name.

func GetIDList

func GetIDList(id string) (IDList, error)

GetIDList ...

func (IDList) Append

func (idList IDList) Append(id string) IDList

Append appends the given ID to the end of the list and returns the new IDList.

type IPInfoDBLocation

type IPInfoDBLocation struct {
	CountryName string `json:"countryName"`
	CountryCode string `json:"countryCode"`
	Latitude    string `json:"latitude"`
	Longitude   string `json:"longitude"`
	CityName    string `json:"cityName"`
	RegionName  string `json:"regionName"`
	TimeZone    string `json:"timeZone"`
	ZipCode     string `json:"zipCode"`
}

IPInfoDBLocation ...

type IgnoreAnimeDifference

type IgnoreAnimeDifference struct {
	// The ID is built like this: arn:323|mal:356|JapaneseTitle
	ID        string `json:"id"`
	ValueHash uint64 `json:"valueHash"`
	// contains filtered or unexported fields
}

IgnoreAnimeDifference saves which differences between anime databases can be ignored.

func AllIgnoreAnimeDifferences

func AllIgnoreAnimeDifferences() []*IgnoreAnimeDifference

AllIgnoreAnimeDifferences returns a slice of all ignored differences.

func FilterIgnoreAnimeDifferences

func FilterIgnoreAnimeDifferences(filter func(*IgnoreAnimeDifference) bool) []*IgnoreAnimeDifference

FilterIgnoreAnimeDifferences filters all ignored differences by a custom function.

func GetIgnoreAnimeDifference

func GetIgnoreAnimeDifference(id string) (*IgnoreAnimeDifference, error)

GetIgnoreAnimeDifference ...

func (*IgnoreAnimeDifference) Authorize

func (ignore *IgnoreAnimeDifference) Authorize(ctx aero.Context, action string) error

Authorize returns an error if the given API POST request is not authorized.

func (*IgnoreAnimeDifference) Create

func (ignore *IgnoreAnimeDifference) Create(ctx aero.Context) error

Create constructs the values for this new object with the data we received from the API request.

func (*IgnoreAnimeDifference) Creator added in v1.1.25

func (obj *IgnoreAnimeDifference) Creator() *User

Creator returns the user who created this object.

func (*IgnoreAnimeDifference) CreatorID added in v1.1.25

func (obj *IgnoreAnimeDifference) CreatorID() UserID

CreatorID returns the ID of the user who created this object.

func (*IgnoreAnimeDifference) GetCreated added in v1.1.25

func (obj *IgnoreAnimeDifference) GetCreated() string

GetCreated returns the creation time of the object.

func (*IgnoreAnimeDifference) GetCreatedBy added in v1.1.25

func (obj *IgnoreAnimeDifference) GetCreatedBy() UserID

GetCreatedBy returns the ID of the user who created this object.

func (*IgnoreAnimeDifference) GetCreatedTime added in v1.1.25

func (obj *IgnoreAnimeDifference) GetCreatedTime() time.Time

GetCreatedTime returns the creation time of the object as a time struct.

func (*IgnoreAnimeDifference) Save

func (ignore *IgnoreAnimeDifference) Save()

Save saves the object in the database.

type Inventory

type Inventory struct {
	UserID UserID           `json:"userId"`
	Slots  []*InventorySlot `json:"slots"`
}

Inventory has inventory slots that store shop item IDs and their quantity.

func GetInventory

func GetInventory(userID UserID) (*Inventory, error)

GetInventory ...

func NewInventory

func NewInventory(userID UserID) *Inventory

NewInventory creates a new inventory with the default number of slots.

func (*Inventory) AddItem

func (inventory *Inventory) AddItem(itemID string, quantity uint) error

AddItem adds a given item to the inventory.

func (*Inventory) Authorize

func (inventory *Inventory) Authorize(ctx aero.Context, action string) error

Authorize returns an error if the given API request is not authorized.

func (*Inventory) ContainsItem

func (inventory *Inventory) ContainsItem(itemID string) bool

ContainsItem checks if the inventory contains the item ID already.

func (*Inventory) Save

func (inventory *Inventory) Save()

Save saves the push items in the database.

func (*Inventory) SwapSlots

func (inventory *Inventory) SwapSlots(a, b int) error

SwapSlots swaps the slots with the given indices.

type InventorySlot

type InventorySlot struct {
	ItemID   string `json:"itemId"`
	Quantity uint   `json:"quantity"`
}

InventorySlot ...

func (*InventorySlot) Decrease

func (slot *InventorySlot) Decrease(count uint) error

Decrease reduces the quantity by the given number.

func (*InventorySlot) Increase

func (slot *InventorySlot) Increase(count uint)

Increase increases the quantity by the given number.

func (*InventorySlot) IsEmpty

func (slot *InventorySlot) IsEmpty() bool

IsEmpty ...

func (*InventorySlot) Item

func (slot *InventorySlot) Item() *ShopItem

Item ...

type Joinable

type Joinable interface {
	Join(*User) error
	Leave(*User) error
	Save()
}

Joinable is an object where users can join and leave.

type KitsuMatch

type KitsuMatch struct {
	KitsuItem *kitsu.LibraryEntry `json:"kitsuItem"`
	ARNAnime  *Anime              `json:"arnAnime"`
}

KitsuMatch ...

func (*KitsuMatch) JSON

func (match *KitsuMatch) JSON() string

JSON ...

type LikeEventReceiver

type LikeEventReceiver interface {
	OnLike(user *User)
}

LikeEventReceiver ...

type Likeable

type Likeable interface {
	Like(userID UserID)
	Unlike(userID UserID)
	LikedBy(userID UserID) bool
	CountLikes() int
	Link() string
	Save()
}

Likeable ...

type Link struct {
	Title string `json:"title" editable:"true"`
	URL   string `json:"url" editable:"true"`
}

Link describes a single link to an external website.

type Linkable

type Linkable interface {
	Link() string
}

Linkable defines an object that can be linked.

type ListProviderConfig

type ListProviderConfig struct {
	UserName string `json:"userName"`
}

ListProviderConfig ...

type Location

type Location struct {
	CountryName string  `json:"countryName"`
	CountryCode string  `json:"countryCode"`
	Latitude    float64 `json:"latitude" editable:"true"`
	Longitude   float64 `json:"longitude" editable:"true"`
	CityName    string  `json:"cityName"`
	RegionName  string  `json:"regionName"`
	TimeZone    string  `json:"timeZone"`
	ZipCode     string  `json:"zipCode"`
}

Location ...

func (*Location) Distance

func (p *Location) Distance(p2 *Location) float64

Distance calculates the distance in kilometers to the second location. Original implementation: https://www.movable-type.co.uk/scripts/latlong.html

func (*Location) IsValid

func (p *Location) IsValid() bool

IsValid returns true if latitude and longitude are available.

type LockEventReceiver

type LockEventReceiver interface {
	OnLock(user *User)
	OnUnlock(user *User)
}

LockEventReceiver ...

type Lockable

type Lockable interface {
	Lock(userID UserID)
	Unlock(userID UserID)
	IsLocked() bool
	Save()
}

Lockable ...

type Loggable

type Loggable interface {
	GetID() string
	TypeName() string
	Self() Loggable
}

Loggable applies to any type that has a TypeName function.

type Mapping

type Mapping struct {
	Service   string `json:"service" editable:"true" datalist:"mapping-services"`
	ServiceID string `json:"serviceId" editable:"true"`
}

Mapping ...

func (mapping *Mapping) Link() string

Link ...

func (*Mapping) Name

func (mapping *Mapping) Name() string

Name ...

type MyAnimeListMatch

type MyAnimeListMatch struct {
	MyAnimeListItem *mal.AnimeListItem `json:"malItem"`
	ARNAnime        *Anime             `json:"arnAnime"`
}

MyAnimeListMatch ...

func (*MyAnimeListMatch) JSON

func (match *MyAnimeListMatch) JSON() string

JSON ...

type Name

type Name struct {
	First string `json:"first" editable:"true"`
	Last  string `json:"last" editable:"true"`
}

Name is the combination of a first and last name.

func (Name) String

func (name Name) String() string

String returns the default visualization of the name.

type NickToUser

type NickToUser struct {
	Nick   string `json:"nick"`
	UserID UserID `json:"userId"`
}

NickToUser stores the user ID by nickname.

type Notification

type Notification struct {
	ID      string `json:"id"`
	UserID  string `json:"userId"`
	Created string `json:"created"`
	Seen    string `json:"seen"`
	PushNotification
}

Notification represents a user-associated notification.

func AllNotifications

func AllNotifications() ([]*Notification, error)

AllNotifications returns a slice of all notifications.

func GetNotification

func GetNotification(id string) (*Notification, error)

GetNotification ...

func NewNotification

func NewNotification(userID UserID, pushNotification *PushNotification) *Notification

NewNotification creates a new notification.

func (*Notification) CreatedTime

func (notification *Notification) CreatedTime() time.Time

CreatedTime returns the created date as a time object.

func (*Notification) Save

func (notification *Notification) Save()

Save saves the notification in the database.

func (*Notification) String

func (notification *Notification) String() string

String returns a string representation of the notification.

func (*Notification) User

func (notification *Notification) User() *User

User retrieves the user the notification was sent to.

type NotificationSettings

type NotificationSettings struct {
	Email                string `json:"email" private:"true"`
	NewFollowers         bool   `json:"newFollowers" editable:"true"`
	AnimeEpisodeReleases bool   `json:"animeEpisodeReleases" editable:"true"`
	AnimeFinished        bool   `json:"animeFinished" editable:"true"`
	ForumLikes           bool   `json:"forumLikes" editable:"true"`
	GroupPostLikes       bool   `json:"groupPostLikes" editable:"true"`
	QuoteLikes           bool   `json:"quoteLikes" editable:"true"`
	SoundTrackLikes      bool   `json:"soundTrackLikes" editable:"true"`
}

NotificationSettings ...

func DefaultNotificationSettings

func DefaultNotificationSettings() NotificationSettings

DefaultNotificationSettings returns the default notification settings.

type OpenGraph

type OpenGraph struct {
	Tags map[string]string
	Meta map[string]string
}

OpenGraph data

type Option

type Option struct {
	Value string
	Label string
}

Option is a selection list item.

type PayPalPayment

type PayPalPayment struct {
	ID       string `json:"id"`
	UserID   string `json:"userId"`
	PayerID  string `json:"payerId"`
	Amount   string `json:"amount"`
	Currency string `json:"currency"`
	Method   string `json:"method"`
	Created  string `json:"created"`
}

PayPalPayment is an approved and exeucted PayPal payment.

func AllPayPalPayments

func AllPayPalPayments() ([]*PayPalPayment, error)

AllPayPalPayments returns a slice of all paypal payments.

func FilterPayPalPayments

func FilterPayPalPayments(filter func(*PayPalPayment) bool) ([]*PayPalPayment, error)

FilterPayPalPayments filters all paypal payments by a custom function.

func (*PayPalPayment) Gems

func (payment *PayPalPayment) Gems() int

Gems returns the total amount of gems.

func (*PayPalPayment) Save

func (payment *PayPalPayment) Save()

Save saves the paypal payment in the database.

func (*PayPalPayment) User

func (payment *PayPalPayment) User() *User

User returns the user who made the payment.

type Person

type Person struct {
	Name  PersonName  `json:"name" editable:"true"`
	Image PersonImage `json:"image"`
	// contains filtered or unexported fields
}

Person represents a person in real life.

func AllPersons

func AllPersons() []*Person

AllPersons returns a slice of all persons.

func FilterPersons

func FilterPersons(filter func(*Person) bool) []*Person

FilterPersons filters all persons by a custom function.

func GetPerson

func GetPerson(id string) (*Person, error)

GetPerson ...

func NewPerson

func NewPerson() *Person

NewPerson creates a new person.

func (*Person) AddPost added in v1.1.25

func (obj *Person) AddPost(postID string)

AddPost adds a post to the object.

func (*Person) Authorize

func (person *Person) Authorize(ctx aero.Context, action string) error

Authorize returns an error if the given API request is not authorized.

func (*Person) CountLikes added in v1.1.25

func (obj *Person) CountLikes() int

CountLikes returns the number of likes the object has received.

func (*Person) CountPosts added in v1.1.25

func (obj *Person) CountPosts() int

CountPosts returns the number of posts written for this object.

func (*Person) Create

func (person *Person) Create(ctx aero.Context) error

Create sets the data for a new person with data we received from the API request.

func (*Person) Creator added in v1.1.25

func (obj *Person) Creator() *User

Creator returns the user who created this object.

func (*Person) CreatorID added in v1.1.25

func (obj *Person) CreatorID() UserID

CreatorID returns the ID of the user who created this object.

func (*Person) Delete

func (person *Person) Delete() error

Delete deletes the object from the database.

func (*Person) DeleteImages

func (person *Person) DeleteImages()

DeleteImages deletes all images for the person.

func (*Person) DeleteInContext

func (person *Person) DeleteInContext(ctx aero.Context) error

DeleteInContext deletes the person in the given context.

func (*Person) Edit

func (person *Person) Edit(ctx aero.Context, key string, value reflect.Value, newValue reflect.Value) (consumed bool, err error)

Edit creates an edit log entry.

func (*Person) Editor added in v1.1.25

func (obj *Person) Editor() *User

Editor returns the user who last edited this object.

func (*Person) GetCreated added in v1.1.25

func (obj *Person) GetCreated() string

GetCreated returns the creation time of the object.

func (*Person) GetCreatedBy added in v1.1.25

func (obj *Person) GetCreatedBy() UserID

GetCreatedBy returns the ID of the user who created this object.

func (*Person) GetCreatedTime added in v1.1.25

func (obj *Person) GetCreatedTime() time.Time

GetCreatedTime returns the creation time of the object as a time struct.

func (*Person) GetID added in v1.1.25

func (obj *Person) GetID() string

GetID returns the ID.

func (*Person) GetIsDraft added in v1.1.25

func (obj *Person) GetIsDraft() bool

GetIsDraft tells you whether the object is a draft or not.

func (*Person) HasImage

func (person *Person) HasImage() bool

HasImage returns true if the person has an image.

func (person *Person) ImageLink(size string) string

ImageLink ...

func (*Person) Like added in v1.1.25

func (obj *Person) Like(userID UserID)

Like makes the given user ID like the object.

func (*Person) LikedBy added in v1.1.25

func (obj *Person) LikedBy(userID UserID) bool

LikedBy checks to see if the user has liked the object.

func (person *Person) Link() string

Link ...

func (*Person) OnAppend

func (person *Person) OnAppend(ctx aero.Context, key string, index int, obj interface{})

OnAppend saves a log entry.

func (*Person) OnRemove

func (person *Person) OnRemove(ctx aero.Context, key string, index int, obj interface{})

OnRemove saves a log entry.

func (*Person) Posts added in v1.1.25

func (obj *Person) Posts() []*Post

Posts returns a slice of all posts.

func (*Person) PostsRelevantFirst added in v1.1.25

func (obj *Person) PostsRelevantFirst(count int) []*Post

PostsRelevantFirst returns a slice of all posts sorted by relevance.

func (*Person) Publish

func (person *Person) Publish() error

Publish publishes the person draft.

func (*Person) RemovePost added in v1.1.25

func (obj *Person) RemovePost(postID string) bool

RemovePost removes a post from the object.

func (*Person) Save

func (person *Person) Save()

Save saves the person in the database.

func (*Person) Self added in v1.1.17

func (person *Person) Self() Loggable

Self returns the object itself.

func (*Person) SetIsDraft added in v1.1.25

func (obj *Person) SetIsDraft(isDraft bool)

SetIsDraft sets the draft state for this object.

func (*Person) String

func (person *Person) String() string

String returns the default display name for the person.

func (*Person) TitleByUser

func (person *Person) TitleByUser(user *User) string

TitleByUser returns the preferred title for the given user.

func (*Person) TypeName

func (person *Person) TypeName() string

TypeName returns the type name.

func (*Person) Unlike added in v1.1.25

func (obj *Person) Unlike(userID UserID)

Unlike makes the given user ID unlike the object.

func (*Person) Unpublish

func (person *Person) Unpublish() error

Unpublish turns the person into a draft.

type PersonImage

type PersonImage CharacterImage

PersonImage ...

type PersonName

type PersonName struct {
	English  Name `json:"english" editable:"true"`
	Japanese Name `json:"japanese" editable:"true"`
}

PersonName represents the name of a person.

func (*PersonName) ByUser

func (name *PersonName) ByUser(user *User) string

ByUser returns the preferred name for the given user.

func (*PersonName) String

func (name *PersonName) String() string

String returns the default visualization of the name.

type PieChart

type PieChart struct {
	Title  string           `json:"title"`
	Slices []*PieChartSlice `json:"slices"`
}

PieChart ...

func NewPieChart

func NewPieChart(title string, data map[string]float64) *PieChart

NewPieChart ...

type PieChartSlice

type PieChartSlice struct {
	From  float64 `json:"from"`
	To    float64 `json:"to"`
	Title string  `json:"title"`
	Color string  `json:"color"`
}

PieChartSlice ...

func ToPieChartSlices

func ToPieChartSlices(data map[string]float64) []*PieChartSlice

ToPieChartSlices ...

type Post

type Post struct {
	Tags       []string `json:"tags" editable:"true"`
	ParentID   string   `json:"parentId" editable:"true"`
	ParentType string   `json:"parentType"`
	Edited     string   `json:"edited"`
	// contains filtered or unexported fields
}

Post is a comment related to any parent type in the database.

func AllPosts

func AllPosts() []*Post

AllPosts returns a slice of all posts.

func FilterPosts

func FilterPosts(filter func(*Post) bool) ([]*Post, error)

FilterPosts filters all forum posts by a custom function.

func FilterPostsWithUniqueThreads

func FilterPostsWithUniqueThreads(posts []*Post, limit int) []*Post

FilterPostsWithUniqueThreads removes posts with the same thread until we have enough posts.

func GetPost

func GetPost(id string) (*Post, error)

GetPost ...

func GetPostsByUser

func GetPostsByUser(user *User) ([]*Post, error)

GetPostsByUser ...

func (*Post) AddPost added in v1.1.25

func (obj *Post) AddPost(postID string)

AddPost adds a post to the object.

func (*Post) AfterEdit added in v1.0.4

func (post *Post) AfterEdit(ctx aero.Context) error

AfterEdit sets the edited date on the post object.

func (*Post) Authorize

func (post *Post) Authorize(ctx aero.Context, action string) error

Authorize returns an error if the given API POST request is not authorized.

func (*Post) CountLikes added in v1.1.25

func (obj *Post) CountLikes() int

CountLikes returns the number of likes the object has received.

func (*Post) CountPosts added in v1.1.25

func (obj *Post) CountPosts() int

CountPosts returns the number of posts written for this object.

func (*Post) Create

func (post *Post) Create(ctx aero.Context) error

Create sets the data for a new post with data we received from the API request.

func (*Post) Creator added in v1.1.25

func (obj *Post) Creator() *User

Creator returns the user who created this object.

func (*Post) CreatorID added in v1.1.25

func (obj *Post) CreatorID() UserID

CreatorID returns the ID of the user who created this object.

func (*Post) Delete

func (post *Post) Delete() error

Delete deletes the post from the database.

func (*Post) DeleteInContext

func (post *Post) DeleteInContext(ctx aero.Context) error

DeleteInContext deletes the post in the given context.

func (*Post) Edit

func (post *Post) Edit(ctx aero.Context, key string, value reflect.Value, newValue reflect.Value) (bool, error)

Edit saves a log entry for the edit.

func (*Post) GetCreated added in v1.1.25

func (obj *Post) GetCreated() string

GetCreated returns the creation time of the object.

func (*Post) GetCreatedBy added in v1.1.25

func (obj *Post) GetCreatedBy() UserID

GetCreatedBy returns the ID of the user who created this object.

func (*Post) GetCreatedTime added in v1.1.25

func (obj *Post) GetCreatedTime() time.Time

GetCreatedTime returns the creation time of the object as a time struct.

func (*Post) GetID added in v1.1.25

func (obj *Post) GetID() string

GetID returns the ID.

func (*Post) GetParentID

func (post *Post) GetParentID() string

GetParentID returns the object ID of the parent.

func (*Post) GetText added in v1.1.25

func (obj *Post) GetText() string

GetText returns the text of the object.

func (*Post) HTML

func (post *Post) HTML() string

HTML returns the HTML representation of the post.

func (*Post) Like added in v1.1.25

func (obj *Post) Like(userID UserID)

Like makes the given user ID like the object.

func (*Post) LikedBy added in v1.1.25

func (obj *Post) LikedBy(userID UserID) bool

LikedBy checks to see if the user has liked the object.

func (post *Post) Link() string

Link returns the relative URL of the post.

func (*Post) OnAppend

func (post *Post) OnAppend(ctx aero.Context, key string, index int, obj interface{})

OnAppend saves a log entry.

func (*Post) OnLike

func (post *Post) OnLike(likedBy *User)

OnLike is called when the post receives a like.

func (*Post) OnRemove

func (post *Post) OnRemove(ctx aero.Context, key string, index int, obj interface{})

OnRemove saves a log entry.

func (*Post) Parent

func (post *Post) Parent() PostParent

Parent returns the object this post was posted in.

func (*Post) Posts added in v1.1.25

func (obj *Post) Posts() []*Post

Posts returns a slice of all posts.

func (*Post) PostsRelevantFirst added in v1.1.25

func (obj *Post) PostsRelevantFirst(count int) []*Post

PostsRelevantFirst returns a slice of all posts sorted by relevance.

func (*Post) RemovePost added in v1.1.25

func (obj *Post) RemovePost(postID string) bool

RemovePost removes a post from the object.

func (*Post) Save

func (post *Post) Save()

Save saves the post object in the database.

func (*Post) Self added in v1.1.17

func (post *Post) Self() Loggable

Self returns the object itself.

func (*Post) SetParent

func (post *Post) SetParent(newParent PostParent)

SetParent sets a new parent.

func (*Post) String

func (post *Post) String() string

String implements the default string serialization.

func (*Post) TitleByUser

func (post *Post) TitleByUser(user *User) string

TitleByUser returns the preferred title for the given user.

func (*Post) TopMostParent

func (post *Post) TopMostParent() PostParent

TopMostParent returns the first non-post object this post was posted in.

func (*Post) TypeName

func (post *Post) TypeName() string

TypeName returns the type name.

func (*Post) Unlike added in v1.1.25

func (obj *Post) Unlike(userID UserID)

Unlike makes the given user ID unlike the object.

type PostParent

type PostParent interface {
	Linkable
	api.Savable
	GetID() string
	TypeName() string
	TitleByUser(*User) string
	Posts() []*Post
	PostsRelevantFirst(count int) []*Post
	CountPosts() int
	Creator() *User
	CreatorID() UserID
	AddPost(string)
	RemovePost(string) bool
}

PostParent is an interface that defines common functions for parent objects of posts.

type Postable

type Postable interface {
	Likeable

	TitleByUser(*User) string
	HTML() string
	Parent() PostParent
	Posts() []*Post
	CountPosts() int
	TypeName() string
	Creator() *User

	// Use Get prefix for these to avoid a
	// name clash with the internal fields.
	GetID() string
	GetText() string
	GetCreated() string
	GetParentID() string
}

Postable is a generic interface for Threads, Posts and Messages.

func ToPostables

func ToPostables(sliceOfPosts interface{}) []Postable

ToPostables converts a slice of specific types to a slice of generic postables.

type PrivacySettings

type PrivacySettings struct {
	ShowAge      bool `json:"showAge" editable:"true"`
	ShowGender   bool `json:"showGender" editable:"true"`
	ShowLocation bool `json:"showLocation" editable:"true"`
}

PrivacySettings ...

type Publishable

type Publishable interface {
	Publish() error
	Unpublish() error
	Save()
	GetID() string
	GetCreatedBy() string
	GetIsDraft() bool
	SetIsDraft(bool)
}

Publishable ...

type Purchase

type Purchase struct {
	ID       string `json:"id"`
	UserID   string `json:"userId"`
	ItemID   string `json:"itemId"`
	Quantity int    `json:"quantity"`
	Price    int    `json:"price"`
	Currency string `json:"currency"`
	Date     string `json:"date"`
}

Purchase represents an item purchase by a user.

func AllPurchases

func AllPurchases() ([]*Purchase, error)

AllPurchases returns a slice of all anime.

func FilterPurchases

func FilterPurchases(filter func(*Purchase) bool) ([]*Purchase, error)

FilterPurchases filters all purchases by a custom function.

func NewPurchase

func NewPurchase(userID UserID, itemID string, quantity int, price int, currency string) *Purchase

NewPurchase creates a new Purchase object with a generated ID.

func (*Purchase) Item

func (purchase *Purchase) Item() *ShopItem

Item returns the item the user bought.

func (*Purchase) Save

func (purchase *Purchase) Save()

Save saves the purchase in the database.

func (*Purchase) User

func (purchase *Purchase) User() *User

User returns the user who made the purchase.

type PushEndpoint

type PushEndpoint struct {
	Registered string `json:"registered"`
	Keys       struct {
		P256DH string `json:"p256dh" private:"true"`
		Auth   string `json:"auth" private:"true"`
	} `json:"keys"`
}

PushEndpoint ...

type PushNotification

type PushNotification struct {
	Title   string `json:"title"`
	Message string `json:"message"`
	Icon    string `json:"icon"`
	Link    string `json:"link"`
	Type    string `json:"type"`
}

PushNotification represents a push notification.

type PushSubscription

type PushSubscription struct {
	Platform  string `json:"platform"`
	UserAgent string `json:"userAgent"`
	Screen    struct {
		Width  int `json:"width"`
		Height int `json:"height"`
	} `json:"screen"`
	Endpoint    string `json:"endpoint" private:"true"`
	P256DH      string `json:"p256dh" private:"true"`
	Auth        string `json:"auth" private:"true"`
	Created     string `json:"created"`
	LastSuccess string `json:"lastSuccess"`
}

PushSubscription ...

func (*PushSubscription) ID

func (sub *PushSubscription) ID() string

ID ...

func (*PushSubscription) SendNotification

func (sub *PushSubscription) SendNotification(notification *PushNotification) (*http.Response, error)

SendNotification ...

type PushSubscriptions

type PushSubscriptions struct {
	UserID UserID              `json:"userId"`
	Items  []*PushSubscription `json:"items"`
}

PushSubscriptions is a list of push subscriptions made by a user.

func GetPushSubscriptions

func GetPushSubscriptions(id string) (*PushSubscriptions, error)

GetPushSubscriptions ...

func (*PushSubscriptions) Add

func (list *PushSubscriptions) Add(subscription *PushSubscription) error

Add adds a subscription to the list if it hasn't been added yet.

func (*PushSubscriptions) Authorize

func (list *PushSubscriptions) Authorize(ctx aero.Context, action string) error

Authorize returns an error if the given API request is not authorized.

func (*PushSubscriptions) Contains

func (list *PushSubscriptions) Contains(subscriptionID string) bool

Contains checks if the list contains the subscription ID already.

func (*PushSubscriptions) Filter

func (list *PushSubscriptions) Filter()

Filter removes privacy critical fields from the settings object.

func (*PushSubscriptions) Find

func (list *PushSubscriptions) Find(id string) *PushSubscription

Find returns the subscription with the specified ID, if available.

func (*PushSubscriptions) Remove

func (list *PushSubscriptions) Remove(subscriptionID string) bool

Remove removes the subscription ID from the list.

func (*PushSubscriptions) Save

func (list *PushSubscriptions) Save()

Save saves the push subscriptions in the database.

func (*PushSubscriptions) ShouldFilter

func (list *PushSubscriptions) ShouldFilter(ctx aero.Context) bool

ShouldFilter tells whether data needs to be filtered in the given context.

type Quote

type Quote struct {
	Text          QuoteText `json:"text" editable:"true"`
	CharacterID   string    `json:"characterId" editable:"true"`
	AnimeID       string    `json:"animeId" editable:"true"`
	EpisodeNumber int       `json:"episode" editable:"true"`
	Time          int       `json:"time" editable:"true"`
	// contains filtered or unexported fields
}

Quote is a quote made by a character in an anime.

func AllQuotes

func AllQuotes() []*Quote

AllQuotes returns a slice of all quotes.

func FilterQuotes

func FilterQuotes(filter func(*Quote) bool) []*Quote

FilterQuotes filters all quotes by a custom function.

func GetQuote

func GetQuote(id string) (*Quote, error)

GetQuote returns a single quote.

func (*Quote) AddPost added in v1.1.25

func (obj *Quote) AddPost(postID string)

AddPost adds a post to the object.

func (*Quote) Anime

func (quote *Quote) Anime() *Anime

Anime fetches the anime where the quote is said.

func (*Quote) Authorize

func (quote *Quote) Authorize(ctx aero.Context, action string) error

Authorize returns an error if the given API request is not authorized.

func (*Quote) Character

func (quote *Quote) Character() *Character

Character returns the character cited in the quote

func (*Quote) CountLikes added in v1.1.25

func (obj *Quote) CountLikes() int

CountLikes returns the number of likes the object has received.

func (*Quote) CountPosts added in v1.1.25

func (obj *Quote) CountPosts() int

CountPosts returns the number of posts written for this object.

func (*Quote) Create

func (quote *Quote) Create(ctx aero.Context) error

Create sets the data for a new quote with data we received from the API request.

func (*Quote) Creator added in v1.1.25

func (obj *Quote) Creator() *User

Creator returns the user who created this object.

func (*Quote) CreatorID added in v1.1.25

func (obj *Quote) CreatorID() UserID

CreatorID returns the ID of the user who created this object.

func (*Quote) Delete

func (quote *Quote) Delete() error

Delete deletes the object from the database.

func (*Quote) DeleteInContext

func (quote *Quote) DeleteInContext(ctx aero.Context) error

DeleteInContext deletes the quote in the given context.

func (*Quote) Edit

func (quote *Quote) Edit(ctx aero.Context, key string, value reflect.Value, newValue reflect.Value) (bool, error)

Edit saves a log entry for the edit.

func (*Quote) Editor added in v1.1.25

func (obj *Quote) Editor() *User

Editor returns the user who last edited this object.

func (*Quote) GetCreated added in v1.1.25

func (obj *Quote) GetCreated() string

GetCreated returns the creation time of the object.

func (*Quote) GetCreatedBy added in v1.1.25

func (obj *Quote) GetCreatedBy() UserID

GetCreatedBy returns the ID of the user who created this object.

func (*Quote) GetCreatedTime added in v1.1.25

func (obj *Quote) GetCreatedTime() time.Time

GetCreatedTime returns the creation time of the object as a time struct.

func (*Quote) GetID added in v1.1.25

func (obj *Quote) GetID() string

GetID returns the ID.

func (*Quote) GetIsDraft added in v1.1.25

func (obj *Quote) GetIsDraft() bool

GetIsDraft tells you whether the object is a draft or not.

func (*Quote) IsMainQuote

func (quote *Quote) IsMainQuote() bool

IsMainQuote returns true if the quote is the main quote of the character.

func (*Quote) IsValid

func (quote *Quote) IsValid() bool

IsValid tests the field values and returns true if everything is okay.

func (*Quote) Like added in v1.1.25

func (obj *Quote) Like(userID UserID)

Like makes the given user ID like the object.

func (*Quote) LikedBy added in v1.1.25

func (obj *Quote) LikedBy(userID UserID) bool

LikedBy checks to see if the user has liked the object.

func (quote *Quote) Link() string

Link returns a single quote.

func (*Quote) OnLike

func (quote *Quote) OnLike(likedBy *User)

OnLike is called when the quote receives a like.

func (*Quote) Posts added in v1.1.25

func (obj *Quote) Posts() []*Post

Posts returns a slice of all posts.

func (*Quote) PostsRelevantFirst added in v1.1.25

func (obj *Quote) PostsRelevantFirst(count int) []*Post

PostsRelevantFirst returns a slice of all posts sorted by relevance.

func (*Quote) Publish

func (quote *Quote) Publish() error

Publish checks the quote and publishes it when no errors were found.

func (*Quote) RemovePost added in v1.1.25

func (obj *Quote) RemovePost(postID string) bool

RemovePost removes a post from the object.

func (*Quote) Save

func (quote *Quote) Save()

Save saves the quote in the database.

func (*Quote) Self added in v1.1.17

func (quote *Quote) Self() Loggable

Self returns the object itself.

func (*Quote) SetIsDraft added in v1.1.25

func (obj *Quote) SetIsDraft(isDraft bool)

SetIsDraft sets the draft state for this object.

func (*Quote) String

func (quote *Quote) String() string

String implements the default string serialization.

func (*Quote) TitleByUser

func (quote *Quote) TitleByUser(user *User) string

TitleByUser returns the preferred title for the given user.

func (*Quote) TypeName

func (quote *Quote) TypeName() string

TypeName returns the type name.

func (*Quote) Unlike added in v1.1.25

func (obj *Quote) Unlike(userID UserID)

Unlike makes the given user ID unlike the object.

func (*Quote) Unpublish

func (quote *Quote) Unpublish() error

Unpublish ...

type QuoteText

type QuoteText struct {
	English  string `json:"english" editable:"true" type:"textarea"`
	Japanese string `json:"japanese" editable:"true" type:"textarea"`
}

QuoteText ...

type ScreenAnalytics

type ScreenAnalytics struct {
	Width           int     `json:"width"`
	Height          int     `json:"height"`
	AvailableWidth  int     `json:"availableWidth"`
	AvailableHeight int     `json:"availableHeight"`
	PixelRatio      float64 `json:"pixelRatio"`
}

ScreenAnalytics stores information about the device screen.

type ServiceProviders

type ServiceProviders struct {
	Anime string `json:"anime"`
}

ServiceProviders ...

type Session

type Session map[string]interface{}

Session stores session-related data.

type Settings

type Settings struct {
	UserID        string               `json:"userId"`
	SortBy        string               `json:"sortBy"`
	TitleLanguage string               `json:"titleLanguage" editable:"true"`
	Providers     ServiceProviders     `json:"providers"`
	Avatar        AvatarSettings       `json:"avatar"`
	Format        FormatSettings       `json:"format"`
	Notification  NotificationSettings `json:"notification"`
	Editor        EditorSettings       `json:"editor"`
	Privacy       PrivacySettings      `json:"privacy"`
	Calendar      CalendarSettings     `json:"calendar" editable:"true"`
	Theme         string               `json:"theme" editable:"true"`
}

Settings represents user settings.

func GetSettings

func GetSettings(userID UserID) (*Settings, error)

GetSettings ...

func NewSettings

func NewSettings(user *User) *Settings

NewSettings ...

func (*Settings) Authorize

func (settings *Settings) Authorize(ctx aero.Context, action string) error

Authorize returns an error if the given API POST request is not authorized.

func (*Settings) Edit

func (settings *Settings) Edit(ctx aero.Context, key string, value reflect.Value, newValue reflect.Value) (bool, error)

Edit updates the settings object.

func (*Settings) Filter

func (settings *Settings) Filter()

Filter removes privacy critical fields from the settings object.

func (*Settings) Save

func (settings *Settings) Save()

Save saves the settings in the database.

func (*Settings) ShouldFilter

func (settings *Settings) ShouldFilter(ctx aero.Context) bool

ShouldFilter tells whether data needs to be filtered in the given context.

func (*Settings) User

func (settings *Settings) User() *User

User returns the user object for the settings.

type ShopItem

type ShopItem struct {
	ID          string `json:"id"`
	Name        string `json:"name"`
	Description string `json:"description"`
	Price       uint   `json:"price"`
	Icon        string `json:"icon"`
	Rarity      string `json:"rarity"`
	Order       int    `json:"order"`
	Consumable  bool   `json:"consumable"`
}

ShopItem is a purchasable item in the shop.

func AllShopItems

func AllShopItems() ([]*ShopItem, error)

AllShopItems returns a slice of all items.

func GetShopItem

func GetShopItem(id string) (*ShopItem, error)

GetShopItem ...

func (*ShopItem) Save

func (item *ShopItem) Save()

Save saves the item in the database.

type SoundTrack

type SoundTrack struct {
	Title  SoundTrackTitle  `json:"title" editable:"true"`
	Media  []*ExternalMedia `json:"media" editable:"true"`
	Links  []*Link          `json:"links" editable:"true"`
	Lyrics SoundTrackLyrics `json:"lyrics" editable:"true"`
	Tags   []string         `` /* 702-byte string literal not displayed */
	File   string           `json:"file"`
	// contains filtered or unexported fields
}

SoundTrack is a soundtrack used in one or multiple anime.

func AllSoundTracks

func AllSoundTracks() []*SoundTrack

AllSoundTracks ...

func FilterSoundTracks

func FilterSoundTracks(filter func(*SoundTrack) bool) []*SoundTrack

FilterSoundTracks filters all soundtracks by a custom function.

func GetSoundTrack

func GetSoundTrack(id string) (*SoundTrack, error)

GetSoundTrack ...

func (*SoundTrack) AddPost added in v1.1.25

func (obj *SoundTrack) AddPost(postID string)

AddPost adds a post to the object.

func (*SoundTrack) Anime

func (track *SoundTrack) Anime() []*Anime

Anime fetches all tagged anime of the sound track.

func (*SoundTrack) Authorize

func (track *SoundTrack) Authorize(ctx aero.Context, action string) error

Authorize returns an error if the given API POST request is not authorized.

func (*SoundTrack) CountLikes added in v1.1.25

func (obj *SoundTrack) CountLikes() int

CountLikes returns the number of likes the object has received.

func (*SoundTrack) CountPosts added in v1.1.25

func (obj *SoundTrack) CountPosts() int

CountPosts returns the number of posts written for this object.

func (*SoundTrack) Create

func (track *SoundTrack) Create(ctx aero.Context) error

Create sets the data for a new track with data we received from the API request.

func (*SoundTrack) Creator added in v1.1.25

func (obj *SoundTrack) Creator() *User

Creator returns the user who created this object.

func (*SoundTrack) CreatorID added in v1.1.25

func (obj *SoundTrack) CreatorID() UserID

CreatorID returns the ID of the user who created this object.

func (*SoundTrack) Delete

func (track *SoundTrack) Delete() error

Delete deletes the object from the database.

func (*SoundTrack) DeleteInContext

func (track *SoundTrack) DeleteInContext(ctx aero.Context) error

DeleteInContext deletes the track in the given context.

func (*SoundTrack) Download

func (track *SoundTrack) Download() error

Download downloads the track.

func (*SoundTrack) Edit

func (track *SoundTrack) Edit(ctx aero.Context, key string, value reflect.Value, newValue reflect.Value) (bool, error)

Edit updates the external media object.

func (*SoundTrack) EditedByUser

func (track *SoundTrack) EditedByUser() *User

EditedByUser returns the user who edited this track last.

func (*SoundTrack) Editor added in v1.1.25

func (obj *SoundTrack) Editor() *User

Editor returns the user who last edited this object.

func (*SoundTrack) EtternaBeatmaps

func (track *SoundTrack) EtternaBeatmaps() []string

EtternaBeatmaps returns all Etterna song IDs of the sound track.

func (*SoundTrack) GetCreated added in v1.1.25

func (obj *SoundTrack) GetCreated() string

GetCreated returns the creation time of the object.

func (*SoundTrack) GetCreatedBy added in v1.1.25

func (obj *SoundTrack) GetCreatedBy() UserID

GetCreatedBy returns the ID of the user who created this object.

func (*SoundTrack) GetCreatedTime added in v1.1.25

func (obj *SoundTrack) GetCreatedTime() time.Time

GetCreatedTime returns the creation time of the object as a time struct.

func (*SoundTrack) GetID added in v1.1.25

func (obj *SoundTrack) GetID() string

GetID returns the ID.

func (*SoundTrack) GetIsDraft added in v1.1.25

func (obj *SoundTrack) GetIsDraft() bool

GetIsDraft tells you whether the object is a draft or not.

func (*SoundTrack) HasLyrics

func (track *SoundTrack) HasLyrics() bool

HasLyrics returns true if the track has lyrics in any language.

func (*SoundTrack) HasMediaByService

func (track *SoundTrack) HasMediaByService(service string) bool

HasMediaByService returns true if the track has media by the given service.

func (*SoundTrack) HasTag

func (track *SoundTrack) HasTag(search string) bool

HasTag returns true if it contains the given tag.

func (*SoundTrack) Like added in v1.1.25

func (obj *SoundTrack) Like(userID UserID)

Like makes the given user ID like the object.

func (*SoundTrack) LikedBy added in v1.1.25

func (obj *SoundTrack) LikedBy(userID UserID) bool

LikedBy checks to see if the user has liked the object.

func (track *SoundTrack) Link() string

Link returns the permalink for the track.

func (*SoundTrack) MainAnime

func (track *SoundTrack) MainAnime() *Anime

MainAnime ...

func (*SoundTrack) MediaByService

func (track *SoundTrack) MediaByService(service string) []*ExternalMedia

MediaByService returns a slice of all media by the given service.

func (*SoundTrack) OnAppend

func (track *SoundTrack) OnAppend(ctx aero.Context, key string, index int, obj interface{})

OnAppend saves a log entry.

func (*SoundTrack) OnLike

func (track *SoundTrack) OnLike(likedBy *User)

OnLike is called when the soundtrack receives a like.

func (*SoundTrack) OnRemove

func (track *SoundTrack) OnRemove(ctx aero.Context, key string, index int, obj interface{})

OnRemove saves a log entry.

func (*SoundTrack) OsuBeatmaps

func (track *SoundTrack) OsuBeatmaps() []string

OsuBeatmaps returns all osu beatmap IDs of the sound track.

func (*SoundTrack) Posts added in v1.1.25

func (obj *SoundTrack) Posts() []*Post

Posts returns a slice of all posts.

func (*SoundTrack) PostsRelevantFirst added in v1.1.25

func (obj *SoundTrack) PostsRelevantFirst(count int) []*Post

PostsRelevantFirst returns a slice of all posts sorted by relevance.

func (*SoundTrack) Publish

func (track *SoundTrack) Publish() error

Publish ...

func (*SoundTrack) RemovePost added in v1.1.25

func (obj *SoundTrack) RemovePost(postID string) bool

RemovePost removes a post from the object.

func (*SoundTrack) Save

func (track *SoundTrack) Save()

Save saves the soundtrack object in the database.

func (*SoundTrack) Self added in v1.1.17

func (track *SoundTrack) Self() Loggable

Self returns the object itself.

func (*SoundTrack) SetIsDraft added in v1.1.25

func (obj *SoundTrack) SetIsDraft(isDraft bool)

SetIsDraft sets the draft state for this object.

func (*SoundTrack) String

func (track *SoundTrack) String() string

String implements the default string serialization.

func (*SoundTrack) TitleByUser

func (track *SoundTrack) TitleByUser(user *User) string

TitleByUser returns the preferred title for the given user.

func (*SoundTrack) TypeName

func (track *SoundTrack) TypeName() string

TypeName returns the type name.

func (*SoundTrack) Unlike added in v1.1.25

func (obj *SoundTrack) Unlike(userID UserID)

Unlike makes the given user ID unlike the object.

func (*SoundTrack) Unpublish

func (track *SoundTrack) Unpublish() error

Unpublish ...

type SoundTrackLyrics

type SoundTrackLyrics struct {
	Romaji string `json:"romaji" editable:"true" type:"textarea"`
	Native string `json:"native" editable:"true" type:"textarea"`
}

SoundTrackLyrics represents song lyrics.

type SoundTrackTitle

type SoundTrackTitle struct {
	Canonical string `json:"canonical" editable:"true"`
	Native    string `json:"native" editable:"true"`
}

SoundTrackTitle represents a song title.

func (*SoundTrackTitle) ByUser

func (title *SoundTrackTitle) ByUser(user *User) string

ByUser returns the preferred title for the given user.

func (*SoundTrackTitle) String

func (title *SoundTrackTitle) String() string

String is the default representation of the title.

type Spoiler

type Spoiler struct {
	Text string `json:"text" editable:"true" type:"textarea"`
}

Spoiler represents a text that can spoil a future event.

func (*Spoiler) String

func (spoiler *Spoiler) String() string

String returns the containing text.

type StatisticsCategory

type StatisticsCategory struct {
	Name      string      `json:"name"`
	PieCharts []*PieChart `json:"pieCharts"`
}

StatisticsCategory ...

type SystemAnalytics

type SystemAnalytics struct {
	CPUCount int    `json:"cpuCount"`
	Platform string `json:"platform"`
}

SystemAnalytics stores information about the CPU and OS.

type Thread

type Thread struct {
	Title  string   `json:"title" editable:"true"`
	Sticky int      `json:"sticky" editable:"true"`
	Tags   []string `json:"tags" editable:"true"`
	Edited string   `json:"edited"`
	// contains filtered or unexported fields
}

Thread is a forum thread.

func AllThreads

func AllThreads() []*Thread

AllThreads ...

func GetThread

func GetThread(id string) (*Thread, error)

GetThread ...

func GetThreadsByTag

func GetThreadsByTag(tag string) []*Thread

GetThreadsByTag ...

func GetThreadsByUser

func GetThreadsByUser(user *User) []*Thread

GetThreadsByUser ...

func (*Thread) AddPost added in v1.1.25

func (obj *Thread) AddPost(postID string)

AddPost adds a post to the object.

func (*Thread) AfterEdit

func (thread *Thread) AfterEdit(ctx aero.Context) error

AfterEdit sets the edited date on the thread object.

func (*Thread) Authorize

func (thread *Thread) Authorize(ctx aero.Context, action string) error

Authorize returns an error if the given API POST request is not authorized.

func (*Thread) CountLikes added in v1.1.25

func (obj *Thread) CountLikes() int

CountLikes returns the number of likes the object has received.

func (*Thread) CountPosts added in v1.1.25

func (obj *Thread) CountPosts() int

CountPosts returns the number of posts written for this object.

func (*Thread) Create

func (thread *Thread) Create(ctx aero.Context) error

Create sets the data for a new thread with data we received from the API request.

func (*Thread) Creator added in v1.1.25

func (obj *Thread) Creator() *User

Creator returns the user who created this object.

func (*Thread) CreatorID added in v1.1.25

func (obj *Thread) CreatorID() UserID

CreatorID returns the ID of the user who created this object.

func (*Thread) Delete

func (thread *Thread) Delete() error

Delete deletes the thread and its posts from the database.

func (*Thread) DeleteInContext

func (thread *Thread) DeleteInContext(ctx aero.Context) error

DeleteInContext deletes the thread in the given context.

func (*Thread) Edit

func (thread *Thread) Edit(ctx aero.Context, key string, value reflect.Value, newValue reflect.Value) (consumed bool, err error)

Edit creates an edit log entry.

func (*Thread) GetCreated added in v1.1.25

func (obj *Thread) GetCreated() string

GetCreated returns the creation time of the object.

func (*Thread) GetCreatedBy added in v1.1.25

func (obj *Thread) GetCreatedBy() UserID

GetCreatedBy returns the ID of the user who created this object.

func (*Thread) GetCreatedTime added in v1.1.25

func (obj *Thread) GetCreatedTime() time.Time

GetCreatedTime returns the creation time of the object as a time struct.

func (*Thread) GetID added in v1.1.25

func (obj *Thread) GetID() string

GetID returns the ID.

func (*Thread) GetParentID

func (thread *Thread) GetParentID() string

GetParentID always returns an empty string for threads.

func (*Thread) GetText added in v1.1.25

func (obj *Thread) GetText() string

GetText returns the text of the object.

func (*Thread) HTML

func (thread *Thread) HTML() string

HTML returns the HTML representation of the thread.

func (*Thread) IsLocked added in v1.1.25

func (obj *Thread) IsLocked() bool

IsLocked implements the Lockable interface.

func (*Thread) Like added in v1.1.25

func (obj *Thread) Like(userID UserID)

Like makes the given user ID like the object.

func (*Thread) LikedBy added in v1.1.25

func (obj *Thread) LikedBy(userID UserID) bool

LikedBy checks to see if the user has liked the object.

func (thread *Thread) Link() string

Link returns the relative URL of the thread.

func (*Thread) Lock added in v1.1.25

func (obj *Thread) Lock(userID UserID)

Lock locks the object.

func (*Thread) OnAppend

func (thread *Thread) OnAppend(ctx aero.Context, key string, index int, obj interface{})

OnAppend saves a log entry.

func (*Thread) OnLike

func (thread *Thread) OnLike(likedBy *User)

OnLike is called when the thread receives a like.

func (*Thread) OnLock

func (thread *Thread) OnLock(user *User)

OnLock is called when the thread is locked.

func (*Thread) OnRemove

func (thread *Thread) OnRemove(ctx aero.Context, key string, index int, obj interface{})

OnRemove saves a log entry.

func (*Thread) OnUnlock

func (thread *Thread) OnUnlock(user *User)

OnUnlock is called when the thread is unlocked.

func (*Thread) Parent

func (thread *Thread) Parent() PostParent

Parent always returns nil for threads.

func (*Thread) Posts added in v1.1.25

func (obj *Thread) Posts() []*Post

Posts returns a slice of all posts.

func (*Thread) PostsRelevantFirst added in v1.1.25

func (obj *Thread) PostsRelevantFirst(count int) []*Post

PostsRelevantFirst returns a slice of all posts sorted by relevance.

func (*Thread) RemovePost added in v1.1.25

func (obj *Thread) RemovePost(postID string) bool

RemovePost removes a post from the object.

func (*Thread) Save

func (thread *Thread) Save()

Save saves the thread object in the database.

func (*Thread) Self added in v1.1.17

func (thread *Thread) Self() Loggable

Self returns the object itself.

func (*Thread) String

func (thread *Thread) String() string

String implements the default string serialization.

func (*Thread) TitleByUser

func (thread *Thread) TitleByUser(user *User) string

TitleByUser returns the title of the thread, regardless of the user language settings because threads are bound to one language.

func (*Thread) TypeName

func (thread *Thread) TypeName() string

TypeName returns the type name.

func (*Thread) Unlike added in v1.1.25

func (obj *Thread) Unlike(userID UserID)

Unlike makes the given user ID unlike the object.

func (*Thread) Unlock added in v1.1.25

func (obj *Thread) Unlock(userID UserID)

Unlock unlocks the object.

type TwitterToUser

type TwitterToUser GoogleToUser

TwitterToUser stores the user ID by Twitter user ID.

type UpcomingEpisode

type UpcomingEpisode struct {
	Anime   *Anime
	Episode *AnimeEpisode
}

UpcomingEpisode is used in the user schedule.

type User

type User struct {
	ID           UserID       `json:"id"`
	Nick         string       `json:"nick" editable:"true"`
	FirstName    string       `json:"firstName" private:"true"`
	LastName     string       `json:"lastName" private:"true"`
	Email        string       `json:"email" editable:"true" private:"true"`
	Role         string       `json:"role"`
	Registered   string       `json:"registered"`
	LastLogin    string       `json:"lastLogin" private:"true"`
	LastSeen     string       `json:"lastSeen" private:"true"`
	ProExpires   string       `json:"proExpires" editable:"true"`
	Gender       string       `json:"gender" editable:"true" private:"true" datalist:"genders"`
	Language     string       `json:"language"`
	Introduction string       `json:"introduction" editable:"true" type:"textarea"`
	Website      string       `json:"website" editable:"true"`
	BirthDay     string       `json:"birthDay" editable:"true" private:"true"`
	IP           string       `json:"ip" private:"true"`
	UserAgent    string       `json:"agent" private:"true"`
	Balance      int          `json:"balance" private:"true"`
	Avatar       UserAvatar   `json:"avatar"`
	Cover        UserCover    `json:"cover"`
	Accounts     UserAccounts `json:"accounts" private:"true"`
	Browser      UserBrowser  `json:"browser" private:"true"`
	OS           UserOS       `json:"os" private:"true"`
	Location     *Location    `json:"location" private:"true"`
	// contains filtered or unexported fields
}

User is a registered person.

func AllUsers

func AllUsers() ([]*User, error)

AllUsers returns a slice of all users.

func FilterUsers

func FilterUsers(filter func(*User) bool) []*User

FilterUsers filters all users by a custom function.

func GetUser

func GetUser(id UserID) (*User, error)

GetUser fetches the user with the given ID from the database.

func GetUserByEmail

func GetUserByEmail(email string) (*User, error)

GetUserByEmail fetches the user with the given email from the database.

func GetUserByFacebookID

func GetUserByFacebookID(facebookID string) (*User, error)

GetUserByFacebookID fetches the user with the given Facebook ID from the database.

func GetUserByGoogleID

func GetUserByGoogleID(googleID string) (*User, error)

GetUserByGoogleID fetches the user with the given Google ID from the database.

func GetUserByNick

func GetUserByNick(nick string) (*User, error)

GetUserByNick fetches the user with the given nick from the database.

func GetUserByTwitterID

func GetUserByTwitterID(twitterID string) (*User, error)

GetUserByTwitterID fetches the user with the given Twitter ID from the database.

func GetUserFromContext

func GetUserFromContext(ctx aero.Context) *User

GetUserFromContext returns the logged in user for the given context.

func NewUser

func NewUser() *User

NewUser creates an empty user object with a unique ID.

func (*User) ActivateItemEffect

func (user *User) ActivateItemEffect(itemID string) error

ActivateItemEffect activates an item in the user inventory by the given item ID.

func (*User) AddEventStream

func (user *User) AddEventStream(stream *aero.EventStream)

AddEventStream adds an event stream to the given user.

func (*User) AddPost added in v1.1.25

func (obj *User) AddPost(postID string)

AddPost adds a post to the object.

func (*User) AgeInYears

func (user *User) AgeInYears() int

AgeInYears returns the user's age in years.

func (*User) Analytics

func (user *User) Analytics() *Analytics

Analytics ...

func (*User) AnimeList

func (user *User) AnimeList() *AnimeList

AnimeList ...

func (*User) Authorize

func (user *User) Authorize(ctx aero.Context, action string) error

Authorize returns an error if the given API POST request is not authorized.

func (user *User) AvatarLink(size string) string

AvatarLink returns the URL to the user avatar. Expects "small" (50 x 50) or "large" (560 x 560) for the size parameter.

func (*User) BroadcastEvent

func (user *User) BroadcastEvent(event *aero.Event)

BroadcastEvent sends the given event to all event streams for the given user.

func (*User) CleanNick

func (user *User) CleanNick() string

CleanNick only returns the nickname if it was set by user, otherwise empty string.

func (*User) ConnectFacebook

func (user *User) ConnectFacebook(facebookID string)

ConnectFacebook connects the user's account with a Facebook account.

func (*User) ConnectGoogle

func (user *User) ConnectGoogle(googleID string)

ConnectGoogle connects the user's account with a Google account.

func (*User) ConnectTwitter

func (user *User) ConnectTwitter(twtterID string)

ConnectTwitter connects the user's account with a Twitter account.

func (*User) CountPosts added in v1.1.25

func (obj *User) CountPosts() int

CountPosts returns the number of posts written for this object.

func (user *User) CoverLink(size string) string

CoverLink ...

func (*User) Creator

func (user *User) Creator() *User

Creator needs to be implemented for the PostParent interface.

func (*User) CreatorID

func (user *User) CreatorID() UserID

CreatorID needs to be implemented for the PostParent interface.

func (*User) DraftIndex

func (user *User) DraftIndex() *DraftIndex

DraftIndex ...

func (*User) Edit

func (user *User) Edit(ctx aero.Context, key string, value reflect.Value, newValue reflect.Value) (bool, error)

Edit updates the user object.

func (*User) EditorScore

func (user *User) EditorScore() int

EditorScore returns the editor score.

func (*User) ExtendProDuration

func (user *User) ExtendProDuration(duration time.Duration)

ExtendProDuration extends the PRO account duration by the given duration.

func (*User) Filter

func (user *User) Filter()

Filter removes privacy critical fields from the user object.

func (*User) Followers

func (user *User) Followers() []*User

Followers ...

func (*User) FollowersCount

func (user *User) FollowersCount() int

FollowersCount ...

func (*User) Follows

func (user *User) Follows() *UserFollows

Follows returns the list of user follows.

func (*User) ForceSetNick

func (user *User) ForceSetNick(newName string)

ForceSetNick forces a nickname overwrite.

func (*User) GetID added in v1.1.25

func (user *User) GetID() string

GetID returns the ID.

func (*User) Gravatar

func (user *User) Gravatar() string

Gravatar returns the URL to the gravatar if an email has been registered.

func (*User) HasAvatar

func (user *User) HasAvatar() bool

HasAvatar tells you whether the user has an avatar or not.

func (*User) HasBasicInfo

func (user *User) HasBasicInfo() bool

HasBasicInfo returns true if the user has a username, an avatar and an introduction.

func (*User) HasNick

func (user *User) HasNick() bool

HasNick returns whether the user has a custom nickname.

func (*User) Inventory

func (user *User) Inventory() *Inventory

Inventory ...

func (*User) IsActive

func (user *User) IsActive() bool

IsActive tells you whether the user is active.

func (*User) IsPro

func (user *User) IsPro() bool

IsPro returns whether the user is a PRO user or not.

func (*User) LastActivityConsumeAnime

func (user *User) LastActivityConsumeAnime(animeID string) *ActivityConsumeAnime

LastActivityConsumeAnime returns the last activity for the given anime.

func (*User) LastSeenTime

func (user *User) LastSeenTime() time.Time

LastSeenTime returns the time the user was last seen on the site.

func (user *User) Link() string

Link returns the URI to the user page.

func (*User) Notifications

func (user *User) Notifications() *UserNotifications

Notifications returns the list of user notifications.

func (*User) Posts added in v1.1.25

func (obj *User) Posts() []*Post

Posts returns a slice of all posts.

func (*User) PostsRelevantFirst added in v1.1.25

func (obj *User) PostsRelevantFirst(count int) []*Post

PostsRelevantFirst returns a slice of all posts sorted by relevance.

func (*User) PushSubscriptions

func (user *User) PushSubscriptions() *PushSubscriptions

PushSubscriptions ...

func (*User) RealName

func (user *User) RealName() string

RealName returns the real name of the user.

func (*User) RefreshFFXIVInfo

func (user *User) RefreshFFXIVInfo() error

RefreshFFXIVInfo refreshes a user's FFXIV information.

func (*User) RefreshOsuInfo

func (user *User) RefreshOsuInfo() error

RefreshOsuInfo refreshes a user's Osu information.

func (*User) RefreshOverwatchInfo

func (user *User) RefreshOverwatchInfo() error

RefreshOverwatchInfo refreshes a user's Overwatch information.

func (*User) RegisteredTime

func (user *User) RegisteredTime() time.Time

RegisteredTime returns the time the user registered his account.

func (*User) RemoveEventStream

func (user *User) RemoveEventStream(stream *aero.EventStream) bool

RemoveEventStream removes an event stream from the given user and returns true if it was removed, otherwise false.

func (*User) RemovePost added in v1.1.25

func (obj *User) RemovePost(postID string) bool

RemovePost removes a post from the object.

func (*User) Save

func (user *User) Save()

Save saves the user object in the database.

func (*User) Self added in v1.1.17

func (user *User) Self() Loggable

Self returns the object itself.

func (*User) SendNotification

func (user *User) SendNotification(pushNotification *PushNotification)

SendNotification accepts a PushNotification and generates a new Notification object. The notification is then sent to all registered push devices.

func (*User) SetAvatar

func (user *User) SetAvatar(avatar *imageserver.MetaImage) error

SetAvatar sets the avatar to the given MetaImage.

func (*User) SetAvatarBytes

func (user *User) SetAvatarBytes(data []byte) error

SetAvatarBytes accepts a byte buffer that represents an image file and updates the avatar.

func (*User) SetCover

func (user *User) SetCover(cover *imageserver.MetaImage) error

SetCover sets the cover image to the given MetaImage.

func (*User) SetCoverBytes

func (user *User) SetCoverBytes(data []byte) error

SetCoverBytes accepts a byte buffer that represents an image file and updates the cover image.

func (*User) SetEmail

func (user *User) SetEmail(newEmail string) error

SetEmail changes the user's email safely.

func (*User) SetNick

func (user *User) SetNick(newName string) error

SetNick changes the user's nickname safely.

func (*User) Settings

func (user *User) Settings() *Settings

Settings ...

func (*User) ShouldFilter

func (user *User) ShouldFilter(ctx aero.Context) bool

ShouldFilter tells whether data needs to be filtered in the given context.

func (*User) SoundTracks

func (user *User) SoundTracks() []*SoundTrack

SoundTracks returns the soundtracks posted by the user.

func (*User) Threads

func (user *User) Threads() []*Thread

Threads ...

func (*User) TimeSinceRegistered

func (user *User) TimeSinceRegistered() time.Duration

TimeSinceRegistered returns the duration since the user registered his account.

func (*User) TitleByUser

func (user *User) TitleByUser(viewUser *User) string

TitleByUser returns the username.

func (*User) TypeName

func (user *User) TypeName() string

TypeName returns the type name.

func (*User) WebsiteShortURL

func (user *User) WebsiteShortURL() string

WebsiteShortURL returns the user website without the protocol.

func (*User) WebsiteURL

func (user *User) WebsiteURL() string

WebsiteURL adds https:// to the URL.

type UserAccounts

type UserAccounts struct {
	Facebook struct {
		ID string `json:"id" private:"true"`
	} `json:"facebook"`

	Google struct {
		ID string `json:"id" private:"true"`
	} `json:"google"`

	Twitter struct {
		ID   string `json:"id" private:"true"`
		Nick string `json:"nick" private:"true"`
	} `json:"twitter"`

	Discord struct {
		Nick     string `json:"nick" editable:"true"`
		Verified bool   `json:"verified"`
	} `json:"discord"`

	Osu struct {
		Nick     string  `json:"nick" editable:"true"`
		PP       float64 `json:"pp"`
		Accuracy float64 `json:"accuracy"`
		Level    float64 `json:"level"`
	} `json:"osu"`

	Overwatch struct {
		BattleTag   string `json:"battleTag" editable:"true"`
		SkillRating int    `json:"skillRating"`
		Tier        string `json:"tier"`
	} `json:"overwatch"`

	FinalFantasyXIV struct {
		Nick      string `json:"nick" editable:"true"`
		Server    string `json:"server" editable:"true" datalist:"ffxiv-servers"`
		Class     string `json:"class"`
		Level     int    `json:"level"`
		ItemLevel int    `json:"itemLevel"`
	} `json:"ffxiv"`

	AniList struct {
		Nick string `json:"nick" editable:"true"`
	} `json:"anilist"`

	AnimePlanet struct {
		Nick string `json:"nick" editable:"true"`
	} `json:"animeplanet"`

	MyAnimeList struct {
		Nick string `json:"nick" editable:"true"`
	} `json:"myanimelist"`

	Kitsu struct {
		Nick string `json:"nick" editable:"true"`
	} `json:"kitsu"`
}

UserAccounts represents a user's accounts on external services.

type UserAvatar

type UserAvatar struct {
	Extension    string `json:"extension"`
	Source       string `json:"source"`
	LastModified int64  `json:"lastModified"`
}

UserAvatar ...

type UserBrowser

type UserBrowser struct {
	Name     string `json:"name" private:"true"`
	Version  string `json:"version" private:"true"`
	IsMobile bool   `json:"isMobile" private:"true"`
}

UserBrowser ...

type UserCover

type UserCover struct {
	Extension    string `json:"extension"`
	LastModified int64  `json:"lastModified"`
}

UserCover ...

type UserFollows

type UserFollows struct {
	UserID UserID   `json:"userId"`
	Items  []string `json:"items"`
}

UserFollows is a list including IDs to users you follow.

func AllUserFollows

func AllUserFollows() ([]*UserFollows, error)

AllUserFollows returns a slice of all user follows.

func GetUserFollows

func GetUserFollows(id UserID) (*UserFollows, error)

GetUserFollows ...

func NewUserFollows

func NewUserFollows(userID UserID) *UserFollows

NewUserFollows creates a new UserFollows list.

func (*UserFollows) Add

func (list *UserFollows) Add(userID UserID) error

Add adds an user to the list if it hasn't been added yet.

func (*UserFollows) Authorize

func (list *UserFollows) Authorize(ctx aero.Context, action string) error

Authorize returns an error if the given API request is not authorized.

func (*UserFollows) Contains

func (list *UserFollows) Contains(userID UserID) bool

Contains checks if the list contains the user ID already.

func (*UserFollows) Remove

func (list *UserFollows) Remove(userID UserID) bool

Remove removes the user ID from the list.

func (*UserFollows) Save

func (list *UserFollows) Save()

Save saves the follow list in the database.

func (*UserFollows) Users

func (list *UserFollows) Users() []*User

Users returns a slice of all the users you are following.

func (*UserFollows) UsersWhoFollowBack

func (list *UserFollows) UsersWhoFollowBack() []*User

UsersWhoFollowBack returns a slice of all the users you are following that also follow you.

type UserID added in v1.1.25

type UserID = string

UserID represents a user ID.

type UserListProviders

type UserListProviders struct {
	AniList     ListProviderConfig `json:"AniList"`
	AnimePlanet ListProviderConfig `json:"AnimePlanet"`
	HummingBird ListProviderConfig `json:"HummingBird"`
	MyAnimeList ListProviderConfig `json:"MyAnimeList"`
}

UserListProviders ...

type UserNotifications

type UserNotifications struct {
	UserID UserID   `json:"userId"`
	Items  []string `json:"items"`
}

UserNotifications is a list including IDs to your notifications.

func AllUserNotifications

func AllUserNotifications() ([]*UserNotifications, error)

AllUserNotifications returns a slice of all user notifications.

func GetUserNotifications

func GetUserNotifications(id UserID) (*UserNotifications, error)

GetUserNotifications ...

func NewUserNotifications

func NewUserNotifications(userID UserID) *UserNotifications

NewUserNotifications creates a new UserNotifications list.

func (*UserNotifications) Add

func (list *UserNotifications) Add(notificationID string) error

Add adds an user to the list if it hasn't been added yet.

func (*UserNotifications) Contains

func (list *UserNotifications) Contains(notificationID string) bool

Contains checks if the list contains the notification ID already.

func (*UserNotifications) CountUnseen

func (list *UserNotifications) CountUnseen() int

CountUnseen returns the number of unseen notifications.

func (*UserNotifications) Notifications

func (list *UserNotifications) Notifications() []*Notification

Notifications returns a slice of all the notifications.

func (*UserNotifications) Remove

func (list *UserNotifications) Remove(notificationID string) bool

Remove removes the notification ID from the list.

func (*UserNotifications) Save

func (list *UserNotifications) Save()

Save saves the notification list in the database.

type UserOS

type UserOS struct {
	Name    string `json:"name" private:"true"`
	Version string `json:"version" private:"true"`
}

UserOS ...

Source Files

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL