cfwidget

package
v1.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: 6 Imported by: 0

Documentation

Index

Constants

View Source
const Endpoint = "api.cfwidget.com"

Endpoint is the CFWidget API endpoint domain.

Variables

This section is empty.

Functions

This section is empty.

Types

type File

type File struct {
	ID         int
	URL        string
	Display    string
	Name       string
	Type       string
	Version    string
	FileSize   int
	Versions   []string
	Downloads  int
	UploadedAt time.Time `json:"uploaded_at"`
}

File represents information about a file, as returned by CFWidget.

func (*File) ActualName

func (file *File) ActualName() string

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

func (*File) DownloadURL

func (file *File) DownloadURL(parentID int, client *resty.Client) (string, error)

DownloadURL returns a URL to a direct download of this file.

type ModInfo

type ModInfo struct {
	ID      int
	Title   string
	Summary string
	Game    string
	Type    string
	URLs    struct {
		CurseForge string
		Project    string
	}
	Files     []File
	Downloads struct {
		// Monthly is always 0 because of API changes.
		Monthly int
		Total   int
	}
	Thumbnail   string
	Categories  []string
	CreatedAt   time.Time `json:"created_at"`
	Description string
	LastFetch   time.Time `json:"last_fetch"`
	Download    File
}

ModInfo represents information about a mod, as returned from CFWidget.

func GetModInfo

func GetModInfo(client *resty.Client, modURL string, gameVersion string) (*ModInfo, error)

GetModInfo returns the info for a mod by its URL. See https://cfwidget.com/#documentation:about for more information.

Jump to

Keyboard shortcuts

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