types

package
v0.3.6 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2026 License: GPL-3.0, LGPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrAPIBadRequestMsg        = "api returned bad request"
	ErrRequestErrorMsg         = "could not make request"
	ErrAPIServerErrorMsg       = "server error"
	ErrInvalidRequestParamsMsg = "invalid request params"
)
View Source
const (
	FileStatusProcessing         = 1
	FileStatusChangesRequired    = 2
	FileStatusUnderReview        = 3
	FileStatusApproved           = 4
	FileStatusRejected           = 5
	FileStatusMalwareDetected    = 6
	FileStatusDeleted            = 7
	FileStatusArchived           = 8
	FileStatusTesting            = 9
	FileStatusReleased           = 10
	FileStatusReadyForReview     = 11
	FileStatusDeprecated         = 12
	FileStatusBaking             = 13
	FileStatusAwaitingPublishing = 14
	FileStatusFailedPublishing   = 15
)

Variables

View Source
var (
	ErrAPIBadRequest        error = Wrap(nil, ErrAPIBadRequestMsg, 400)
	ErrAPIServerError       error = Wrap(nil, ErrAPIServerErrorMsg, 500)
	ErrRequestError         error = Wrap(nil, ErrRequestErrorMsg, 0)
	ErrInvalidRequestParams error = Wrap(nil, ErrInvalidRequestParamsMsg, 0)
)

Functions

This section is empty.

Types

type Authors

type Authors struct {
	ID   int64  `json:"id"`
	Name string `json:"name"`
	URL  string `json:"url"`
}

type Categories

type Categories struct {
	ID               int64     `json:"id"`
	GameID           int64     `json:"gameId"`
	Name             string    `json:"name"`
	Slug             string    `json:"slug"`
	URL              string    `json:"url"`
	IconURL          string    `json:"iconUrl"`
	DateModified     time.Time `json:"dateModified"`
	IsClass          bool      `json:"isClass"`
	ClassID          int64     `json:"classId"`
	ParentCategoryID int64     `json:"parentCategoryId"`
	DisplayIndex     int64     `json:"displayIndex"`
}

type CurseforgeAPIError

type CurseforgeAPIError struct {
	Status  int
	Message string
	Err     error
	// contains filtered or unexported fields
}

func Wrap

func Wrap(err error, msg string, status int) CurseforgeAPIError

func (CurseforgeAPIError) Error

func (e CurseforgeAPIError) Error() string

func (CurseforgeAPIError) Is

func (e CurseforgeAPIError) Is(err error) bool

type CurseforgeAPIResponse

type CurseforgeAPIResponse interface {
	SetRawResponseBody(resp string)
}

type Dependencies

type Dependencies []Dependency

func (Dependencies) ModIDList

func (d Dependencies) ModIDList() []int64

func (Dependencies) ModIDListByDependencyType

func (d Dependencies) ModIDListByDependencyType(dt RelationType) []int64

type Dependency

type Dependency struct {
	ModID        int64        `json:"modId"`
	RelationType RelationType `json:"relationType"`
}

type File

type File struct {
	ID                   int                    `json:"id"`
	GameID               int                    `json:"gameId"`
	ModID                int                    `json:"modId"`
	IsAvailable          bool                   `json:"isAvailable"`
	DisplayName          string                 `json:"displayName"`
	FileName             string                 `json:"fileName"`
	ReleaseType          int                    `json:"releaseType"`
	FileStatus           int                    `json:"fileStatus"`
	Hashes               []Hashes               `json:"hashes"`
	FileDate             time.Time              `json:"fileDate"`
	FileLength           int                    `json:"fileLength"`
	DownloadCount        int                    `json:"downloadCount"`
	FileSizeOnDisk       int                    `json:"fileSizeOnDisk"`
	DownloadURL          string                 `json:"downloadUrl"`
	GameVersions         []string               `json:"gameVersions"`
	SortableGameVersions []SortableGameVersions `json:"sortableGameVersions"`
	Dependencies         Dependencies           `json:"dependencies"`
	ExposeAsAlternative  bool                   `json:"exposeAsAlternative"`
	ParentProjectFileID  int                    `json:"parentProjectFileId"`
	AlternateFileID      int                    `json:"alternateFileId"`
	IsServerPack         bool                   `json:"isServerPack"`
	ServerPackFileID     int                    `json:"serverPackFileId"`
	IsEarlyAccessContent bool                   `json:"isEarlyAccessContent"`
	EarlyAccessEndDate   time.Time              `json:"earlyAccessEndDate"`
	FileFingerprint      int                    `json:"fileFingerprint"`
	Modules              []Modules              `json:"modules"`
}

func (*File) GetDependencyModIDList

func (f *File) GetDependencyModIDList() []Dependency

func (*File) IsCompatible

func (f *File) IsCompatible(gameVersion, modLoader string) bool

