steamgriddb

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2026 License: AGPL-3.0, AGPL-3.0-or-later Imports: 11 Imported by: 0

Documentation

Overview

Package steamgriddb provides a client for the SteamGridDB API

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ClearImageCache

func ClearImageCache() error

ClearImageCache clears the image cache (including all game subdirectories)

func GetCacheSize

func GetCacheSize() (int64, error)

GetCacheSize returns the total size of the image cache (including subdirectories)

func GetCachedImage

func GetCachedImage(gameID int, imageURL string) ([]byte, string, error)

GetCachedImage returns the cached image data if it exists

func GetCachedImagePath

func GetCachedImagePath(gameID int, imageURL string) (string, error)

GetCachedImagePath returns the file path of a cached image if it exists

func GetGameCacheDir

func GetGameCacheDir(gameID int) (string, error)

GetGameCacheDir returns the cache directory for a specific game

func GetImageCacheDir

func GetImageCacheDir() (string, error)

GetImageCacheDir returns the path to the image cache directory

func SaveImageToCache

func SaveImageToCache(gameID int, imageURL string, data []byte, contentType string) error

SaveImageToCache saves image data to the cache

Types

type Client

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

Client is a SteamGridDB API client

func NewClient

func NewClient(apiKey string) *Client

NewClient creates a new SteamGridDB client

func (*Client) GetGrids

func (c *Client) GetGrids(gameID int, filters *ImageFilters, page int) ([]GridData, error)

GetGrids returns grid images for a game

func (*Client) GetHeroes

func (c *Client) GetHeroes(gameID int, filters *ImageFilters, page int) ([]ImageData, error)

GetHeroes returns hero images for a game

func (*Client) GetIcons

func (c *Client) GetIcons(gameID int, filters *ImageFilters, page int) ([]ImageData, error)

GetIcons returns icon images for a game

func (*Client) GetLogos

func (c *Client) GetLogos(gameID int, filters *ImageFilters, page int) ([]ImageData, error)

GetLogos returns logo images for a game

func (*Client) Search

func (c *Client) Search(term string) ([]SearchResult, error)

Search searches for games by name

type GridData

type GridData = ImageData

GridData is an alias for ImageData (grids share the same API schema).

type ImageData

type ImageData 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"`
	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"`
}

ImageData represents a SteamGridDB image (grid, hero, logo, or icon).

type ImageFilters

type ImageFilters struct {
	Style     string `json:"style"`
	MimeType  string `json:"mimeType"`
	ImageType string `json:"imageType"` // "static", "animated", or "" for all
	Dimension string `json:"dimension"`
	ShowNsfw  bool   `json:"showNsfw"`
	ShowHumor bool   `json:"showHumor"`
}

ImageFilters represents filters for image queries

type SearchResult

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

SearchResult represents a game search result

Jump to

Keyboard shortcuts

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