steamgriddb

package
v0.0.0-...-d3234e5 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2022 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const BASE_URL = "https://www.steamgriddb.com/api/v2"

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client is a structure for querying the SteamGridDB API

func NewClient

func NewClient(apiKey string) *Client

NewClient will return a new SteamGridDB Client

func (*Client) CachedDownload

func (c *Client) CachedDownload(url, path string) error

CachedDownload will download only if the file does not already exist.

func (*Client) Download

func (c *Client) Download(url, path string) error

Download will download the given file to the provided path

func (*Client) Get

func (c *Client) Get(path string) (*http.Response, error)

Get will perform a GET request to the given SteamGridDB API endpoint.

func (*Client) GetGrids

func (c *Client) GetGrids(gameID string, filters ...FilterGrid) (*GridResponse, error)

GetGrids will return the results of the grids for a given game ID

func (*Client) GetHeroes

func (c *Client) GetHeroes(gameID string, filters ...FilterHeroes) (*HeroesResponse, error)

GetHeroes will return the results of heroes for a given game ID

func (*Client) GetIcons

func (c *Client) GetIcons(gameID string, filters ...FilterIcons) (*IconsResponse, error)

GetIcons will return the results of icons for a given game ID

func (*Client) GetLogos

func (c *Client) GetLogos(gameID string, filters ...FilterLogos) (*LogosResponse, error)

GetLogos will return the results of logos for a given game ID

func (*Client) Search

func (c *Client) Search(term string) (*SearchResponse, error)

Search will return a list of search results for the given term

type FilterGrid

type FilterGrid func(d *GridResponse) []GridResponseData

FilterGrid is a function signature for any function that will filter grid results.

func FilterGridHorizontal

func FilterGridHorizontal() FilterGrid

FilterGridHorizontal will return a filter that will filter out all results that are not horizontal banner images.

func FilterGridStyle

func FilterGridStyle(style string) FilterGrid

FilterGridStyle will return a filter that will filter out all results that don't match the given style.

func FilterGridVertical

func FilterGridVertical() FilterGrid

FilterGridVertical will return a filter that will filter out all results that are not vertical poster images.

type FilterHeroes

type FilterHeroes func(d *HeroesResponse) []ImageResponseData

func FilterHeroesStyle

func FilterHeroesStyle(style string) FilterHeroes

type FilterIcons

type FilterIcons func(d *IconsResponse) []ImageResponseData

func FilterIconsStyle

func FilterIconsStyle(style string) FilterIcons

type FilterLogos

type FilterLogos func(d *LogosResponse) []ImageResponseData

func FilterLogosStyle

func FilterLogosStyle(style string) FilterLogos

type GridResponseData

type GridResponseData struct {
	ID        int         `json:"id"`
	Score     int         `json:"score"`
	Style     string      `json:"style"`
	Width     int         `json:"width"`
	Height    int         `json:"height"`
	Nsfw      bool        `json:"nsfw"`
	Humor     bool        `json:"humor"`
	Notes     interface{} `json:"notes"`
	Mime      string      `json:"mime"`
	Language  string      `json:"language"`
	URL       string      `json:"url"`
	Thumb     string      `json:"thumb"`
	Lock      bool        `json:"lock"`
	Epilepsy  bool        `json:"epilepsy"`
	Upvotes   int         `json:"upvotes"`
	Downvotes int         `json:"downvotes"`
	Author    struct {
		Name    string `json:"name"`
		Steam64 string `json:"steam64"`
		Avatar  string `json:"avatar"`
	} `json:"author"`
}

type ImageResponseData

type ImageResponseData struct {
	ID     int      `json:"id"`
	Score  int      `json:"score"`
	Style  string   `json:"style"`
	URL    string   `json:"url"`
	Thumb  string   `json:"thumb"`
	Tags   []string `json:"tags"`
	Author struct {
		Name    string `json:"name"`
		Steam64 string `json:"steam64"`
		Avatar  string `json:"avatar"`
	} `json:"author"`
}

type Response

type Response struct {
	Success bool     `json:"success"`
	Errors  []string `json:"errors"`
}

Response is a generic SteamGridDB response

type SearchResponseData

type SearchResponseData struct {
	ID       int      `json:"id"`
	Name     string   `json:"name"`
	Types    []string `json:"types"`
	Verified bool     `json:"verified"`
}

Jump to

Keyboard shortcuts

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