type FileReleaseType

type FileReleaseType int
const (
	FileReleaseTypeRelease FileReleaseType = 1
	FileReleaseTypeBeta    FileReleaseType = 2
	FileReleaseTypeAlpha   FileReleaseType = 3
)

func (FileReleaseType) String

func (f FileReleaseType) String() string

type FileStatus

type FileStatus int

func (FileStatus) String

func (f FileStatus) String() string

type Files

type Files []File

type GameVersion

type GameVersion struct {
	ID   int64  `json:"id"`
	Slug string `json:"slug"`
	Name string `json:"name"`
}

type GameVersionType

type GameVersionType struct {
	Type     int          `json:"type"`
	Versions GameVersions `json:"versions"`
}

type GameVersions

type GameVersions []GameVersion

func (GameVersions) Sort

func (v GameVersions) Sort() GameVersions

type GameVersionsResponse

type GameVersionsResponse struct {
	RawResponse
	Data []GameVersionType `json:"data"`
}

type GetCategoriesResponse

type GetCategoriesResponse struct {
	RawResponse
	Data []Categories `json:"data"`
}

type GetModFilesResponse

type GetModFilesResponse struct {
	RawResponse
	Data       Files      `json:"data"`
	Pagination Pagination `json:"pagination"`
}

type HashAlgo

type HashAlgo int
const (
	HashAlgoSHA1 HashAlgo = 1
	HashAlgoMD5  HashAlgo = 2
)

func (HashAlgo) String

func (h HashAlgo) String() string

type Hashes

type Hashes struct {
	Value string   `json:"value"`
	Algo  HashAlgo `json:"algo"`
}

type LatestEarlyAccessFilesIndexes

type LatestEarlyAccessFilesIndexes struct {
	GameVersion       string `json:"gameVersion"`
	FileID            int64  `json:"fileId"`
	Filename          string `json:"filename"`
	ReleaseType       int    `json:"releaseType"`
	GameVersionTypeID int    `json:"gameVersionTypeId"`
	ModLoader         int    `json:"modLoader"`
}

type LatestFilesIndexes

type LatestFilesIndexes struct {
	GameVersion       string `json:"gameVersion"`
	FileID            int64  `json:"fileId"`
	Filename          string `json:"filename"`
	ReleaseType       int    `json:"releaseType"`
	GameVersionTypeID int    `json:"gameVersionTypeId"`
	ModLoader         int    `json:"modLoader"`
}
type Links struct {
	WebsiteURL string `json:"websiteUrl"`
	WikiURL    string `json:"wikiUrl"`
	IssuesURL  string `json:"issuesUrl"`
	SourceURL  string `json:"sourceUrl"`
}
type Logo struct {
	ID           int64  `json:"id"`
	ModID        int64  `json:"modId"`
	Title        string `json:"title"`
	Description  string `json:"description"`
	ThumbnailURL string `json:"thumbnailUrl"`
	URL          string `json:"url"`
}

type ModData

type ModData struct {
	ID                            int64                           `json:"id"`
	GameID                        int                             `json:"gameId"`
	Name                          string                          `json:"name"`
	Slug                          string                          `json:"slug"`
	Links                         Links                           `json:"links"`
	Summary                       string                          `json:"summary"`
	Status                        ModStatus                       `json:"status"`
	DownloadCount                 int                             `json:"downloadCount"`
	IsFeatured                    bool                            `json:"isFeatured"`
	PrimaryCategoryID             int                             `json:"primaryCategoryId"`
	Categories                    []Categories                    `json:"categories"`
	ClassID                       int                             `json:"classId"`
	Authors                       []Authors                       `json:"authors"`
	Screenshots                   []Screenshots                   `json:"screenshots"`
	MainFileID                    int                             `json:"mainFileId"`
	LatestFiles                   Files                           `json:"latestFiles"`
	LatestFilesIndexes            []LatestFilesIndexes            `json:"latestFilesIndexes"`
	LatestEarlyAccessFilesIndexes []LatestEarlyAccessFilesIndexes `json:"latestEarlyAccessFilesIndexes"`
	DateCreated                   time.Time                       `json:"dateCreated"`
	DateModified                  time.Time                       `json:"dateModified"`
	DateReleased                  time.Time                       `json:"dateReleased"`
	AllowModDistribution          bool                            `json:"allowModDistribution"`
	GamePopularityRank            int64                           `json:"gamePopularityRank"`
	IsAvailable                   bool                            `json:"isAvailable"`
	ThumbsUpCount                 int64                           `json:"thumbsUpCount"`
	Rating                        int64                           `json:"rating"`
}

func (*ModData) GetLatestFile

func (m *ModData) GetLatestFile() *File

func (*ModData) GetLatestFileByGameVersion

func (m *ModData) GetLatestFileByGameVersion(gv string) *File

func (*ModData) GetLatestFileByGameVersionsAndModloader

