mod

package
v1.3.3 Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2026 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoUpdate       = errors.New("no update")
	ErrNoModID        = errors.New("no modid")
	ErrInvalidSemVer  = errors.New("is not a valid Semantic Version")
	ErrPreReleaseSkip = errors.New("skipped pre-release version")
	ErrUnstableSkip   = errors.New("skipped pre-release game version")
)

Functions

func IsAllPreRelease added in v1.3.2

func IsAllPreRelease(versions []SemVer) bool

Types

type AppSide

type AppSide uint8

https://apidocs.vintagestory.at/api/Vintagestory.API.Common.EnumAppSide.html

const (
	Server    AppSide = 1
	Client    AppSide = 2
	Universal AppSide = Server | Client
)

func (*AppSide) MarshalJSON

func (a *AppSide) MarshalJSON() ([]byte, error)

func (*AppSide) UnmarshalJSON

func (a *AppSide) UnmarshalJSON(side []byte) error

type Bool added in v1.0.4

type Bool bool

func (*Bool) MarshalJSON added in v1.0.4

func (b *Bool) MarshalJSON() ([]byte, error)

func (*Bool) UnmarshalJSON added in v1.0.4

func (b *Bool) UnmarshalJSON(data []byte) error

type Info

type Info struct {
	Path  string `json:"-"`
	Error error  `json:"-"`

	Type             Type              `json:"type"`
	Name             string            `json:"name"`
	ModID            string            `json:"modid,omitempty"`
	Version          SemVer            `json:"version"`
	NetworkVersion   string            `json:"networkVersion,omitempty"`
	TextureSize      int               `json:"textureSize,omitempty"`
	Description      string            `json:"description,omitempty"`
	Website          string            `json:"website,omitempty"`
	IconPath         string            `json:"iconPath,omitempty"`
	Authors          []string          `json:"authors,omitempty"`
	Contributors     []string          `json:"contributors,omitempty"`
	Side             AppSide           `json:"side,omitempty"`
	RequiredOnClient Bool              `json:"requiredOnClient,omitempty"`
	RequiredOnServer Bool              `json:"requiredOnServer,omitempty"`
	Dependencies     map[string]string `json:"dependencies,omitempty"`
}

Info contains mod metadata

func InfoFromPath added in v1.0.4

func InfoFromPath(path string) ([]*Info, error)

Returns Info slice from zip files

func InfoFromZip

func InfoFromZip(filepath string) (*Info, error)

func (*Info) Backup

func (i *Info) Backup() error

func (*Info) CheckUpdates

func (i *Info) CheckUpdates() (upd Update, err error)

CheckUpdates returns url to latest mod version

func (*Info) Details added in v1.0.5

func (i *Info) Details() string

Details returns detailed mod info string

func (*Info) Restore added in v1.3.1

func (i *Info) Restore() error

func (*Info) String

func (i *Info) String() string

type Mod

type Mod struct {
	ModID           int        `json:"modid,omitempty"`
	AssetID         int        `json:"assetid,omitempty"`
	Name            string     `json:"name,omitempty"`
	Text            string     `json:"text,omitempty"`
	Author          string     `json:"author,omitempty"`
	UrlAlias        any        `json:"urlalias,omitempty"`
	LogoFilename    any        `json:"logofilename,omitempty"`
	LogoFile        any        `json:"logofile,omitempty"`
	LogoFileDB      any        `json:"logofiledb,omitempty"`
	HomepageUrl     any        `json:"homepageurl,omitempty"`
	SourcecodeUrl   any        `json:"sourcecodeurl,omitempty"`
	TrailervideoUrl any        `json:"trailervideourl,omitempty"`
	IssuetrackerUrl any        `json:"issuetrackerurl,omitempty"`
	WikiUrl         any        `json:"wikiurl,omitempty"`
	Downloads       int        `json:"downloads,omitempty"`
	Follows         int        `json:"follows,omitempty"`
	TrendingPoints  int        `json:"trendingpoints,omitempty"`
	Comments        int        `json:"comments,omitempty"`
	Side            string     `json:"side,omitempty"`
	Type            string     `json:"type,omitempty"`
	Created         string     `json:"created,omitempty"`
	LastReleased    string     `json:"lastreleased,omitempty"`
	LastModified    string     `json:"lastmodified,omitempty"`
	Tags            []string   `json:"tags,omitempty"`
	Releases        []Releases `json:"releases,omitempty"`
	Screenshots     []any      `json:"screenshots,omitempty"`
}

type Releases

type Releases struct {
	ReleaseID  int      `json:"releaseid,omitempty"`
	Mainfile   string   `json:"mainfile,omitempty"`
	Filename   string   `json:"filename,omitempty"`
	FileID     int      `json:"fileid,omitempty"`
	Downloads  int      `json:"downloads,omitempty"`
	Tags       []SemVer `json:"tags,omitempty"` // Supported game versions list
	ModIDStr   string   `json:"modidstr,omitempty"`
	ModVersion SemVer   `json:"modversion"`
	Created    string   `json:"created,omitempty"`
	Changelog  string   `json:"changelog,omitempty"`
}

type Response

type Response struct {
	Mod        Mod    `json:"mod"`
	StatusCode string `json:"statuscode,omitempty"`
}

type SemVer added in v1.1.3

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

func GetLatestVersion added in v1.3.2

func GetLatestVersion(versions []SemVer) SemVer

func NewSemVer added in v1.3.2

func NewSemVer(x string) (SemVer, error)

func (SemVer) Compare added in v1.1.3

func (v SemVer) Compare(x SemVer) int

func (SemVer) IsValid added in v1.3.2

func (v SemVer) IsValid() bool

func (SemVer) PreRelease added in v1.2.0

func (v SemVer) PreRelease() bool

func (*SemVer) Sanitize added in v1.3.2

func (v *SemVer) Sanitize()

func (SemVer) String added in v1.3.0

func (v SemVer) String() string

func (*SemVer) UnmarshalJSON added in v1.1.3

func (v *SemVer) UnmarshalJSON(data []byte) error

type Type

type Type uint8

https://apidocs.vintagestory.at/api/Vintagestory.API.Common.EnumModType.html

const (
	Theme Type = iota
	Content
	Code
)

func (*Type) MarshalJSON

func (t *Type) MarshalJSON() ([]byte, error)

func (*Type) UnmarshalJSON

func (t *Type) UnmarshalJSON(typ []byte) error

type Update

type Update struct {
	Name     string
	URL      string
	Version  SemVer
	Filename string
}

func UpdateFromString added in v1.3.0

func UpdateFromString(line string) (upd Update, err error)

func (Update) Download

func (upd Update) Download() error

Jump to

Keyboard shortcuts

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