Documentation
¶
Index ¶
- Constants
- Variables
- func BadRequest(message string) error
- func EmptySlice() []int
- func Forbidden(message string) error
- func FromError(c *fiber.Ctx, err error, code int, message string) error
- func GroupIcon(base string) string
- func InternalError(c *fiber.Ctx, err error, message string) error
- func JSON(c *fiber.Ctx, v any) error
- func JSONError(c *fiber.Ctx, err error) error
- func NewError(code int, message string) error
- func NotFound(message string) error
- func Unauthorized(message string) error
- type Actor
- type Avatar
- type CharacterRelatedPerson
- type CharacterRelatedSubject
- type CharacterRevision
- type CharacterRevisionDataItem
- type CharacterV0
- type Count
- type Creator
- type Episode
- type Error
- type Extra
- type HTTPError
- type Index
- type IndexSubjectV0
- type LoginRemain
- type Paged
- type PagedG
- type PersonImages
- type PersonRelatedCharacter
- type PersonRelatedSubject
- type PersonRevision
- type PersonRevisionDataItem
- type PersonV0
- type PrivateComment
- type PrivateComments
- type PrivateGroup
- type PrivateGroupMember
- type PrivateGroupProfile
- type PrivateSubComment
- type PrivateTopic
- type PrivateTopicDetail
- type Profession
- type Rating
- type SlimSubjectV0
- type Stat
- type SubjectCollection
- type SubjectCollectionStat
- type SubjectImages
- type SubjectRelatedCharacter
- type SubjectRelatedPerson
- type SubjectRelatedSubject
- type SubjectRevision
- type SubjectRevisionData
- type SubjectTag
- type SubjectV0
- type User
Constants ¶
View Source
const (
DefaultImageURL = "https://lain.bgm.tv/img/no_icon_subject.png"
)
Variables ¶
View Source
var ErrNotFound = NewError(http.StatusNotFound, "resource can't be found in the database or has been removed")
View Source
var GenderMap = map[uint8]string{
1: "male",
2: "female",
}
Functions ¶
func BadRequest ¶ added in v0.20.4
func EmptySlice ¶ added in v0.20.9
func EmptySlice() []int
func InternalError ¶
func Unauthorized ¶ added in v0.20.4
Types ¶
type Avatar ¶
type Avatar struct { Large string `json:"large"` Medium string `json:"medium"` Small string `json:"small"` }
func UserAvatar ¶ added in v0.20.4
type CharacterRelatedPerson ¶
type CharacterRelatedSubject ¶
type CharacterRevision ¶
type CharacterV0 ¶
type CharacterV0 struct { BirthMon *uint8 `json:"birth_mon"` Gender *string `json:"gender"` BirthDay *uint8 `json:"birth_day"` BirthYear *uint16 `json:"birth_year"` BloodType *uint8 `json:"blood_type"` Images PersonImages `json:"images"` Summary string `json:"summary"` Name string `json:"name"` Infobox v0wiki `json:"infobox"` Stat Stat `json:"stat"` ID model.CharacterID `json:"id"` Redirect model.CharacterID `json:"-"` Locked bool `json:"locked"` Type uint8 `json:"type"` NSFW bool `json:"nsfw"` }
type Episode ¶
type Episode struct { Airdate string `json:"airdate"` Name string `json:"name"` NameCN string `json:"name_cn"` Duration string `json:"duration"` Description string `json:"desc"` Ep float32 `json:"ep"` Sort float32 `json:"sort"` ID model.EpisodeID `json:"id"` SubjectID model.SubjectID `json:"subject_id"` Comment uint32 `json:"comment"` Type model.EpType `json:"type"` Disc uint8 `json:"disc"` DurationSeconds int `json:"duration_seconds"` }
func ConvertModelEpisode ¶ added in v0.22.4
type Error ¶
type Error struct { Title string `json:"title"` Details any `json:"details,omitempty"` Description string `json:"description"` }
Error default error response.
type Index ¶
type Index struct { CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` Creator Creator `json:"creator"` Title string `json:"title"` Description string `json:"desc"` Total uint32 `json:"total"` ID model.IndexID `json:"id"` Stat Stat `json:"stat"` Ban bool `json:"ban"` NSFW bool `json:"nsfw" doc:"if index contains any nsfw subjects"` }
type IndexSubjectV0 ¶ added in v0.21.4
type IndexSubjectV0 struct { AddedAt time.Time `json:"added_at"` Date *string `json:"date"` Image SubjectImages `json:"images"` Name string `json:"name"` NameCN string `json:"name_cn"` Comment string `json:"comment"` Infobox v0wiki `json:"infobox"` ID model.SubjectID `json:"id"` TypeID model.SubjectType `json:"type"` }
type LoginRemain ¶
type LoginRemain struct {
Remain int `json:"remain"`
}
type PersonImages ¶
type PersonImages struct { Small string `json:"small"` Grid string `json:"grid"` Large string `json:"large"` Medium string `json:"medium"` }
func PersonImage ¶
func PersonImage(s string) PersonImages
type PersonRelatedCharacter ¶
type PersonRelatedCharacter struct { Images PersonImages `json:"images"` Name string `json:"name"` SubjectName string `json:"subject_name"` SubjectNameCn string `json:"subject_name_cn"` SubjectID model.SubjectID `json:"subject_id"` ID model.CharacterID `json:"id"` Type uint8 `json:"type" doc:"character type"` }
type PersonRelatedSubject ¶
type PersonRevision ¶
type PersonRevisionDataItem ¶
type PersonRevisionDataItem struct { InfoBox string `json:"prsn_infobox"` Summary string `json:"prsn_summary"` Profession Profession `json:"profession"` Extra Extra `json:"extra"` Name string `json:"prsn_name"` }
type PersonV0 ¶
type PersonV0 struct { LastModified time.Time `json:"last_modified"` BloodType *uint8 `json:"blood_type"` BirthYear *uint16 `json:"birth_year"` BirthDay *uint8 `json:"birth_day"` BirthMon *uint8 `json:"birth_mon"` Gender *string `json:"gender"` Images PersonImages `json:"images"` Summary string `json:"summary"` Name string `json:"name"` Img string `json:"img"` Infobox v0wiki `json:"infobox"` Career []string `json:"career"` Stat Stat `json:"stat"` Redirect model.PersonID `json:"-"` ID model.PersonID `json:"id"` Locked bool `json:"locked"` Type uint8 `json:"type"` }
func ConvertModelPerson ¶ added in v0.22.2
type PrivateComment ¶ added in v0.23.0
type PrivateComment struct { CreatedAt time.Time `json:"created_at"` Text string `json:"text"` Creator User `json:"creator"` Replies []PrivateSubComment `json:"replies"` ID model.CommentID `json:"id"` IsFriend bool `json:"is_friend"` State model.CommentState `json:"state"` }
type PrivateComments ¶ added in v0.23.0
type PrivateComments struct {
Comments []PrivateComment `json:"comments"`
}
type PrivateGroup ¶ added in v0.24.1
type PrivateGroupMember ¶ added in v0.20.9
type PrivateGroupProfile ¶ added in v0.20.9
type PrivateGroupProfile struct { CreatedAt time.Time `json:"created_at"` Name string `json:"name"` Title string `json:"title"` Description string `json:"description" format:"bbcode"` Icon string `json:"icon" format:"url"` NewMembers []PrivateGroupMember `json:"new_members"` TotalMembers int64 `json:"total_members"` ID model.GroupID `json:"id"` }
type PrivateSubComment ¶ added in v0.23.0
type PrivateTopic ¶ added in v0.23.0
type PrivateTopicDetail ¶ added in v0.23.0
type PrivateTopicDetail struct { ParentID uint32 `json:"parent_id"` // episode ID, subject ID, group ID ... CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` Title string `json:"title"` Creator User `json:"creator"` Text string `json:"text"` Comments []PrivateComment `json:"comments"` ID model.TopicID `json:"id"` IsFriend bool `json:"is_friend"` State model.CommentState `json:"state"` }
type Profession ¶
type Profession struct { Writer string `json:"writer,omitempty"` Producer string `json:"producer,omitempty"` Mangaka string `json:"mangaka,omitempty"` Artist string `json:"artist,omitempty"` Seiyu string `json:"seiyu,omitempty"` Illustrator string `json:"illustrator,omitempty"` Actor string `json:"actor,omitempty"` }
type SlimSubjectV0 ¶
type SlimSubjectV0 struct { Date *string `json:"date"` Image SubjectImages `json:"images"` Name string `json:"name"` NameCN string `json:"name_cn"` ShortSummary string `json:"short_summary"` Tags []SubjectTag `json:"tags"` Score float64 `json:"score"` Type model.SubjectType `json:"type"` ID model.SubjectID `json:"id"` Eps uint32 `json:"eps"` Volumes uint32 `json:"volumes"` CollectionTotal uint32 `json:"collection_total"` Rank uint32 `json:"rank"` }
func ToSlimSubjectV0 ¶ added in v0.21.4
func ToSlimSubjectV0(s model.Subject) SlimSubjectV0
type SubjectCollection ¶ added in v0.20.9
type SubjectCollection struct { UpdatedAt time.Time `json:"updated_at"` Comment *string `json:"comment"` Tags []string `json:"tags"` Subject SlimSubjectV0 `json:"subject"` SubjectID model.SubjectID `json:"subject_id"` VolStatus uint32 `json:"vol_status"` EpStatus uint32 `json:"ep_status"` SubjectType uint8 `json:"subject_type"` Type model.SubjectCollection `json:"type"` Rate uint8 `json:"rate"` Private bool `json:"private"` }
func ConvertModelSubjectCollection ¶ added in v0.22.2
func ConvertModelSubjectCollection(c model.UserSubjectCollection, subject SlimSubjectV0) SubjectCollection
type SubjectCollectionStat ¶
type SubjectCollectionStat struct { OnHold uint32 `json:"on_hold"` Dropped uint32 `json:"dropped"` Wish uint32 `json:"wish"` Collect uint32 `json:"collect"` Doing uint32 `json:"doing"` }
func (SubjectCollectionStat) Sum ¶ added in v0.21.5
func (s SubjectCollectionStat) Sum() uint32
type SubjectImages ¶
type SubjectImages struct { Small string `json:"small"` Grid string `json:"grid"` Large string `json:"large"` Medium string `json:"medium"` Common string `json:"common"` }
func SubjectImage ¶
func SubjectImage(s string) SubjectImages
type SubjectRelatedCharacter ¶
type SubjectRelatedCharacter struct { Images PersonImages `json:"images"` Name string `json:"name"` Relation string `json:"relation"` Actors []Actor `json:"actors"` Type uint8 `json:"type"` ID model.CharacterID `json:"id"` }
type SubjectRelatedPerson ¶
type SubjectRelatedSubject ¶
type SubjectRelatedSubject struct { Images SubjectImages `json:"images"` Name string `json:"name"` NameCn string `json:"name_cn"` Relation string `json:"relation"` Type model.SubjectType `json:"type"` SubjectID model.SubjectID `json:"id"` }
type SubjectRevision ¶
type SubjectRevisionData ¶
type SubjectRevisionData struct { Name string `json:"name"` NameCN string `json:"name_cn"` VoteField string `json:"vote_field"` FieldInfobox string `json:"field_infobox"` FieldSummary string `json:"field_summary"` Platform uint16 `json:"platform"` TypeID uint16 `json:"type_id"` SubjectID model.SubjectID `json:"subject_id"` FieldEps uint32 `json:"field_eps"` Type uint8 `json:"type"` }
type SubjectTag ¶ added in v0.21.1
type SubjectV0 ¶
type SubjectV0 struct { Date *string `json:"date"` Platform *string `json:"platform"` Image SubjectImages `json:"images"` Summary string `json:"summary"` Name string `json:"name"` NameCN string `json:"name_cn"` Tags []SubjectTag `json:"tags"` Infobox v0wiki `json:"infobox"` Rating Rating `json:"rating"` TotalEpisodes int64 `json:"total_episodes"` Collection SubjectCollectionStat `json:"collection"` ID model.SubjectID `json:"id"` Eps uint32 `json:"eps"` Volumes uint32 `json:"volumes"` Redirect model.SubjectID `json:"-"` Locked bool `json:"locked"` NSFW bool `json:"nsfw"` TypeID model.SubjectType `json:"type"` }
Click to show internal directories.
Click to hide internal directories.