twitchapi

package
v2.2.0 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2020 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const Endpoint = "addons-ecs.forgesvc.net"

Endpoint is the Twitch API endpoint domain.

Variables

This section is empty.

Functions

func GetMultipleMods

func GetMultipleMods(client *resty.Client, modIDs []int) (*[]*ModInfo, error)

GetMultipleMods returns the info for multiple mods by their IDs. This is more efficient then calling GetModInfo in a loop. See https://twitchappapi.docs.apiary.io/#/reference/0/get-multiple-addons for more information.

Types

type File

type File struct {
	ID              int
	DisplayName     string
	FileName        string
	FileDate        time.Time
	FileLength      int
	ReleaseType     int
	FileStatus      int
	DownloadURL     string
	IsAlternate     bool
	AlternateFileID int
	Dependencies    []struct {
		ID      int
		AddonID int
		Type    int
		FileID  int
	}
	IsAvailable bool
	Modules     []struct {
		FolderName  string
		Fingerprint int
		Type        int
	}
	PackageFingerprint  int
	GameVersion         []string
	SortableGameVersion []struct {
		GameVersionPadded      string
		GameVersion            string
		GameVersionReleaseDate time.Time
		GameVersionName        string
	}
	InstallMetadata            string
	Changelog                  string
	HasInstallScript           bool
	IsCompatibleWithClient     bool
	CategorySectionPackageType int
	RestrictProjectFileAccess  int
	ProjectStatus              int
	RenderCacheID              int
	FileLegacyMappingID        int
	ProjectID                  int
	ParentProjectFileID        int
	ParentFileLegacyMappingID  int
	FileTypeID                 int
	ExposeAsAlternative        bool
	PackageFingerprintID       int
	GameVersionDateReleased    time.Time
	GameVersionMappingID       int
	GameVersionID              int
	GameID                     int
	IsServerPack               bool
	ServerPackFileID           int
	GameVersionFlavor          string
}

File represents information about a file, as returned by the Twitch API.

func (*File) ActualName

func (file *File) ActualName() string

ActualName returns the actual name of a mod, because CurseForge replaces spaces with pluses.

type ModInfo

type ModInfo struct {
	ID      int
	Name    string
	Authors []struct {
		Name              string
		URL               string
		ProjectID         int
		ID                int
		ProjectTitleID    int
		ProjectTitleTitle string
		UserID            int
		TwitchID          int
	}
	Attachments []struct {
		ID           int
		ProjectID    int
		Description  string
		IsDefault    bool
		ThumbnailURL string
		Title        string
		URL          string
		Status       int
	}
	WebsiteURL    string
	GameID        int
	Summary       string
	DefaultFileID int
	DownloadCount float32
	LatestFiles   []File
	Categories    []struct {
		CategoryID int
		Name       string
		URL        string
		AvatarURL  string
		ParentID   int
		RootID     int
		ProjectID  int
		AvatarID   int
		GameID     int
	}
	Status            int
	PrimaryCategoryID int
	CategorySection   struct {
		ID                      int
		GameID                  int
		Name                    string
		PackageType             int
		Path                    string
		InitialInclusionPattern string
		ExtraIncludePattern     string
		GameCategoryID          int
	}
	Slug                   string
	GameVersionLatestFiles []struct {
		GameVersion       string
		ProjectFileID     int
		ProjectFileName   string
		FileType          int
		GameVersionFlavor string
	}
	IsFeatured         bool
	PopularityScore    float32
	GamePopularityRank int
	PrimaryLanguage    string
	GameSlug           string
	GameName           string
	PortalName         string
	DateModified       time.Time
	DateCreated        time.Time
	DateReleased       time.Time
	IsAvailable        bool
	IsExperimental     bool
}

ModInfo represents information about a mod, as returned from the Twitch API.

func GetModInfo

func GetModInfo(client *resty.Client, modID int) (*ModInfo, error)

GetModInfo returns the info for a mod by its ID. See https://twitchappapi.docs.apiary.io/#/reference/0/get-addon-info for more information.

func (*ModInfo) LatestDownloadForVersion

func (info *ModInfo) LatestDownloadForVersion(client *resty.Client, version string) (*File, error)

LatestDownloadForVersion returns the latest download for a version or an error if no such download exists. It prioritizes releases over betas over alphas (though that is subject to change because of the Twitch API).

Jump to

Keyboard shortcuts

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