func (m *ModData) GetLatestFileByGameVersionsAndModloader(gv, ml string) *File

func (*ModData) GetLatestFileGameVersions

func (m *ModData) GetLatestFileGameVersions() []string

type ModLoaderDetailsResponse

type ModLoaderDetailsResponse struct {
	RawResponse
	Data ModloaderDetails `json:"data"`
}

type ModStatus

type ModStatus int
const (
	ModStatusNew             ModStatus = 1
	ModStatusChangesRequired ModStatus = 2
	ModStatusUnderSoftReview ModStatus = 3
	ModStatusApproved        ModStatus = 4
	ModStatusRejected        ModStatus = 5
	ModStatusChangesMade     ModStatus = 6
	ModStatusInactive        ModStatus = 7
	ModStatusAbandoned       ModStatus = 8
	ModStatusDeleted         ModStatus = 9
	ModStatusUnderReview     ModStatus = 10
)

func (ModStatus) String

func (m ModStatus) String() string

type ModloaderDetails

type ModloaderDetails struct {
	ID                             int       `json:"id"`
	GameVersionID                  int       `json:"gameVersionId"`
	MinecraftGameVersionID         int       `json:"minecraftGameVersionId"`
	ForgeVersion                   string    `json:"forgeVersion"`
	Name                           string    `json:"name"`
	Type                           int       `json:"type"`
	DownloadURL                    string    `json:"downloadUrl"`
	Filename                       string    `json:"filename"`
	InstallMethod                  int       `json:"installMethod"`
	Latest                         bool      `json:"latest"`
	Recommended                    bool      `json:"recommended"`
	Approved                       bool      `json:"approved"`
	DateModified                   time.Time `json:"dateModified"`
	MavenVersionString             string    `json:"mavenVersionString"`
	VersionJSON                    string    `json:"versionJson"`
	LibrariesInstallLocation       string    `json:"librariesInstallLocation"`
	MinecraftVersion               string    `json:"minecraftVersion"`
	AdditionalFilesJSON            string    `json:"additionalFilesJson"`
	ModLoaderGameVersionID         int       `json:"modLoaderGameVersionId"`
	ModLoaderGameVersionTypeID     int       `json:"modLoaderGameVersionTypeId"`
	ModLoaderGameVersionStatus     int       `json:"modLoaderGameVersionStatus"`
	ModLoaderGameVersionTypeStatus int       `json:"modLoaderGameVersionTypeStatus"`
	McGameVersionID                int       `json:"mcGameVersionId"`
	McGameVersionTypeID            int       `json:"mcGameVersionTypeId"`
	McGameVersionStatus            int       `json:"mcGameVersionStatus"`
	McGameVersionTypeStatus        int       `json:"mcGameVersionTypeStatus"`
	InstallProfileJSON             string    `json:"installProfileJson"`
}

type ModsResponse

type ModsResponse struct {
	RawResponse
	Data       []ModData  `json:"data"`
	Pagination Pagination `json:"pagination"`
}

type Modules

type Modules struct {
	Name        string `json:"name"`
	Fingerprint int64  `json:"fingerprint"`
}

type Pagination

type Pagination struct {
	Index       int64 `json:"index"`
	PageSize    int64 `json:"pageSize"`
	ResultCount int64 `json:"resultCount"`
	TotalCount  int64 `json:"totalCount"`
}

type RawResponse

type RawResponse struct {
	CurseforgeAPIResponse
	RawBody string `json:"body"`
}

func (*RawResponse) SetRawResponseBody

func (r *RawResponse) SetRawResponseBody(resp string)

type RelationType

type RelationType int
const (
	RelationTypeEmbeddedLibrary    RelationType = 1
	RelationTypeOptionalDependency RelationType = 2
	RelationTypeRequiredDependency RelationType = 3
	RelationTypeTool               RelationType = 4
	RelationTypeIncompatible       RelationType = 5
	RelationTypeInclude            RelationType = 6
)

func (RelationType) String

func (r RelationType) String() string

type Screenshots

type Screenshots struct {
	ID           int64  `json:"id"`
	ModID        int64  `json:"modId"`
	Title        string `json:"title"`
	Description  string `json:"description"`
	ThumbnailURL string `json:"thumbnailUrl"`
	URL          string `json:"url"`
}

type SortableGameVersions

type SortableGameVersions struct {
	GameVersionName        string    `json:"gameVersionName"`
	GameVersionPadded      string    `json:"gameVersionPadded"`
	GameVersion            string    `json:"gameVersion"`
	GameVersionReleaseDate time.Time `json:"gameVersionReleaseDate"`
	GameVersionTypeID      int       `json:"gameVersionTypeId"`
}

type StringResponse

type StringResponse struct {
	RawResponse
	Data string `json:"data"`
}

Jump to

Keyboard shortcuts

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