shared

package
v1.7.1 Latest Latest
Warning

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

Go to latest
Published: Dec 30, 2025 License: AGPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidArtworkStatus = fmt.Errorf("not a valid ArtworkStatus, try [%s]", strings.Join(_ArtworkStatusNames, ", "))
View Source
var ErrInvalidPermission = fmt.Errorf("not a valid Permission, try [%s]", strings.Join(_PermissionNames, ", "))
View Source
var ErrInvalidR18Type = fmt.Errorf("not a valid R18Type, try [%s]", strings.Join(_R18TypeNames, ", "))
View Source
var ErrInvalidSourceType = fmt.Errorf("not a valid SourceType, try [%s]", strings.Join(_SourceTypeNames, ", "))
View Source
var ErrInvalidStorageType = fmt.Errorf("not a valid StorageType, try [%s]", strings.Join(_StorageTypeNames, ", "))
View Source
var ErrInvalidTelegramMediaType = fmt.Errorf("not a valid TelegramMediaType, try [%s]", strings.Join(_TelegramMediaTypeNames, ", "))
View Source
var ZeroStorageDetail = StorageDetail{}
View Source
var ZeroStorageInfo = StorageInfo{}
View Source
var ZeroUgoiraMetaData = UgoiraMetaData{}

Functions

func ArtworkStatusNames

func ArtworkStatusNames() []string

ArtworkStatusNames returns a list of possible string values of ArtworkStatus.

func PermissionNames

func PermissionNames() []string

PermissionNames returns a list of possible string values of Permission.

func R18TypeNames

func R18TypeNames() []string

R18TypeNames returns a list of possible string values of R18Type.

func SourceTypeNames

func SourceTypeNames() []string

SourceTypeNames returns a list of possible string values of SourceType.

func StorageTypeNames

func StorageTypeNames() []string

StorageTypeNames returns a list of possible string values of StorageType.

func TelegramMediaTypeNames

func TelegramMediaTypeNames() []string

TelegramMediaTypeNames returns a list of possible string values of TelegramMediaType.

Types

type ArtistLike

type ArtistLike interface {
	GetName() string
	GetUserName() string
	GetUID() string
}

type ArtworkLike

type ArtworkLike interface {
	GetID() string
	GetSourceURL() string
	GetTitle() string
	GetR18() bool
	GetArtist() ArtistLike
	GetDescription() string
	GetTags() []string
	MediasCount() int
	GetType() SourceType
	FirstMedia() MediaLike
	GetPictures() []PictureLike
	GetUgoiraMetas() []UgoiraMetaLike
	GetVideos() []VideoLike
}

type ArtworkStatus

type ArtworkStatus string

ArtworkStatus

ENUM( cached posting posted )

const (
	// ArtworkStatusCached is a ArtworkStatus of type cached.
	ArtworkStatusCached ArtworkStatus = "cached"
	// ArtworkStatusPosting is a ArtworkStatus of type posting.
	ArtworkStatusPosting ArtworkStatus = "posting"
	// ArtworkStatusPosted is a ArtworkStatus of type posted.
	ArtworkStatusPosted ArtworkStatus = "posted"
)

func ArtworkStatusValues

func ArtworkStatusValues() []ArtworkStatus

ArtworkStatusValues returns a list of the values for ArtworkStatus

func ParseArtworkStatus

func ParseArtworkStatus(name string) (ArtworkStatus, error)

ParseArtworkStatus attempts to convert a string to a ArtworkStatus.

func (ArtworkStatus) IsValid

func (x ArtworkStatus) IsValid() bool

IsValid provides a quick way to determine if the typed value is part of the allowed enumerated values

func (ArtworkStatus) String

func (x ArtworkStatus) String() string

String implements the Stringer interface.

type MediaLike added in v1.5.0

type MediaLike interface {
	GetIndex() uint
	GetTelegramInfo() TelegramInfo
}

type Permission

type Permission string

Permission

ENUM( sudo post_artwork delete_artwork get_artwork_info edit_artwork fetch_artwork send_artwork_info )

const (
	// PermissionSudo is a Permission of type sudo.
	PermissionSudo Permission = "sudo"
	// PermissionPostArtwork is a Permission of type post_artwork.
	PermissionPostArtwork Permission = "post_artwork"
	// PermissionDeleteArtwork is a Permission of type delete_artwork.
	PermissionDeleteArtwork Permission = "delete_artwork"
	// PermissionGetArtworkInfo is a Permission of type get_artwork_info.
	PermissionGetArtworkInfo Permission = "get_artwork_info"
	// PermissionEditArtwork is a Permission of type edit_artwork.
	PermissionEditArtwork Permission = "edit_artwork"
	// PermissionFetchArtwork is a Permission of type fetch_artwork.
	PermissionFetchArtwork Permission = "fetch_artwork"
	// PermissionSendArtworkInfo is a Permission of type send_artwork_info.
	PermissionSendArtworkInfo Permission = "send_artwork_info"
)

