igdbapi

package
v0.0.0-...-efe0c35 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2026 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ImageTypeThumbAlias         = "thumb"
	ImageTypeCoverBig2xAlias    = "cover_big_2x"
	ImageTypeScreenshotBigAlias = "screenshot_big"
)

Image types aliases

View Source
const (
	WebsiteTypeOfficial  int8 = 1
	WebsiteTypeFacebook  int8 = 4
	WebsiteTypeTwitter   int8 = 5
	WebsiteTypeTwitch    int8 = 6
	WebsiteTypeYoutube   int8 = 9
	WebsiteTypeSteam     int8 = 13
	WebsiteTypeEpicGames int8 = 16
	WebsiteTypeGOG       int8 = 17
	WebsiteTypeDiscord   int8 = 18
)

Website types

Variables

View Source
var WebsiteTypeNames = map[int8]string{
	WebsiteTypeOfficial:  "Official",
	WebsiteTypeFacebook:  "Facebook",
	WebsiteTypeTwitter:   "Twitter",
	WebsiteTypeTwitch:    "Twitch",
	WebsiteTypeYoutube:   "Youtube",
	WebsiteTypeSteam:     "Steam",
	WebsiteTypeEpicGames: "EpicGames",
	WebsiteTypeGOG:       "GOG",
	WebsiteTypeDiscord:   "Discord",
}

WebsiteTypeNames - mapping of a website type to name

Functions

This section is empty.

Types

type Client

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

Client represents dependencies for igdb client

func New

func New(log *zap.Logger, conf appconf.IGDB) (*Client, error)

New constructs Client instance

func (*Client) CompanyExists

func (c *Client) CompanyExists(ctx context.Context, companyName string) (bool, error)

CompanyExists checks if a company with the given name exists in IGDB (case-insensitive)

func (*Client) GetGameInfoForUpdate

func (c *Client) GetGameInfoForUpdate(ctx context.Context, igdbID int64) (GameInfoForUpdate, error)

GetGameInfoForUpdate returns game info for update

func (*Client) GetImageByURL

func (c *Client) GetImageByURL(ctx context.Context, imageURL, imageType string) (GetImageResp, error)

GetImageByURL downloads image by url and image type and returns data as io.ReadSeeker and file name

func (*Client) GetTopRatedGames

func (c *Client) GetTopRatedGames(ctx context.Context, platformsIDs []int64, releasedBefore time.Time, minRatingsCount, minRating, limit int64) ([]TopRatedGames, error)

GetTopRatedGames returns top-rated games

type Company

type Company struct {
	Company   IDName `json:"company"`
	Developer bool   `json:"developer"`
	Publisher bool   `json:"publisher"`
}

Company - company

type CompanyInfo

type CompanyInfo struct {
	ID   int64  `json:"id"`
	Name string `json:"name"`
}

CompanyInfo - company information from IGDB

type GameInfoForUpdate

type GameInfoForUpdate struct {
	ID               int64     `json:"id"`
	Name             string    `json:"name"`
	TotalRating      float64   `json:"total_rating"`
	TotalRatingCount int32     `json:"total_rating_count"`
	Platforms        []int64   `json:"platforms"`
	Websites         []Website `json:"websites"`
}

GameInfoForUpdate - game info for update

type GetImageResp

type GetImageResp struct {
	Body        *bytes.Reader
	FileName    string
	ContentType string
}

GetImageResp - get image response

type IDName

type IDName struct {
	ID   int64  `json:"id"`
	Name string `json:"name"`
}

IDName - struct containing id and name

type TokenResp

type TokenResp struct {
	AccessToken string `json:"access_token"`
	ExpiresIn   int64  `json:"expires_in"`
	TokenType   string `json:"token_type"`
}

TokenResp - access token response

type TopRatedGames

type TopRatedGames struct {
	ID                int64     `json:"id"`
	Name              string    `json:"name"`
	TotalRating       float64   `json:"total_rating"`
	TotalRatingCount  int32     `json:"total_rating_count"`
	Cover             URL       `json:"cover"`
	FirstReleaseDate  int64     `json:"first_release_date"`
	Genres            []IDName  `json:"genres"`
	InvolvedCompanies []Company `json:"involved_companies"`
	Platforms         []int64   `json:"platforms"`
	Screenshots       []URL     `json:"screenshots"`
	Slug              string    `json:"slug"`
	Summary           string    `json:"summary"`
	Websites          []Website `json:"websites"`
}

TopRatedGames - top-rated games

type URL

type URL struct {
	URL string `json:"url"`
}

URL - struct containing url

type Website

type Website struct {
	URL  string `json:"url"`
	Type int8   `json:"type"`
}

Website - website

Jump to

Keyboard shortcuts

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