Files
go_vndb/entities.go
2026-05-07 19:34:48 +08:00

364 lines
13 KiB
Go

package govndb
// User represents the GET /user payload for a resolved account.
type User struct {
ID string `json:"id"`
Username string `json:"username"`
LengthVotes *int `json:"lengthvotes,omitempty"`
LengthVotesSum *int `json:"lengthvotes_sum,omitempty"`
}
// VN models a visual novel returned by POST /vn or nested VN fields.
type VN struct {
ID string `json:"id"`
Title string `json:"title"`
AltTitle *string `json:"alttitle"`
Titles []VNTitle `json:"titles,omitempty"`
Aliases []string `json:"aliases,omitempty"`
OriginalLang string `json:"olang,omitempty"`
DevStatus *int `json:"devstatus,omitempty"`
Released *string `json:"released,omitempty"`
Languages []string `json:"languages,omitempty"`
Platforms []string `json:"platforms,omitempty"`
Image *Image `json:"image,omitempty"`
Length *int `json:"length,omitempty"`
LengthMinutes *int `json:"length_minutes,omitempty"`
LengthVotes *int `json:"length_votes,omitempty"`
Description *string `json:"description,omitempty"`
Average *float64 `json:"average,omitempty"`
Rating *float64 `json:"rating,omitempty"`
VoteCount *int `json:"votecount,omitempty"`
Screenshots []Screenshot `json:"screenshots,omitempty"`
Relations []VNRelation `json:"relations,omitempty"`
Tags []VNTag `json:"tags,omitempty"`
Developers []Producer `json:"developers,omitempty"`
Editions []VNEdition `json:"editions,omitempty"`
Staff []VNStaff `json:"staff,omitempty"`
VoiceActors []VoiceActor `json:"va,omitempty"`
ExtLinks []ExternalLink `json:"extlinks,omitempty"`
}
type VNTitle struct {
Lang string `json:"lang"`
Title string `json:"title"`
Latin *string `json:"latin,omitempty"`
Official bool `json:"official"`
Main bool `json:"main"`
}
type Image struct {
ID string `json:"id"`
URL string `json:"url"`
Dims *Dims `json:"dims,omitempty"`
Sexual *float64 `json:"sexual,omitempty"`
Violence *float64 `json:"violence,omitempty"`
VoteCount *int `json:"votecount,omitempty"`
Thumbnail *string `json:"thumbnail,omitempty"`
ThumbnailDims *Dims `json:"thumbnail_dims,omitempty"`
}
type Screenshot struct {
Image
Release *Release `json:"release,omitempty"`
}
type Dims [2]int
type VNRelation struct {
ID string `json:"id"`
Relation string `json:"relation"`
RelationOfficial bool `json:"relation_official"`
Title string `json:"title,omitempty"`
AltTitle *string `json:"alttitle,omitempty"`
OriginalLang string `json:"olang,omitempty"`
Released *string `json:"released,omitempty"`
Languages []string `json:"languages,omitempty"`
Platforms []string `json:"platforms,omitempty"`
}
type VNTag struct {
ID string `json:"id"`
Name string `json:"name,omitempty"`
Aliases []string `json:"aliases,omitempty"`
Description *string `json:"description,omitempty"`
Category string `json:"category,omitempty"`
Searchable *bool `json:"searchable,omitempty"`
Applicable *bool `json:"applicable,omitempty"`
VNCount *int `json:"vn_count,omitempty"`
Rating *float64 `json:"rating,omitempty"`
Spoiler *int `json:"spoiler,omitempty"`
Lie *bool `json:"lie,omitempty"`
}
type VNEdition struct {
EditionID *int `json:"eid,omitempty"`
Lang *string `json:"lang,omitempty"`
Name string `json:"name"`
Official bool `json:"official"`
}
type VNStaff struct {
EditionID *int `json:"eid,omitempty"`
Role string `json:"role"`
Note *string `json:"note,omitempty"`
Staff
}
type VoiceActor struct {
Note *string `json:"note,omitempty"`
Staff *Staff `json:"staff,omitempty"`
Character *Character `json:"character,omitempty"`
}
// Release models a release returned by POST /release or nested release fields.
type Release struct {
ID string `json:"id"`
Title string `json:"title"`
AltTitle *string `json:"alttitle,omitempty"`
Languages []ReleaseLanguage `json:"languages,omitempty"`
Platforms []string `json:"platforms,omitempty"`
Media []ReleaseMedia `json:"media,omitempty"`
VNs []ReleaseVN `json:"vns,omitempty"`
Producers []ReleaseProducer `json:"producers,omitempty"`
Images []ReleaseImage `json:"images,omitempty"`
Released *string `json:"released,omitempty"`
MinAge *int `json:"minage,omitempty"`
Patch *bool `json:"patch,omitempty"`
Freeware *bool `json:"freeware,omitempty"`
Uncensored *bool `json:"uncensored,omitempty"`
Official *bool `json:"official,omitempty"`
HasEro *bool `json:"has_ero,omitempty"`
Resolution *Resolution `json:"resolution,omitempty"`
Engine *string `json:"engine,omitempty"`
Voiced *int `json:"voiced,omitempty"`
Notes *string `json:"notes,omitempty"`
GTIN *string `json:"gtin,omitempty"`
Catalog *string `json:"catalog,omitempty"`
ExtLinks []ExternalLink `json:"extlinks,omitempty"`
}
type ReleaseLanguage struct {
Lang string `json:"lang"`
Title *string `json:"title,omitempty"`
Latin *string `json:"latin,omitempty"`
MTL bool `json:"mtl"`
Main bool `json:"main"`
}
type ReleaseMedia struct {
Medium string `json:"medium"`
Qty int `json:"qty"`
}
type ReleaseVN struct {
ID string `json:"id"`
ReleaseType *string `json:"rtype,omitempty"`
Title string `json:"title,omitempty"`
AltTitle *string `json:"alttitle,omitempty"`
Released *string `json:"released,omitempty"`
Image *Image `json:"image,omitempty"`
Languages []string `json:"languages,omitempty"`
Platforms []string `json:"platforms,omitempty"`
}
type ReleaseProducer struct {
Developer bool `json:"developer"`
Publisher bool `json:"publisher"`
Producer
}
type ReleaseImage struct {
Image
Type string `json:"type"`
VN *string `json:"vn,omitempty"`
Languages []string `json:"languages,omitempty"`
Photo bool `json:"photo"`
}
type Producer struct {
ID string `json:"id"`
Name string `json:"name"`
Original *string `json:"original,omitempty"`
Aliases []string `json:"aliases,omitempty"`
Lang *string `json:"lang,omitempty"`
Type *string `json:"type,omitempty"`
Description *string `json:"description,omitempty"`
ExtLinks []ExternalLink `json:"extlinks,omitempty"`
}
// Character models a character returned by POST /character or nested character fields.
type Character struct {
ID string `json:"id"`
Name string `json:"name"`
Original *string `json:"original,omitempty"`
Aliases []string `json:"aliases,omitempty"`
Description *string `json:"description,omitempty"`
Image *CharacterImage `json:"image,omitempty"`
BloodType *string `json:"blood_type,omitempty"`
Height *int `json:"height,omitempty"`
Weight *int `json:"weight,omitempty"`
Bust *int `json:"bust,omitempty"`
Waist *int `json:"waist,omitempty"`
Hips *int `json:"hips,omitempty"`
Cup *string `json:"cup,omitempty"`
Age *int `json:"age,omitempty"`
Birthday *MonthDay `json:"birthday,omitempty"`
Sex *SexInfo `json:"sex,omitempty"`
Gender *GenderInfo `json:"gender,omitempty"`
VNs []CharacterVN `json:"vns,omitempty"`
Traits []CharacterTrait `json:"traits,omitempty"`
}
type CharacterImage struct {
ID string `json:"id"`
URL string `json:"url"`
Dims *Dims `json:"dims,omitempty"`
Sexual *float64 `json:"sexual,omitempty"`
Violence *float64 `json:"violence,omitempty"`
VoteCount *int `json:"votecount,omitempty"`
}
type MonthDay [2]int
type SexInfo [2]string
type GenderInfo [2]string
type CharacterVN struct {
Spoiler *int `json:"spoiler,omitempty"`
Role *string `json:"role,omitempty"`
VN
Release *Release `json:"release,omitempty"`
}
type CharacterTrait struct {
ID string `json:"id"`
Name string `json:"name,omitempty"`
Aliases []string `json:"aliases,omitempty"`
Description *string `json:"description,omitempty"`
Searchable *bool `json:"searchable,omitempty"`
Applicable *bool `json:"applicable,omitempty"`
Sexual *bool `json:"sexual,omitempty"`
GroupID *string `json:"group_id,omitempty"`
GroupName *string `json:"group_name,omitempty"`
CharCount *int `json:"char_count,omitempty"`
Spoiler *int `json:"spoiler,omitempty"`
Lie *bool `json:"lie,omitempty"`
}
type Tag struct {
ID string `json:"id"`
Name string `json:"name"`
Aliases []string `json:"aliases,omitempty"`
Description *string `json:"description,omitempty"`
Category *string `json:"category,omitempty"`
Searchable *bool `json:"searchable,omitempty"`
Applicable *bool `json:"applicable,omitempty"`
VNCount *int `json:"vn_count,omitempty"`
}
// Trait models a trait returned by POST /trait.
type Trait struct {
ID string `json:"id"`
Name string `json:"name"`
Aliases []string `json:"aliases,omitempty"`
Description *string `json:"description,omitempty"`
Searchable *bool `json:"searchable,omitempty"`
Applicable *bool `json:"applicable,omitempty"`
Sexual *bool `json:"sexual,omitempty"`
GroupID *string `json:"group_id,omitempty"`
GroupName *string `json:"group_name,omitempty"`
CharCount *int `json:"char_count,omitempty"`
}
// Quote models a quote returned by POST /quote.
type Quote struct {
ID string `json:"id"`
Quote string `json:"quote"`
Score int `json:"score"`
VN *VN `json:"vn,omitempty"`
Character *Character `json:"character,omitempty"`
}
// Staff models a staff entry returned by POST /staff or nested staff fields.
type Staff struct {
ID string `json:"id"`
AliasID *int `json:"aid,omitempty"`
IsMain *bool `json:"ismain,omitempty"`
Name string `json:"name"`
Original *string `json:"original,omitempty"`
Lang *string `json:"lang,omitempty"`
Gender *string `json:"gender,omitempty"`
Description *string `json:"description,omitempty"`
ExtLinks []ExternalLink `json:"extlinks,omitempty"`
Aliases []StaffAlias `json:"aliases,omitempty"`
}
type StaffAlias struct {
AliasID *int `json:"aid,omitempty"`
Name string `json:"name"`
Latin *string `json:"latin,omitempty"`
IsMain bool `json:"ismain"`
}
type ExternalLink struct {
URL string `json:"url"`
Label string `json:"label,omitempty"`
Name string `json:"name,omitempty"`
ID *Scalar `json:"id,omitempty"`
}
// UListEntry models a user list entry returned by POST /ulist.
type UListEntry struct {
ID string `json:"id"`
Added *int64 `json:"added,omitempty"`
Voted *int64 `json:"voted,omitempty"`
LastMod *int64 `json:"lastmod,omitempty"`
Vote *int `json:"vote,omitempty"`
Started *string `json:"started,omitempty"`
Finished *string `json:"finished,omitempty"`
Notes *string `json:"notes,omitempty"`
Labels []UserLabel `json:"labels,omitempty"`
VN *VN `json:"vn,omitempty"`
Releases []UListRelease `json:"releases,omitempty"`
}
type UListRelease struct {
ListStatus *int `json:"list_status,omitempty"`
Release
}
type UserLabel struct {
ID int `json:"id"`
Private *bool `json:"private,omitempty"`
Label string `json:"label"`
Count *int `json:"count,omitempty"`
}
// UListLabelsResponse is the GET /ulist_labels response envelope.
type UListLabelsResponse struct {
Labels []UserLabel `json:"labels"`
}
// UListLabelsQuery represents a GET /ulist_labels request.
type UListLabelsQuery struct {
User string
Fields string
}
// UListPatchRequest is the request body for PATCH /ulist/<id>.
type UListPatchRequest struct {
Vote *int `json:"vote,omitempty"`
Notes *string `json:"notes,omitempty"`
Started *string `json:"started,omitempty"`
Finished *string `json:"finished,omitempty"`
Labels []int `json:"labels,omitempty"`
LabelsSet []int `json:"labels_set,omitempty"`
LabelsUnset []int `json:"labels_unset,omitempty"`
}
// RListPatchRequest is the request body for PATCH /rlist/<id>.
type RListPatchRequest struct {
Status *int `json:"status,omitempty"`
}