gdb

package
v1.1.3 Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2016 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package gdb interacts with thegamedb.net's API.

Example:

resp, err := gdb.GetGame(GGReq{ID: "5"})

Index

Constants

View Source
const (
	GDBURL  = "http://thegamesdb.net"
	GGPath  = "/api/GetGame.php"
	GGLPath = "/api/GetGamesList.php"
)

Variables

This section is empty.

Functions

func IsUp

func IsUp() bool

IsUp returns if thegamedb.net is up.

Types

type GGLReq

type GGLReq struct {
	Name     string
	Platform string
	Genre    string
}

type GGLResp

type GGLResp struct {
	XMLName xml.Name
	Game    []GameTrunc
	// contains filtered or unexported fields
}

func GetGameList

func GetGameList(req GGLReq) (*GGLResp, error)

GetGameList gets the game information from the DB.

type GGReq

type GGReq struct {
	ID       string
	Name     string
	Platform string
}

GGReq is the request to GetGame.

type GGResp

type GGResp struct {
	XMLName  xml.Name
	ImageURL string `xml:"baseImgUrl"`
	Game     []Game
	// contains filtered or unexported fields
}

GGResp is the response of the GetGame query.

func GetGame

func GetGame(req GGReq) (*GGResp, error)

GetGame gets the game information from the DB.

type Game

type Game struct {
	ID          string `xml:"id"`
	GameTitle   string
	Overview    string
	ReleaseDate string
	Platform    string
	Developer   string
	Publisher   string
	Genres      []string `xml:"Genres>genre"`
	Players     string
	Rating      float64
	ESRB        string
	AltTitles   []string `xml:"AlternateTitles>title"`
	BoxArt      []Image  `xml:"Images>boxart"`
	Banner      []Image  `xml:"Images>banner"`
	FanArt      []OImage `xml:"Images>fanart"`
	Screenshot  []OImage `xml:"Images>screenshot"`
}

Game is used to parse the GetGame's <Game> tag.

type GameTrunc

type GameTrunc struct {
	ID          string `xml:"id"`
	GameTitle   string
	ReleaseDate string
	Platform    string
}

GameTrunc is used to parse the GetGamesList's <Game> tag.

type Image

type Image struct {
	URL    string `xml:",chardata"`
	Width  uint   `xml:"width,attr"`
	Height uint   `xml:"height,attr"`
	// Only used on boxart.
	Side  string `xml:"side,attr"`
	Thumb string `xml:"thumb,attr"`
}

Image is used to parse the GetGame's <Images> tags.

type OImage

type OImage struct {
	Original Image  `xml:"original"`
	Thumb    string `xml:"thumb"`
}

OImage is used to parse <Images> tags for fanart and screenshots since they are formatted differently.

Jump to

Keyboard shortcuts

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