func ParsePermission

func ParsePermission(name string) (Permission, error)

ParsePermission attempts to convert a string to a Permission.

func PermissionValues

func PermissionValues() []Permission

PermissionValues returns a list of the values for Permission

func (Permission) IsValid

func (x Permission) IsValid() bool

IsValid provides a quick way to determine if the typed value is part of the allowed enumerated values

func (Permission) String

func (x Permission) String() string

String implements the Stringer interface.

type PictureLike

type PictureLike interface {
	IsHide() bool
	GetIndex() uint
	GetTelegramInfo() TelegramInfo
	GetOriginal() string
	GetThumbnail() string
	GetSize() (width, height uint)
	GetStorageInfo() StorageInfo
}

type R18Type

type R18Type uint

R18Type

ENUM( none r18 all )

const (
	// R18TypeNone is a R18Type of type None.
	R18TypeNone R18Type = iota
	// R18TypeR18 is a R18Type of type R18.
	R18TypeR18
	// R18TypeAll is a R18Type of type All.
	R18TypeAll
)

func ParseR18Type

func ParseR18Type(name string) (R18Type, error)

ParseR18Type attempts to convert a string to a R18Type.

func R18TypeFromInt

func R18TypeFromInt(i int) R18Type

func R18TypeValues

func R18TypeValues() []R18Type

R18TypeValues returns a list of the values for R18Type

func (R18Type) IsValid

func (x R18Type) IsValid() bool

IsValid provides a quick way to determine if the typed value is part of the allowed enumerated values

func (R18Type) String

func (x R18Type) String() string

String implements the Stringer interface.

type SourceType

type SourceType string

SourceType

ENUM( pixiv twitter bilibili danbooru kemono yandere nhentai )

const (
	// SourceTypePixiv is a SourceType of type pixiv.
	SourceTypePixiv SourceType = "pixiv"
	// SourceTypeTwitter is a SourceType of type twitter.
	SourceTypeTwitter SourceType = "twitter"
	// SourceTypeBilibili is a SourceType of type bilibili.
	SourceTypeBilibili SourceType = "bilibili"
	// SourceTypeDanbooru is a SourceType of type danbooru.
	SourceTypeDanbooru SourceType = "danbooru"
	// SourceTypeKemono is a SourceType of type kemono.
	SourceTypeKemono SourceType = "kemono"
	// SourceTypeYandere is a SourceType of type yandere.
	SourceTypeYandere SourceType = "yandere"
	// SourceTypeNhentai is a SourceType of type nhentai.
	SourceTypeNhentai SourceType = "nhentai"
)

func ParseSourceType

func ParseSourceType(name string) (SourceType, error)

ParseSourceType attempts to convert a string to a SourceType.

func SourceTypeValues

func SourceTypeValues() []SourceType

SourceTypeValues returns a list of the values for SourceType

func (SourceType) IsValid

func (x SourceType) IsValid() bool

IsValid provides a quick way to determine if the typed value is part of the allowed enumerated values

func (SourceType) String

func (x SourceType) String() string

String implements the Stringer interface.

type StorageDetail

type StorageDetail struct {
	Type StorageType `json:"type"`
	Path string      `json:"path"`
	Mime string      `json:"mime,omitempty"`
}

func (StorageDetail) Hash

func (s StorageDetail) Hash() string

func (StorageDetail) IsZero

func (s StorageDetail) IsZero() bool

type StorageInfo

type StorageInfo struct {
	Original *StorageDetail `json:"original"`
	Regular  *StorageDetail `json:"regular"`
	Thumb    *StorageDetail `json:"thumb"`
}

func (StorageInfo) IsZero

func (s StorageInfo) IsZero() bool

type StorageType

type StorageType string

StorageType

ENUM( webdav local alist telegram )

const (
	// StorageTypeWebdav is a StorageType of type webdav.
	StorageTypeWebdav StorageType = "webdav"
	// StorageTypeLocal is a StorageType of type local.
	StorageTypeLocal StorageType = "local"
	// StorageTypeAlist is a StorageType of type alist.
	StorageTypeAlist StorageType = "alist"
	// StorageTypeTelegram is a StorageType of type telegram.
	StorageTypeTelegram StorageType = "telegram"
)

