goidgames

package module
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: May 20, 2021 License: MIT Imports: 9 Imported by: 1

Documentation

Index

Constants

View Source
const (
	API_URL       = "https://www.doomworld.com/idgames/api/api.php?"
	ACTION        = "action"
	ACTION_GET    = "get"
	ACTION_SEARCH = "search"
	ACTION_LATEST = "latestfiles"
	OUT           = "out"
	OUT_JSON      = "json"
	OUT_XML       = "xml"

	SEARCH_TYPE_FILENAME    = "filename"
	SEARCH_TYPE_TITLE       = "title"
	SEARCH_TYPE_AUTHOR      = "author"
	SEARCH_TYPE_EMAIL       = "email"
	SEARCH_TYPE_DESCRIPTION = "description"
	SEARCH_TYPE_CREDITS     = "credits"
	SEARCH_TYPE_EDITORS     = "editors"
	SEARCH_TYPE_TEXTFILE    = "textfile"

	SEARCH_SORT_DATE     = "date"
	SEARCH_SORT_FILENAME = "filename"
	SEARCH_SORT_SIZE     = "size"
	SEARCH_SORT_RATING   = "rating"

	SEARCH_SORT_ASC  = "asc"
	SEARCH_SORT_DESC = "desc"
)

Variables

View Source
var (
	Mirrors = []string{"https://www.quaddicted.com/files/idgames", "https://ftpmirror1.infania.net/pub/idgames"}
)

Functions

This section is empty.

Types

type Idgame

type Idgame struct {
	Id          int      `json:"id"`          // The file's id.
	Title       string   `json:"title"`       // The title of the file.
	Dir         string   `json:"dir"`         // The file's full directory path.
	Filename    string   `json:"filename"`    // The filename itself, no path.
	Size        int      `json:"size"`        // The size of the file in bytes.
	Age         int64    `json:"age"`         // The date that the file was added in seconds since the Unix Epoch (Jan. 1, 1970). Note: This is likely influenced by the time zone of the primary idGames Archive.
	Date        string   `json:"date"`        // A YYYY-MM-DD formatted date describing the date that this file was added to the archive.
	Author      string   `json:"author"`      // The file's author/uploader.
	Email       string   `json:"email"`       // The author's E-mail address.
	Description string   `json:"description"` // The file's description.
	Credits     string   `json:"credits"`     // The file's additional credits.
	Base        string   `json:"base"`        // The file's base (from another mod? made from scratch?).
	Buildtime   string   `json:"buildtime"`   // The file's/WAD's build time.
	Editors     string   `json:"editors"`     // The editors used to create this.
	Bugs        string   `json:"bugs"`        // Known bugs (if any).
	Textfile    string   `json:"textfile"`    // The file's text file contents.
	Rating      float32  `json:"rating"`      // The file's average rating, as rated by users.
	Votes       int      `json:"votes"`       // The number of votes that this file received.
	Url         string   `json:"url"`         // The URL for the idGames Archive page for this file.
	Idgamesurl  string   `json:"idgamesurl"`  // The idgames protocol URL for this file.
	Reviews     []Review `json:"reviews"`     // The element that contains all reviews for this file in review elements.
}

Idgame represents the metadata returned by the idgames api.

func Get

func Get(id int, filepath string) (g Idgame, err error)

Get gets the data for a game specified by id or filepath. Pass an empyt string for not used paramters.

func LatestFiles

func LatestFiles(limit, startid int) (idgames []Idgame, err error)

LatestFiles returns a slice of the latest additions to idgames. Limit the number or start from a specific Id. Pass 0 as startid if you want to see the hottest and newest files. If the limit is higher then the APIs max, then this is silently ignored.

func Search(query, searchType, sort, sortOrder string) (idgames []Idgame, err error)

Search searches for games based on the query. It returns a slice with results. Types can be found as constant. searchType, sort and sortOrder can be one of the constants or an empty string. If empty, the API uses it's default.

func SearchMultipleTypes added in v0.0.2

func SearchMultipleTypes(query string, searchTypes []string, sort string, sortOrder string) (idgames []Idgame, err error)

func (Idgame) DownloadTo added in v0.0.3

func (g Idgame) DownloadTo(path string) (filePath string, err error)

DownloadTo tries to download the game to given path and returns the full path of the downloaded file

type Review

type Review struct {
	Text     string `json:"text"`     // The individual review's text, if any. Note: may be blank.
	Vote     int    `json:"vote"`     // The vote associated with the review.
	Username string `json:"username"` // The user name associated with the review, if any. Note: may be blank/null, which means "Anonymous". Since Version 3
}

Review represents a single review for one of the idgame files.

Jump to

Keyboard shortcuts

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