func ParseStorageType

func ParseStorageType(name string) (StorageType, error)

ParseStorageType attempts to convert a string to a StorageType.

func StorageTypeValues

func StorageTypeValues() []StorageType

StorageTypeValues returns a list of the values for StorageType

func (StorageType) IsValid

func (x StorageType) IsValid() bool

IsValid provides a quick way to determine if the typed value is part of the allowed enumerated values

func (StorageType) String

func (x StorageType) String() string

String implements the Stringer interface.

type TelegramInfo

type TelegramInfo struct {

	// {bot_id:{"photo": file_id, "document": file_id}}
	FileIDs  map[int64]map[TelegramMediaType]string `json:"file_ids"` // (file_id is bot specific)
	Messages map[int64]TelegramMessage              `json:"messages"` // key: chat id
}

func (*TelegramInfo) ClearFileIDs

func (t *TelegramInfo) ClearFileIDs()

func (TelegramInfo) DocumentFileID

func (t TelegramInfo) DocumentFileID(botID int64) string

func (TelegramInfo) FileID

func (t TelegramInfo) FileID(botID int64, mediaType TelegramMediaType) string

func (TelegramInfo) IsZero

func (t TelegramInfo) IsZero() bool

func (*TelegramInfo) MergeFrom

func (t *TelegramInfo) MergeFrom(other *TelegramInfo)

func (TelegramInfo) MessageID

func (t TelegramInfo) MessageID(chatID int64) int

func (TelegramInfo) PhotoFileID

func (t TelegramInfo) PhotoFileID(botID int64) string

func (*TelegramInfo) SetFileID

func (t *TelegramInfo) SetFileID(botID int64, mediaType TelegramMediaType, fileID string)

func (*TelegramInfo) SetMessage

func (t *TelegramInfo) SetMessage(chatID int64, messageID int, mediaGroupID string)

func (TelegramInfo) VideoFileID

func (t TelegramInfo) VideoFileID(botID int64) string

type TelegramMediaType

type TelegramMediaType string

TelegramMediaType

ENUM( photo document video )

const (
	// TelegramMediaTypePhoto is a TelegramMediaType of type photo.
	TelegramMediaTypePhoto TelegramMediaType = "photo"
	// TelegramMediaTypeDocument is a TelegramMediaType of type document.
	TelegramMediaTypeDocument TelegramMediaType = "document"
	// TelegramMediaTypeVideo is a TelegramMediaType of type video.
	TelegramMediaTypeVideo TelegramMediaType = "video"
)

func ParseTelegramMediaType

func ParseTelegramMediaType(name string) (TelegramMediaType, error)

ParseTelegramMediaType attempts to convert a string to a TelegramMediaType.

func TelegramMediaTypeValues

func TelegramMediaTypeValues() []TelegramMediaType

TelegramMediaTypeValues returns a list of the values for TelegramMediaType

func (TelegramMediaType) IsValid

func (x TelegramMediaType) IsValid() bool

IsValid provides a quick way to determine if the typed value is part of the allowed enumerated values

func (TelegramMediaType) String

func (x TelegramMediaType) String() string

String implements the Stringer interface.

type TelegramMessage

type TelegramMessage struct {
	MediaGroupID string `json:"media_group_id,omitempty"`
	MessageID    int    `json:"message_id"`
}

type UgoiraFrame

type UgoiraFrame struct {
	File  string `json:"file"`
	Delay int    `json:"delay"`
}

type UgoiraMetaData

type UgoiraMetaData struct {
	// PosterOriginal is the original poster image URL.
	PosterOriginal string `json:"poster_original"`
	PosterThumb    string `json:"poster_thumb"`
	// OriginalZip is the original ugoira zip URL.
	//
	// The zip should be pixiv's ugoira zip style
	OriginalZip string        `json:"original_zip"`
	ThumbZip    string        `json:"thumb_zip"`
	MimeType    string        `json:"mime_type"`
	Frames      []UgoiraFrame `json:"frames"`
	Width       int           `json:"width"`
	Height      int           `json:"height"`
}

type UgoiraMetaLike

type UgoiraMetaLike interface {
	GetIndex() uint
	GetData() UgoiraMetaData
	GetOriginalStorage() StorageDetail
	GetTelegramInfo() TelegramInfo
}

type VideoLike added in v1.5.0

type VideoLike interface {
	GetIndex() uint
	GetURL() string
	GetWidth() uint
	GetHeight() uint
	GetDuration() uint
	GetPoster() string
	GetMimeType() string
	GetOriginalStorage() StorageDetail
	GetTelegramInfo() TelegramInfo
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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