igdb

package module
v1.0.5 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2023 License: MIT Imports: 16 Imported by: 0

README

IGDB

GoDoc Build Status Coverage Status Go Report Card Mentioned in Awesome Go

Communicate with the Internet Game Database API quickly and easily with the igdb package. With the igdb client, you can retrieve extensive information on any number of video games, characters, companies, media, artwork and much more. Every IGDB API endpoint is supported!

If you would like to help the Go igdb project, please submit a pull request - it's always greatly appreciated.

Installation

If you do not have Go installed yet, you can find installation instructions here. Please note that the package requires Go version 1.13 or later for module support.

To pull the most recent version of igdb, use go get.

go get github.com/Henry-Sarabia/igdb

Then import the package into your project as you normally would.

import "github.com/Henry-Sarabia/igdb"

Now you're ready to Go.

Usage

Creating A Client

Before using the igdb package, you need to have an IGDB API key. If you do not have a key yet, you can sign up here.

Create a client with your Client-ID and App Access Token to start communicating with the IGDB API.

client, err := igdb.NewClient("YOUR_CLIENT_ID", "YOUR_APP_ACCESS_TOKEN", nil)

If you need to use a preconfigured HTTP client, simply pass its address to the NewClient function.

client, err := igdb.NewClient("YOUR_CLIENT_ID", "YOUR_APP_ACCESS_TOKEN", &custom)
Services

The client contains a distinct service for working with each of the IGDB API endpoints. Each service has a set of service functions that make specific API calls to their respective endpoint.

To start communicating with the IGDB, choose a service and call its service function. Take the Games service for example.

To search for a Game, use the Search service function.

games, err := client.Games.Search("zelda")

To retrieve several Games by their IGDB ID, use the List service function.

games, err := client.Games.List([]int{7346, 1721, 2777})

The rest of the service functions work much the same way; they are concise and behave as you would expect. The documentation contains several examples on how to use each service function.

Service functions by themselves allow you to retrieve a considerable amount of information from the IGDB but sometimes you need more control over the results being returned. For this reason, the igdb package provides a set of flexible functional options for customizing a service function's API query.

Functional Options

The igdb package uses what are called functional options to apply different query parameters to service function's API call. Functional options themselves are merely first order functions that are passed to a service function.

Let's walk through a few different functional option examples.

To set the limit of the amount of results returned from an API query, pass SetLimit to the service function.

games, err := client.Games.Search("megaman", SetLimit(15))

As you can see, you simply need to pass the functional option as an argument to the service function.

To offset the results returned from an API call, pass SetOffset to the service function.

games, err := client.Games.Search("megaman", SetOffset(15))

SetOffset is used to iterate through a large set of results that cannot be retrieved in a single API call. In this case, the first 15 results are ignored so we effectively iterated through to the next set of results by 15.

To set the order of the results returned from an API call, pass SetOrder much in the same way as the previous examples.

games, err := client.Games.Search("megaman", SetOrder("hypes", igdb.OrderDescending))

SetOrder is used to specify in what order you want the results to be retrieved in and by what criteria. Here, SetOrder will retrieve the results with the highest hypes first.

The remaining functional options are not unlike the examples we covered and are further described in the documentation.

Functional Option Composition

More often than not, you will need to set more than one option for an API query. Fortunately, this functionality is supported through variadic functions and functional option composition.

First, service functions are variadic so you can pass in any number of functional options.

chars, err := client.Characters.Search(
    "mario",
    SetFields("id", "name", "games"),
    SetFilter("gender", "1"),
    SetLimit(5), 
    )

This API call will search the Characters endpoint using the query "mario", filter out any character that does not have a gender code of 1 (which in this case represents male), retrieve the id, name, and games fields, and return only up to 5 of these results.

Second, the igdb package provides a ComposeOptions function which takes any number of functional options as its parameters, composes them into a single functional option, and returns that composed functional option.

hypeOpt := igdb.ComposeOptions(
    igdb.SetLimit(5),
    igdb.SetFields("name"),
	igdb.SetOrder("hypes", igdb.OrderDescending),
)

This call to ComposeOptions creates a single functional option that will allow you to retrieve the names of the top 5 most popular games when passed to the appropriate service function.

Functional option composition allows you to create custom functional options that can be reused in different API calls.

Taking the previous example, this can be done in the following way.

PS4, err := c.Games.Index(
		popularOpt,
		igdb.SetFilter("platforms", igdb.OpEquals, "48"),    // filter out games not on PS4
    )
    
XBOX, err := c.Games.Index(
		popularOpt, 
		igdb.SetFilter("platforms", igdb.OpEquals, "49"),    // filter out games not on XB1
    )

This example has two service function calls that each utilize the previously composed functional option in the same way but for different platforms. The first function retrieves the top 5 most popular PS4 games while the second function retrieves the top 5 most popular XB1 games.

Functional option composition reduces duplicate code and helps keep your code DRY. You can even compose newly composed functional options for even more finely grained control over similar API calls.

Examples

The repository contains several example mini-applications that demonstrate how one might use the igdb package.

If you have used the igdb package for a project and would like to have it featured here as a reference for new users, please submit an issue and I'll be sure to add it.

Contributions

If you would like to contribute to this project, please adhere to the following guidelines.

  • Submit an issue describing the problem.
  • Fork the repo and add your contribution.
  • Add appropriate tests.
  • Run go fmt, go vet, and golint.
  • Prefer idiomatic Go over non-idiomatic code.
  • Follow the basic Go conventions found here.
  • If in doubt, try to match your code to the current codebase.
  • Create a pull request with a description of your changes.

Again, contributions are greatly appreciated!

Special Thanks

  • You for your interest
  • John for the IGDB Gopher
  • Peter for the "Thank You" Gopher
  • Dave Cheney for his article on functional options
  • The DiscordGo and Go Spotify projects for inspiring me to create my own open source package for others to enjoy
  • The Awesome Go project for so many references to admire
  • The awesome people in the IGDB community who are always open to questions

Documentation

Index

Examples

Constants

View Source
const (
	EndpointAgeRating                  endpoint = "age_ratings/"
	EndpointAgeRatingContent           endpoint = "age_rating_content_descriptions/"
	EndpointAlternativeName            endpoint = "alternative_names/"
	EndpointArtwork                    endpoint = "artworks/"
	EndpointCharacter                  endpoint = "characters/"
	EndpointCharacterMugshot           endpoint = "character_mug_shots/"
	EndpointCollection                 endpoint = "collections/"
	EndpointCompany                    endpoint = "companies/"
	EndpointCompanyWebsite             endpoint = "company_websites/"
	EndpointCover                      endpoint = "covers/"
	EndpointExternalGame               endpoint = "external_games/"
	EndpointFranchise                  endpoint = "franchises/"
	EndpointGame                       endpoint = "games/"
	EndpointGameEngine                 endpoint = "game_engines/"
	EndpointGameMode                   endpoint = "game_modes/"
	EndpointGameVersion                endpoint = "game_versions/"
	EndpointGameVersionFeature         endpoint = "game_version_features/"
	EndpointGameVersionFeatureValue    endpoint = "game_version_feature_values/"
	EndpointGameVideo                  endpoint = "game_videos/"
	EndpointGenre                      endpoint = "genres/"
	EndpointInvolvedCompany            endpoint = "involved_companies/"
	EndpointKeyword                    endpoint = "keywords/"
	EndpointMultiplayerMode            endpoint = "multiplayer_modes/"
	EndpointPlatform                   endpoint = "platforms/"
	EndpointPlatformVersion            endpoint = "platform_versions/"
	EndpointPlatformVersionCompany     endpoint = "platform_version_companies/"
	EndpointPlatformVersionReleaseDate endpoint = "platform_version_release_dates/"
	EndpointPlatformWebsite            endpoint = "platform_websites/"
	EndpointPlayerPerspective          endpoint = "player_perspectives/"
	EndpointPlatformFamily             endpoint = "product_families/"
	EndpointPulse                      endpoint = "pulses/"
	EndpointReleaseDate                endpoint = "release_dates/"
	EndpointScreenshot                 endpoint = "screenshots/"
	EndpointSearch                     endpoint = "search/"
	EndpointTheme                      endpoint = "themes/"
	EndpointTitle                      endpoint = "titles/"
	EndpointWebsite                    endpoint = "websites/"
)

Public IGDB API endpoints

View Source
const (
	// SizeCoverSmall is sized at 90x128.
	SizeCoverSmall imageSize = "cover_small"
	// SizeCoverBig is sized at 227x320.
	SizeCoverBig imageSize = "cover_big"
	// SizeScreenshotMed is sized at 569x320.
	SizeScreenshotMed imageSize = "screenshot_med"
	// SizeScreenshotBig is sized at 889x500
	SizeScreenshotBig imageSize = "screenshot_big"
	// SizeScreenshotHuge is sized at 1280x720.
	SizeScreenshotHuge imageSize = "screenshot_huge"
	// SizeLogoMed is sized at 284x160.
	SizeLogoMed imageSize = "logo_med"
	// SizeMicro is sized at 35x35.
	SizeMicro imageSize = "micro"
	// SizeThumb is sized at 90x90.
	SizeThumb imageSize = "thumb"
	// Size720p is sized at 1280x720.
	Size720p imageSize = "720p"
	// Size1080p is sized at 1920x1080.
	Size1080p imageSize = "1080p"
)

Available image sizes supported by the IGDB API

View Source
const (
	// OrderAscending is used as an argument in the SetOrder functional
	// option to organize the results from an API call in ascending order.
	OrderAscending order = "asc"
	// OrderDescending is used as an argument in the SetOrder functional
	// option to organize the results from an API call in descending order.
	OrderDescending order = "desc"
)

Available orders for the functional option SetOrder

View Source
const (
	// OpEquals checks for equality. Must match exactly.
	OpEquals operator = "%s = %s"
	// OpNotEquals checks for inequality. Any non-exact match.
	OpNotEquals operator = "%s != %s"
	// OpGreaterThan checks if a field value is greater than a given value. Only works on numbers.
	OpGreaterThan operator = "%s > %s"
	// OpGreaterThanEqual checks if a field value is greater than or equal to a given value. Only works on numbers.
	OpGreaterThanEqual operator = "%s >= %s"
	// OpLessThan checks if a field value is less than a given value. Only works on numbers.
	OpLessThan operator = "%s < %s"
	// OpLessThanEqual checks if a field value is less than or equal to a given value. Only works on numbers.
	OpLessThanEqual operator = "%s <= %s"
	// OpContainsAll checks if the given value exists in within the array.
	OpContainsAll operator = "%s = [%s]"
	// OpNotContainsAll checks if the given value does not exist in within the array.
	OpNotContainsAll operator = "%s != [%s]"
	// OpContainsAtLeast checks if any of the given values exist within the array.
	OpContainsAtLeast operator = "%s = (%s)"
	// OpNotContainsAtLeast checks if any of the given values do not exist within the array.
	OpNotContainsAtLeast operator = "%s != (%s)"
	// OpContainsExactly checks if the the given values exactly match the array.
	OpContainsExactly operator = "%s = {%s}"
)

Available operators for the functional option SetFilter

View Source
const (
	TagTheme tagType = iota
	TagGenre
	TagKeyword
	TagGame
	TagPerspective
)

These tagTypes correspond to their respective IGDB Object Type IDs.

For the list of these IDs and other information, visit: https://igdb.github.io/api/references/tag-numbers/

Variables

View Source
var (
	// ErrNegativeID occurs when a negative ID is used as an argument in an API call.
	ErrNegativeID = errors.New("ID cannot be negative")
	// ErrEmptyIDs occurs when a List function is called without a populated int slice.
	ErrEmptyIDs = errors.New("IDs argument empty")
	// ErrNoResults occurs when the IGDB returns an empty array, void of results.
	ErrNoResults = errors.New("results are empty")
)
View Source
var (
	// ErrBadRequest occurs when a request is malformed.
	ErrBadRequest = ServerError{
		Status: http.StatusBadRequest,
		Msg:    "bad request: check query parameters",
		Temp:   false,
	}
	// ErrUnauthorized occurs when a request is made without authorization.
	ErrUnauthorized = ServerError{
		Status: http.StatusUnauthorized,
		Msg:    "authentication failed: check for valid API key in user-key header",
		Temp:   false,
	}
	// ErrForbidden occurs when a request is made without authorization.
	ErrForbidden = ServerError{
		Status: http.StatusForbidden,
		Msg:    "authentication failed: check for valid API key in user-key header",
		Temp:   false,
	}
	// ErrInternalError occurs when an unexpected IGDB server error occurs and should be reported.
	ErrInternalError = ServerError{
		Status: http.StatusInternalServerError,
		Msg:    "internal error: report bug",
		Temp:   false,
	}
	// ErrManyRequests occurs when request rate exceeds 4 per second.
	// For full information, visit https://api-docs.igdb.com/#rate-limits
	ErrManyRequests = ServerError{
		Status: http.StatusTooManyRequests,
		Msg:    "too many requests",
		Temp:   true,
	}
)

Errors returned when encountering error status codes.

View Source
var (
	// ErrBlankID occurs when an empty string is used as an argument.
	ErrBlankID = errors.New("image id value empty")
	// ErrPixelRatio occurs when an unsupported display pixel ratio is used as an argument in a function.
	ErrPixelRatio = errors.New("invalid display pixel ratio")
)

Errors returned when creating Image URLs.

View Source
var (
	// ErrEmptyQry occurs when an empty string is used as a query value.
	ErrEmptyQry = errors.New("provided option query value is empty")
	// ErrEmptyFields occurs when an empty string is used as a field value.
	ErrEmptyFields = errors.New("one or more provided option field values are empty")
	// ErrExpandedField occurs when a field value tries to access an expanded subfield.
	ErrExpandedField = errors.New("one or more provided option field values is an expanded subfield which is not supported")
	// ErrEmptyFilterVals occurs when an empty string is used as a filter value.
	ErrEmptyFilterVals = errors.New("one or more provided filter option values are empty")
	// ErrOutOfRange occurs when a provided number value is out of valid range.
	ErrOutOfRange = errors.New("provided option value is out of range")
)

Errors returned by an Option when setting options for an API call.

Functions

func SizedImageURL

func SizedImageURL(imageID string, size imageSize, ratio int) (string, error)

SizedImageURL returns the URL of an image identified by the provided imageID, image size, and display pixel ratio. The display pixel ratio only multiplies the resolution of the image. The current available ratios are 1 and 2.

Types

type AgeRating

type AgeRating struct {
	ID                  int               `json:"id"`
	Category            AgeRatingCategory `json:"category"`
	ContentDescriptions []int             `json:"content_descriptions"`
	Rating              AgeRatingEnum     `json:"rating"`
	RatingCoverURL      string            `json:"rating_cover_url"`
	Synopsis            string            `json:"synopsis"`
}

AgeRating describes an age rating according to various organizations. For more information visit: https://api-docs.igdb.com/#age-rating

type AgeRatingCategory

type AgeRatingCategory int

AgeRatingCategory specifies a regulatory organization.

const (
	AgeRatingESRB AgeRatingCategory = iota + 1
	AgeRatingPEGI
)

Expected AgeRatingCategory enums from the IGDB.

func (AgeRatingCategory) String

func (i AgeRatingCategory) String() string

type AgeRatingContent

type AgeRatingContent struct {
	ID          int                      `json:"id"`
	Category    AgeRatingContentCategory `json:"category"`
	Description string                   `json:"description"`
}

AgeRatingContent is the organization behind a specific rating.

type AgeRatingContentCategory

type AgeRatingContentCategory int

AgeRatingContentCategory specifies a regulatory organization.

const (
	AgeRatingContentPEGI AgeRatingContentCategory = iota + 1
	AgeRatingContentESRB
)

Expected AgeRatingContentCategory enums from the IGDB.

func (AgeRatingContentCategory) String

func (i AgeRatingContentCategory) String() string

type AgeRatingContentService

type AgeRatingContentService service

AgeRatingContentService handles all the API calls for the IGDB AgeRatingContent endpoint.

func (*AgeRatingContentService) Count

func (as *AgeRatingContentService) Count(opts ...Option) (int, error)

Count returns the number of AgeRatingContents available in the IGDB. Provide the SetFilter functional option if you need to filter which AgeRatingContents to count.

func (*AgeRatingContentService) Fields

func (as *AgeRatingContentService) Fields() ([]string, error)

Fields returns the up-to-date list of fields in an IGDB AgeRatingContent object.

func (*AgeRatingContentService) Get

func (as *AgeRatingContentService) Get(id int, opts ...Option) (*AgeRatingContent, error)

Get returns a single AgeRatingContent identified by the provided IGDB ID. Provide the SetFields functional option if you need to specify which fields to retrieve. If the ID does not match any AgeRatingContents, an error is returned.

func (*AgeRatingContentService) Index

func (as *AgeRatingContentService) Index(opts ...Option) ([]*AgeRatingContent, error)

Index returns an index of AgeRatingContents based solely on the provided functional options used to sort, filter, and paginate the results. If no AgeRatingContents can be found using the provided options, an error is returned.

func (*AgeRatingContentService) List

func (as *AgeRatingContentService) List(ids []int, opts ...Option) ([]*AgeRatingContent, error)

List returns a list of AgeRatingContents identified by the provided list of IGDB IDs. Provide functional options to sort, filter, and paginate the results. Any ID that does not match a AgeRatingContent is ignored. If none of the IDs match a AgeRatingContent, an error is returned.

type AgeRatingEnum

type AgeRatingEnum int

AgeRatingEnum specifies a specific age rating.

const (
	AgeRatingThree AgeRatingEnum = iota + 1
	AgeRatingSeven
	AgeRatingTwelve
	AgeRatingSixteen
	AgeRatingEighteen
	AgeRatingRP
	AgeRatingEC
	AgeRatingE
	AgeRatingE10
	AgeRatingT
	AgeRatingM
	AgeRatingAO
)

Expected AgeRatingEnum enums from the IGDB.

func (AgeRatingEnum) String

func (i AgeRatingEnum) String() string

type AgeRatingService

type AgeRatingService service

AgeRatingService handles all the API calls for the IGDB AgeRating endpoint.

func (*AgeRatingService) Count

func (as *AgeRatingService) Count(opts ...Option) (int, error)

Count returns the number of AgeRatings available in the IGDB. Provide the SetFilter functional option if you need to filter which AgeRatings to count.

func (*AgeRatingService) Fields

func (as *AgeRatingService) Fields() ([]string, error)

Fields returns the up-to-date list of fields in an IGDB AgeRating object.

func (*AgeRatingService) Get

func (as *AgeRatingService) Get(id int, opts ...Option) (*AgeRating, error)

Get returns a single AgeRating identified by the provided IGDB ID. Provide the SetFields functional option if you need to specify which fields to retrieve. If the ID does not match any AgeRatings, an error is returned.

func (*AgeRatingService) Index

func (as *AgeRatingService) Index(opts ...Option) ([]*AgeRating, error)

Index returns an index of AgeRatings based solely on the provided functional options used to sort, filter, and paginate the results. If no AgeRatings can be found using the provided options, an error is returned.

func (*AgeRatingService) List

func (as *AgeRatingService) List(ids []int, opts ...Option) ([]*AgeRating, error)

List returns a list of AgeRatings identified by the provided list of IGDB IDs. Provide functional options to sort, filter, and paginate the results. Any ID that does not match a AgeRating is ignored. If none of the IDs match a AgeRating, an error is returned.

type AlternativeName

type AlternativeName struct {
	ID      int    `json:"id"`
	Comment string `json:"comment"`
	Game    int    `json:"game"`
	Name    string `json:"name"`
}

AlternativeName represents an alternative or international name for a particular video game. For more information visit: https://api-docs.igdb.com/#alternative-name

type AlternativeNameService

type AlternativeNameService service

AlternativeNameService handles all the API calls for the IGDB AlternativeName endpoint.

func (*AlternativeNameService) Count

func (as *AlternativeNameService) Count(opts ...Option) (int, error)

Count returns the number of AlternativeNames available in the IGDB. Provide the SetFilter functional option if you need to filter which AlternativeNames to count.

func (*AlternativeNameService) Fields

func (as *AlternativeNameService) Fields() ([]string, error)

Fields returns the up-to-date list of fields in an IGDB AlternativeName object.

func (*AlternativeNameService) Get

func (as *AlternativeNameService) Get(id int, opts ...Option) (*AlternativeName, error)

Get returns a single AlternativeName identified by the provided IGDB ID. Provide the SetFields functional option if you need to specify which fields to retrieve. If the ID does not match any AlternativeNames, an error is returned.

func (*AlternativeNameService) Index

func (as *AlternativeNameService) Index(opts ...Option) ([]*AlternativeName, error)

Index returns an index of AlternativeNames based solely on the provided functional options used to sort, filter, and paginate the results. If no AlternativeNames can be found using the provided options, an error is returned.

func (*AlternativeNameService) List

func (as *AlternativeNameService) List(ids []int, opts ...Option) ([]*AlternativeName, error)

List returns a list of AlternativeNames identified by the provided list of IGDB IDs. Provide functional options to sort, filter, and paginate the results. Any ID that does not match a AlternativeName is ignored. If none of the IDs match a AlternativeName, an error is returned.

type Artwork

type Artwork struct {
	Image
	ID   int `json:"id"`
	Game int `json:"game"`
}

Artwork represents an official piece of artwork. Resolution and aspect ratio may vary. For more information visit: https://api-docs.igdb.com/#artwork

type ArtworkService

type ArtworkService service

ArtworkService handles all the API calls for the IGDB Artwork endpoint.

func (*ArtworkService) Count

func (as *ArtworkService) Count(opts ...Option) (int, error)

Count returns the number of Artworks available in the IGDB. Provide the SetFilter functional option if you need to filter which Artworks to count.

func (*ArtworkService) Fields

func (as *ArtworkService) Fields() ([]string, error)

Fields returns the up-to-date list of fields in an IGDB Artwork object.

func (*ArtworkService) Get

func (as *ArtworkService) Get(id int, opts ...Option) (*Artwork, error)

Get returns a single Artwork identified by the provided IGDB ID. Provide the SetFields functional option if you need to specify which fields to retrieve. If the ID does not match any Artworks, an error is returned.

func (*ArtworkService) Index

func (as *ArtworkService) Index(opts ...Option) ([]*Artwork, error)

Index returns an index of Artworks based solely on the provided functional options used to sort, filter, and paginate the results. If no Artworks can be found using the provided options, an error is returned.

func (*ArtworkService) List

func (as *ArtworkService) List(ids []int, opts ...Option) ([]*Artwork, error)

List returns a list of Artworks identified by the provided list of IGDB IDs. Provide functional options to sort, filter, and paginate the results. Any ID that does not match a Artwork is ignored. If none of the IDs match a Artwork, an error is returned.

type Character

type Character struct {
	ID          int              `json:"ID"`
	AKAS        []string         `json:"akas"`
	CountryName string           `json:"country_name"`
	CreatedAt   int              `json:"created_at"`
	Description string           `json:"description"`
	Games       []int            `json:"games"`
	Gender      CharacterGender  `json:"gender"`
	MugShot     int              `json:"mug_shot"`
	Name        string           `json:"name"`
	People      []int            `json:"people"`
	Slug        string           `json:"slug"`
	Species     CharacterSpecies `json:"species"`
	UpdatedAt   int              `json:"updated_at"`
	URL         string           `json:"url"`
}

Character represents a video game character. For more information visit: https://api-docs.igdb.com/#character

type CharacterGender

type CharacterGender int

CharacterGender specifies a specific gender.

const (
	GenderMale CharacterGender = iota + 1
	GenderFemale
	GenderOther
)

Expected CharacterGender enums from the IGDB.

func (CharacterGender) String

func (i CharacterGender) String() string

type CharacterMugshot

type CharacterMugshot struct {
	Image
	ID int `json:"id"`
}

CharacterMugshot represents an image depicting a game character. For more information visit: https://api-docs.igdb.com/#character-mug-shot

type CharacterMugshotService

type CharacterMugshotService service

CharacterMugshotService handles all the API calls for the IGDB CharacterMugshot endpoint.

func (*CharacterMugshotService) Count

func (cs *CharacterMugshotService) Count(opts ...Option) (int, error)

Count returns the number of CharacterMugshots available in the IGDB. Provide the SetFilter functional option if you need to filter which CharacterMugshots to count.

func (*CharacterMugshotService) Fields

func (cs *CharacterMugshotService) Fields() ([]string, error)

Fields returns the up-to-date list of fields in an IGDB CharacterMugshot object.

func (*CharacterMugshotService) Get

func (cs *CharacterMugshotService) Get(id int, opts ...Option) (*CharacterMugshot, error)

Get returns a single CharacterMugshot identified by the provided IGDB ID. Provide the SetFields functional option if you need to specify which fields to retrieve. If the ID does not match any CharacterMugshots, an error is returned.

func (*CharacterMugshotService) Index

func (cs *CharacterMugshotService) Index(opts ...Option) ([]*CharacterMugshot, error)

Index returns an index of CharacterMugshots based solely on the provided functional options used to sort, filter, and paginate the results. If no CharacterMugshots can be found using the provided options, an error is returned.

func (*CharacterMugshotService) List

func (cs *CharacterMugshotService) List(ids []int, opts ...Option) ([]*CharacterMugshot, error)

List returns a list of CharacterMugshots identified by the provided list of IGDB IDs. Provide functional options to sort, filter, and paginate the results. Any ID that does not match a CharacterMugshot is ignored. If none of the IDs match a CharacterMugshot, an error is returned.

type CharacterService

type CharacterService service

CharacterService handles all the API calls for the IGDB Character endpoint.

func (*CharacterService) Count

func (cs *CharacterService) Count(opts ...Option) (int, error)

Count returns the number of Characters available in the IGDB. Provide the SetFilter functional option if you need to filter which Characters to count.

func (*CharacterService) Fields

func (cs *CharacterService) Fields() ([]string, error)

Fields returns the up-to-date list of fields in an IGDB Character object.

func (*CharacterService) Get

func (cs *CharacterService) Get(id int, opts ...Option) (*Character, error)

Get returns a single Character identified by the provided IGDB ID. Provide the SetFields functional option if you need to specify which fields to retrieve. If the ID does not match any Characters, an error is returned.

func (*CharacterService) Index

func (cs *CharacterService) Index(opts ...Option) ([]*Character, error)

Index returns an index of Characters based solely on the provided functional options used to sort, filter, and paginate the results. If no Characters can be found using the provided options, an error is returned.

func (*CharacterService) List

func (cs *CharacterService) List(ids []int, opts ...Option) ([]*Character, error)

List returns a list of Characters identified by the provided list of IGDB IDs. Provide functional options to sort, filter, and paginate the results. Any ID that does not match a Character is ignored. If none of the IDs match a Character, an error is returned.

func (*CharacterService) Search

func (cs *CharacterService) Search(qry string, opts ...Option) ([]*Character, error)

Search returns a list of Characters found by searching the IGDB using the provided query. Provide functional options to sort, filter, and paginate the results. If no Characters are found using the provided query, an error is returned.

type CharacterSpecies

type CharacterSpecies int

CharacterSpecies specifies a specific species.

const (
	SpeciesHuman CharacterSpecies = iota + 1
	SpeciesAlien
	SpeciesAnimal
	SpeciesAndroid
	SpeciesUnknown
)

Expected CharacterSpecies enums from the IGDB.

func (CharacterSpecies) String

func (i CharacterSpecies) String() string

type Client

type Client struct {

	// Services
	AgeRatings                  *AgeRatingService
	AgeRatingContents           *AgeRatingContentService
	AlternativeNames            *AlternativeNameService
	Artworks                    *ArtworkService
	Characters                  *CharacterService
	CharacterMugshots           *CharacterMugshotService
	Collections                 *CollectionService
	Companies                   *CompanyService
	CompanyLogos                *CompanyLogoService
	CompanyWebsites             *CompanyWebsiteService
	Covers                      *CoverService
	ExternalGames               *ExternalGameService
	Franchises                  *FranchiseService
	Games                       *GameService
	GameEngines                 *GameEngineService
	GameEngineLogos             *GameEngineLogoService
	GameModes                   *GameModeService
	GameVersions                *GameVersionService
	GameVersionFeatures         *GameVersionFeatureService
	GameVersionFeatureValues    *GameVersionFeatureValueService
	GameVideos                  *GameVideoService
	Genres                      *GenreService
	InvolvedCompanies           *InvolvedCompanyService
	Keywords                    *KeywordService
	MultiplayerModes            *MultiplayerModeService
	Platforms                   *PlatformService
	PlatformLogos               *PlatformLogoService
	PlatformVersions            *PlatformVersionService
	PlatformVersionCompanies    *PlatformVersionCompanyService
	PlatformVersionReleaseDates *PlatformVersionReleaseDateService
	PlatformWebsites            *PlatformWebsiteService
	PlayerPerspectives          *PlayerPerspectiveService
	PlatformFamilies            *PlatformFamilyService
	ReleaseDates                *ReleaseDateService
	Screenshots                 *ScreenshotService
	Themes                      *ThemeService
	Websites                    *WebsiteService
	// contains filtered or unexported fields
}

Client wraps an HTTP Client used to communicate with the IGDB, the root URL of the IGDB, and the user's IGDB API key. Client also initializes all the separate services to communicate with each individual IGDB API endpoint.

func NewClient

func NewClient(clientID string, appAccessToken string, custom *http.Client) *Client

NewClient returns a new Client configured to communicate with the IGDB. The provided clientID and appAccessToken will be used to make requests on your behalf. The provided HTTP Client will be the client making requests to the IGDB. If no HTTP Client is provided, a default HTTP client is used instead.

If you need an IGDB/Twitch API keys, please visit: https://api-docs.igdb.com/#account-creation

func (*Client) Search

func (c *Client) Search(qry string, opts ...Option) ([]*SearchResult, error)

Search returns a list of SearchResults using the provided query. Provide functional options to sort, filter, and paginate the results. If no results are found, an error is returned. Search can only search through Characters, Collections, Games, People, Platforms, and Themes.

type Collection

type Collection struct {
	ID        int    `json:"id"`
	CreatedAt int    `json:"created_at"`
	Name      string `json:"name"`
	Slug      string `json:"slug"`
	UpdatedAt int    `json:"updated_at"`
	URL       string `json:"url"`
}

Collection represents a video game series. For more information visit: https://api-docs.igdb.com/#collection

type CollectionService

type CollectionService service

CollectionService handles all the API calls for the IGDB Collection endpoint.

func (*CollectionService) Count

func (cs *CollectionService) Count(opts ...Option) (int, error)

Count returns the number of Collections available in the IGDB. Provide the SetFilter functional option if you need to filter which Collections to count.

func (*CollectionService) Fields

func (cs *CollectionService) Fields() ([]string, error)

Fields returns the up-to-date list of fields in an IGDB Collection object.

func (*CollectionService) Get

func (cs *CollectionService) Get(id int, opts ...Option) (*Collection, error)

Get returns a single Collection identified by the provided IGDB ID. Provide the SetFields functional option if you need to specify which fields to retrieve. If the ID does not match any Collections, an error is returned.

func (*CollectionService) Index

func (cs *CollectionService) Index(opts ...Option) ([]*Collection, error)

Index returns an index of Collections based solely on the provided functional options used to sort, filter, and paginate the results. If no Collections can be found using the provided options, an error is returned.

func (*CollectionService) List

func (cs *CollectionService) List(ids []int, opts ...Option) ([]*Collection, error)

List returns a list of Collections identified by the provided list of IGDB IDs. Provide functional options to sort, filter, and paginate the results. Any ID that does not match a Collection is ignored. If none of the IDs match a Collection, an error is returned.

func (*CollectionService) Search

func (cs *CollectionService) Search(qry string, opts ...Option) ([]*Collection, error)

Search returns a list of Collections found by searching the IGDB using the provided query. Provide functional options to sort, filter, and paginate the results. If no Collections are found using the provided query, an error is returned.

type Company

type Company struct {
	ID                 int          `json:"id"`
	ChangeDate         int          `json:"change_date"`
	ChangeDateCategory DateCategory `json:"change_date_category"`
	ChangedCompanyID   int          `json:"changed_company_id"`
	Country            int          `json:"country"`
	CreatedAt          int          `json:"created_at"`
	Description        string       `json:"description"`
	Developed          []int        `json:"developed"`
	Name               string       `json:"name"`
	Parent             int          `json:"parent"`
	Published          []int        `json:"published"`
	Slug               string       `json:"slug"`
	StartDate          int          `json:"start_date"`
	StartDateCategory  DateCategory `json:"start_date_category"`
	UpdatedAt          int          `json:"updated_at"`
	URL                string       `json:"url"`
	Websites           []int        `json:"websites"`
}

Company represents a video game company. This includes both publishers and developers. For more information visit: https://api-docs.igdb.com/#company

type CompanyLogo struct {
	Image
	ID int `json:"id"`
}

CompanyLogo represents the logo of a developer or publisher. For more information visit: https://api-docs.igdb.com/#company-logo

type CompanyLogoService

type CompanyLogoService service

CompanyLogoService handles all the API calls for the IGDB CompanyLogo endpoint.

func (*CompanyLogoService) Count

func (cs *CompanyLogoService) Count(opts ...Option) (int, error)

Count returns the number of CompanyLogos available in the IGDB. Provide the SetFilter functional option if you need to filter which CompanyLogos to count.

func (*CompanyLogoService) Fields

func (cs *CompanyLogoService) Fields() ([]string, error)

Fields returns the up-to-date list of fields in an IGDB CompanyLogo object.

func (*CompanyLogoService) Get

func (cs *CompanyLogoService) Get(id int, opts ...Option) (*CompanyLogo, error)

Get returns a single CompanyLogo identified by the provided IGDB ID. Provide the SetFields functional option if you need to specify which fields to retrieve. If the ID does not match any CompanyLogos, an error is returned.

func (*CompanyLogoService) Index

func (cs *CompanyLogoService) Index(opts ...Option) ([]*CompanyLogo, error)

Index returns an index of CompanyLogos based solely on the provided functional options used to sort, filter, and paginate the results. If no CompanyLogos can be found using the provided options, an error is returned.

func (*CompanyLogoService) List

func (cs *CompanyLogoService) List(ids []int, opts ...Option) ([]*CompanyLogo, error)

List returns a list of CompanyLogos identified by the provided list of IGDB IDs. Provide functional options to sort, filter, and paginate the results. Any ID that does not match a CompanyLogo is ignored. If none of the IDs match a CompanyLogo, an error is returned.

type CompanyService

type CompanyService service

CompanyService handles all the API calls for the IGDB Company endpoint.

func (*CompanyService) Count

func (cs *CompanyService) Count(opts ...Option) (int, error)

Count returns the number of Companies available in the IGDB. Provide the SetFilter functional option if you need to filter which Companies to count.

func (*CompanyService) Fields

func (cs *CompanyService) Fields() ([]string, error)

Fields returns the up-to-date list of fields in an IGDB Company object.

func (*CompanyService) Get

func (cs *CompanyService) Get(id int, opts ...Option) (*Company, error)

Get returns a single Company identified by the provided IGDB ID. Provide the SetFields functional option if you need to specify which fields to retrieve. If the ID does not match any Companies, an error is returned.

func (*CompanyService) Index

func (cs *CompanyService) Index(opts ...Option) ([]*Company, error)

Index returns an index of Companies based solely on the provided functional options used to sort, filter, and paginate the results. If no Companies can be found using the provided options, an error is returned.

func (*CompanyService) List

func (cs *CompanyService) List(ids []int, opts ...Option) ([]*Company, error)

List returns a list of Companies identified by the provided list of IGDB IDs. Provide functional options to sort, filter, and paginate the results. Any ID that does not match a Company is ignored. If none of the IDs match a Company, an error is returned.

type CompanyWebsite

type CompanyWebsite struct {
	ID       int             `json:"id"`
	Category WebsiteCategory `json:"category"`
	Trusted  bool            `json:"trusted"`
	URL      string          `json:"url"`
}

CompanyWebsite represents a website for a specific company. For more information visit: https://api-docs.igdb.com/#company-website

type CompanyWebsiteService

type CompanyWebsiteService service

CompanyWebsiteService handles all the API calls for the IGDB CompanyWebsite endpoint.

func (*CompanyWebsiteService) Count

func (zs *CompanyWebsiteService) Count(opts ...Option) (int, error)

Count returns the number of CompanyWebsites available in the IGDB. Provide the SetFilter functional option if you need to filter which CompanyWebsites to count.

func (*CompanyWebsiteService) Fields

func (zs *CompanyWebsiteService) Fields() ([]string, error)

Fields returns the up-to-date list of fields in an IGDB CompanyWebsite object.

func (*CompanyWebsiteService) Get

func (zs *CompanyWebsiteService) Get(id int, opts ...Option) (*CompanyWebsite, error)

Get returns a single CompanyWebsite identified by the provided IGDB ID. Provide the SetFields functional option if you need to specify which fields to retrieve. If the ID does not match any CompanyWebsites, an error is returned.

func (*CompanyWebsiteService) Index

func (zs *CompanyWebsiteService) Index(opts ...Option) ([]*CompanyWebsite, error)

Index returns an index of CompanyWebsites based solely on the provided functional options used to sort, filter, and paginate the results. If no CompanyWebsites can be found using the provided options, an error is returned.

func (*CompanyWebsiteService) List

func (zs *CompanyWebsiteService) List(ids []int, opts ...Option) ([]*CompanyWebsite, error)

List returns a list of CompanyWebsites identified by the provided list of IGDB IDs. Provide functional options to sort, filter, and paginate the results. Any ID that does not match a CompanyWebsite is ignored. If none of the IDs match a CompanyWebsite, an error is returned.

type Count

type Count struct {
	Count int `json:"count"`
}

Count contains the number of objects of a certain type counted in the IGDB.

type Cover

type Cover struct {
	Image
	ID   int `json:"id"`
	Game int `json:"game"`
}

Cover represents the cover art for a specific video game. For more information visit: https://api-docs.igdb.com/#cover

type CoverService

type CoverService service

CoverService handles all the API calls for the IGDB Cover endpoint.

func (*CoverService) Count

func (cs *CoverService) Count(opts ...Option) (int, error)

Count returns the number of Covers available in the IGDB. Provide the SetFilter functional option if you need to filter which Covers to count.

func (*CoverService) Fields

func (cs *CoverService) Fields() ([]string, error)

Fields returns the up-to-date list of fields in an IGDB Cover object.

func (*CoverService) Get

func (cs *CoverService) Get(id int, opts ...Option) (*Cover, error)

Get returns a single Cover identified by the provided IGDB ID. Provide the SetFields functional option if you need to specify which fields to retrieve. If the ID does not match any Covers, an error is returned.

func (*CoverService) Index

func (cs *CoverService) Index(opts ...Option) ([]*Cover, error)

Index returns an index of Covers based solely on the provided functional options used to sort, filter, and paginate the results. If no Covers can be found using the provided options, an error is returned.

func (*CoverService) List

func (cs *CoverService) List(ids []int, opts ...Option) ([]*Cover, error)

List returns a list of Covers identified by the provided list of IGDB IDs. Provide functional options to sort, filter, and paginate the results. Any ID that does not match a Cover is ignored. If none of the IDs match a Cover, an error is returned.

type DateCategory

type DateCategory int

DateCategory specifies the format of a release date.

const (
	DateYYYYMMMMDD DateCategory = iota
	DateYYYYMMMM
	DateYYYY
	DateYYYYQ1
	DateYYYYQ2
	DateYYYYQ3
	DateYYYYQ4
	DateTBD
)

Expected DateCategory enums from the IGDB.

func (DateCategory) String

func (i DateCategory) String() string

type ExternalGame

type ExternalGame struct {
	ID        int                  `json:"id"`
	Category  ExternalGameCategory `json:"category"`
	CreatedAt int                  `json:"created_at"`
	Game      int                  `json:"game"`
	Name      string               `json:"name"`
	UID       string               `json:"uid"`
	UpdatedAt int                  `json:"updated_at"`
	Url       string               `json:"url"`
	Year      int                  `json:"year"`
}

ExternalGame contains the ID and other metadata for a game on a third party service. For more information visit: https://api-docs.igdb.com/#external-game

type ExternalGameCategory

type ExternalGameCategory int

ExternalGameCategory speficies an external game, platform, or media service.

const (
	ExternalSteam ExternalGameCategory = iota + 1

	ExternalGOG

	ExternalYoutube
	ExternalMicrosoft

	ExternalApple
	ExternalTwitch
	ExternalAndroid
)

Expected ExternalGameCategory enums from the IGDB.

func (ExternalGameCategory) String

func (i ExternalGameCategory) String() string

type ExternalGameService

type ExternalGameService service

ExternalGameService handles all the API calls for the IGDB ExternalGame endpoint.

func (*ExternalGameService) Count

func (es *ExternalGameService) Count(opts ...Option) (int, error)

Count returns the number of ExternalGames available in the IGDB. Provide the SetFilter functional option if you need to filter which ExternalGames to count.

func (*ExternalGameService) Fields

func (es *ExternalGameService) Fields() ([]string, error)

Fields returns the up-to-date list of fields in an IGDB ExternalGame object.

func (*ExternalGameService) Get

func (es *ExternalGameService) Get(id int, opts ...Option) (*ExternalGame, error)

Get returns a single ExternalGame identified by the provided IGDB ID. Provide the SetFields functional option if you need to specify which fields to retrieve. If the ID does not match any ExternalGames, an error is returned.

func (*ExternalGameService) Index

func (es *ExternalGameService) Index(opts ...Option) ([]*ExternalGame, error)

Index returns an index of ExternalGames based solely on the provided functional options used to sort, filter, and paginate the results. If no ExternalGames can be found using the provided options, an error is returned.

func (*ExternalGameService) List

func (es *ExternalGameService) List(ids []int, opts ...Option) ([]*ExternalGame, error)

List returns a list of ExternalGames identified by the provided list of IGDB IDs. Provide functional options to sort, filter, and paginate the results. Any ID that does not match a ExternalGame is ignored. If none of the IDs match a ExternalGame, an error is returned.

type Franchise

type Franchise struct {
	ID        int    `json:"id"`
	CreatedAt int    `json:"created_at"`
	Name      string `json:"name"`
	Slug      string `json:"slug"`
	UpdatedAt int    `json:"updated_at"`
	Url       string `json:"url"`
}

Franchise is a list of video game franchises such as Star Wars. For more information visit: https://api-docs.igdb.com/#franchise

type FranchiseService

type FranchiseService service

FranchiseService handles all the API calls for the IGDB Franchise endpoint.

func (*FranchiseService) Count

func (fs *FranchiseService) Count(opts ...Option) (int, error)

Count returns the number of Franchises available in the IGDB. Provide the SetFilter functional option if you need to filter which Franchises to count.

func (*FranchiseService) Fields

func (fs *FranchiseService) Fields() ([]string, error)

Fields returns the up-to-date list of fields in an IGDB Franchise object.

func (*FranchiseService) Get

func (fs *FranchiseService) Get(id int, opts ...Option) (*Franchise, error)

Get returns a single Franchise identified by the provided IGDB ID. Provide the SetFields functional option if you need to specify which fields to retrieve. If the ID does not match any Franchises, an error is returned.

func (*FranchiseService) Index

func (fs *FranchiseService) Index(opts ...Option) ([]*Franchise, error)

Index returns an index of Franchises based solely on the provided functional options used to sort, filter, and paginate the results. If no Franchises can be found using the provided options, an error is returned.

func (*FranchiseService) List

func (fs *FranchiseService) List(ids []int, opts ...Option) ([]*Franchise, error)

List returns a list of Franchises identified by the provided list of IGDB IDs. Provide functional options to sort, filter, and paginate the results. Any ID that does not match a Franchise is ignored. If none of the IDs match a Franchise, an error is returned.

type Game

type Game struct {
	ID                    int          `json:"id"`
	AgeRatings            []int        `json:"age_ratings"`
	AggregatedRating      float64      `json:"aggregated_rating"`
	AggregatedRatingCount int          `json:"aggregated_rating_count"`
	AlternativeNames      []int        `json:"alternative_names"`
	Artworks              []int        `json:"artworks"`
	Bundles               []int        `json:"bundles"`
	Category              GameCategory `json:"category"`
	Collection            int          `json:"collection"`
	Cover                 int          `json:"cover"`
	CreatedAt             int          `json:"created_at"`
	DLCS                  []int        `json:"dlcs"`
	Expansions            []int        `json:"expansions"`
	ExternalGames         []int        `json:"external_games"`
	FirstReleaseDate      int          `json:"first_release_date"`
	Follows               int          `json:"follows"`
	Franchise             int          `json:"franchise"`
	Franchises            []int        `json:"franchises"`
	GameEngines           []int        `json:"game_engines"`
	GameModes             []int        `json:"game_modes"`
	Genres                []int        `json:"genres"`
	Hypes                 int          `json:"hypes"`
	InvolvedCompanies     []int        `json:"involved_companies"`
	Keywords              []int        `json:"keywords"`
	MultiplayerModes      []int        `json:"multiplayer_modes"`
	Name                  string       `json:"name"`
	ParentGame            int          `json:"parent_game"`
	Platforms             []int        `json:"platforms"`
	PlayerPerspectives    []int        `json:"player_perspectives"`
	Rating                float64      `json:"rating"`
	RatingCount           int          `json:"rating_count"`
	ReleaseDates          []int        `json:"release_dates"`
	Screenshots           []int        `json:"screenshots"`
	SimilarGames          []int        `json:"similar_games"`
	Slug                  string       `json:"slug"`
	StandaloneExpansions  []int        `json:"standalone_expansions"`
	Status                GameStatus   `json:"status"`
	Storyline             string       `json:"storyline"`
	Summary               string       `json:"summary"`
	Tags                  []Tag        `json:"tags"`
	Themes                []int        `json:"themes"`
	TotalRating           float64      `json:"total_rating"`
	TotalRatingCount      int          `json:"total_rating_count"`
	UpdatedAt             int          `json:"updated_at"`
	URL                   string       `json:"url"`
	VersionParent         int          `json:"version_parent"`
	VersionTitle          string       `json:"version_title"`
	Videos                []int        `json:"videos"`
	Websites              []int        `json:"websites"`
}

Game contains information on an IGDB entry for a particular video game. For more information visit: https://api-docs.igdb.com/#game

type GameCategory

type GameCategory int

GameCategory specifies a type of game content.

const (
	MainGame GameCategory = iota
	DLCAddon
	Expansion
	Bundle
	StandaloneExpansion
	Mod
	Episode
	Season
	Remake
	Remaster
	ExpandedGame
	Port
	Fork
	Pack
	Update
)

Expected GameCategory enums from the IGDB.

func (GameCategory) String

func (i GameCategory) String() string

type GameEngine

type GameEngine struct {
	ID          int    `json:"id"`
	Companies   []int  `json:"companies"`
	CreatedAt   int    `json:"created_at"`
	Description string `json:"description"`
	Name        string `json:"name"`
	Platforms   []int  `json:"platforms"`
	Slug        string `json:"slug"`
	UpdatedAt   int    `json:"updated_at"`
	URL         string `json:"url"`
}

GameEngine represents a video game engine such as Unreal Engine. For more information visit: https://api-docs.igdb.com/#game-engine

type GameEngineLogo struct {
	Image
	ID int `json:"id"`
}

GameEngineLogo represents the logo of a particular game engine. For more information visit: https://api-docs.igdb.com/#game-engine-logo

type GameEngineLogoService

type GameEngineLogoService service

GameEngineLogoService handles all the API calls for the IGDB GameEngineLogo endpoint.

func (*GameEngineLogoService) Count

func (gs *GameEngineLogoService) Count(opts ...Option) (int, error)

Count returns the number of GameEngineLogos available in the IGDB. Provide the SetFilter functional option if you need to filter which GameEngineLogos to count.

func (*GameEngineLogoService) Fields

func (gs *GameEngineLogoService) Fields() ([]string, error)

Fields returns the up-to-date list of fields in an IGDB GameEngineLogo object.

func (*GameEngineLogoService) Get

func (gs *GameEngineLogoService) Get(id int, opts ...Option) (*GameEngineLogo, error)

Get returns a single GameEngineLogo identified by the provided IGDB ID. Provide the SetFields functional option if you need to specify which fields to retrieve. If the ID does not match any GameEngineLogos, an error is returned.

func (*GameEngineLogoService) Index

func (gs *GameEngineLogoService) Index(opts ...Option) ([]*GameEngineLogo, error)

Index returns an index of GameEngineLogos based solely on the provided functional options used to sort, filter, and paginate the results. If no GameEngineLogos can be found using the provided options, an error is returned.

func (*GameEngineLogoService) List

func (gs *GameEngineLogoService) List(ids []int, opts ...Option) ([]*GameEngineLogo, error)

List returns a list of GameEngineLogos identified by the provided list of IGDB IDs. Provide functional options to sort, filter, and paginate the results. Any ID that does not match a GameEngineLogo is ignored. If none of the IDs match a GameEngineLogo, an error is returned.

type GameEngineService

type GameEngineService service

GameEngineService handles all the API calls for the IGDB GameEngine endpoint.

func (*GameEngineService) Count

func (gs *GameEngineService) Count(opts ...Option) (int, error)

Count returns the number of GameEngines available in the IGDB. Provide the SetFilter functional option if you need to filter which GameEngines to count.

func (*GameEngineService) Fields

func (gs *GameEngineService) Fields() ([]string, error)

Fields returns the up-to-date list of fields in an IGDB GameEngine object.

func (*GameEngineService) Get

func (gs *GameEngineService) Get(id int, opts ...Option) (*GameEngine, error)

Get returns a single GameEngine identified by the provided IGDB ID. Provide the SetFields functional option if you need to specify which fields to retrieve. If the ID does not match any GameEngines, an error is returned.

func (*GameEngineService) Index

func (gs *GameEngineService) Index(opts ...Option) ([]*GameEngine, error)

Index returns an index of GameEngines based solely on the provided functional options used to sort, filter, and paginate the results. If no GameEngines can be found using the provided options, an error is returned.

func (*GameEngineService) List

func (gs *GameEngineService) List(ids []int, opts ...Option) ([]*GameEngine, error)

List returns a list of GameEngines identified by the provided list of IGDB IDs. Provide functional options to sort, filter, and paginate the results. Any ID that does not match a GameEngine is ignored. If none of the IDs match a GameEngine, an error is returned.

type GameMode

type GameMode struct {
	CreatedAt int    `json:"created_at"`
	Name      string `json:"name"`
	Slug      string `json:"slug"`
	UpdatedAt int    `json:"updated_at"`
	URL       string `json:"url"`
}

GameMode represents a video game mode such as single or multi player. For more information visit: https://api-docs.igdb.com/#game-mode

type GameModeService

type GameModeService service

GameModeService handles all the API calls for the IGDB GameMode endpoint.

func (*GameModeService) Count

func (gs *GameModeService) Count(opts ...Option) (int, error)

Count returns the number of GameModes available in the IGDB. Provide the SetFilter functional option if you need to filter which GameModes to count.

func (*GameModeService) Fields

func (gs *GameModeService) Fields() ([]string, error)

Fields returns the up-to-date list of fields in an IGDB GameMode object.

func (*GameModeService) Get

func (gs *GameModeService) Get(id int, opts ...Option) (*GameMode, error)

Get returns a single GameMode identified by the provided IGDB ID. Provide the SetFields functional option if you need to specify which fields to retrieve. If the ID does not match any GameModes, an error is returned.

func (*GameModeService) Index

func (gs *GameModeService) Index(opts ...Option) ([]*GameMode, error)

Index returns an index of GameModes based solely on the provided functional options used to sort, filter, and paginate the results. If no GameModes can be found using the provided options, an error is returned.

func (*GameModeService) List

func (gs *GameModeService) List(ids []int, opts ...Option) ([]*GameMode, error)

List returns a list of GameModes identified by the provided list of IGDB IDs. Provide functional options to sort, filter, and paginate the results. Any ID that does not match a GameMode is ignored. If none of the IDs match a GameMode, an error is returned.

type GameService

type GameService service

GameService handles all the API calls for the IGDB Game endpoint.

func (*GameService) Count

func (gs *GameService) Count(opts ...Option) (int, error)

Count returns the number of Games available in the IGDB. Provide the SetFilter functional option if you need to filter which Games to count.

Example
c := NewClient("YOUR_CLIENT_ID", "YOUR_APP_ACCESS_TOKEN", nil)

ct, err := c.Games.Count(SetFilter("created_at", OpGreaterThan, "1993-12-15"))
if err != nil {
	fmt.Println(err)
	return
}

fmt.Println("Number of games created after December 15, 1993: ", ct)
Output:

func (*GameService) Fields

func (gs *GameService) Fields() ([]string, error)

Fields returns the up-to-date list of fields in an IGDB Game object.

Example
c := NewClient("YOUR_CLIENT_ID", "YOUR_APP_ACCESS_TOKEN", nil)

fl, err := c.Games.Fields()
if err != nil {
	fmt.Println(err)
	return
}

fmt.Println("List of available fields for the IGDB Game object: ", fl)
Output:

func (*GameService) Get

func (gs *GameService) Get(id int, opts ...Option) (*Game, error)

Get returns a single Game identified by the provided IGDB ID. Provide the SetFields functional option if you need to specify which fields to retrieve. If the ID does not match any Games, an error is returned.

Example
c := NewClient("YOUR_CLIENT_ID", "YOUR_APP_ACCESS_TOKEN", nil)

g, err := c.Games.Get(7346, SetFields("name", "url", "summary", "storyline", "rating", "hypes", "cover"))
if err != nil {
	fmt.Println(err)
	return
}

fmt.Println("IGDB entry for The Legend of Zelda: Breath of the Wild\n", *g)
Output:

func (*GameService) Index

func (gs *GameService) Index(opts ...Option) ([]*Game, error)

Index returns an index of Games based solely on the provided functional options used to sort, filter, and paginate the results. If no Games can be found using the provided options, an error is returned.

Example
c := NewClient("YOUR_CLIENT_ID", "YOUR_APP_ACCESS_TOKEN", nil)

g, err := c.Games.Index(
	SetLimit(5),
	SetFilter("hypes", OpGreaterThan, "80"),
)
if err != nil {
	fmt.Println(err)
	return
}

fmt.Println("IGDB entries for 5 Games with hypes above 80")
for _, v := range g {
	fmt.Println(*v)
}
Output:

func (*GameService) List

func (gs *GameService) List(ids []int, opts ...Option) ([]*Game, error)

List returns a list of Games identified by the provided list of IGDB IDs. Provide functional options to sort, filter, and paginate the results. Any ID that does not match a Game is ignored. If none of the IDs match a Game, an error is returned.

Example
c := NewClient("YOUR_CLIENT_ID", "YOUR_APP_ACCESS_TOKEN", nil)

g, err := c.Games.List([]int{1721, 2777, 1074})
if err != nil {
	fmt.Println(err)
	return
}

fmt.Println("IGDB entries for Megaman 8, Kirby Air Ride, and Super Mario 64")
for _, v := range g {
	fmt.Println(*v)
}
Output:

func (*GameService) Search

func (gs *GameService) Search(qry string, opts ...Option) ([]*Game, error)

Search returns a list of Games found by searching the IGDB using the provided query. Provide functional options to sort, filter, and paginate the results. If no Games are found using the provided query, an error is returned.

Example
c := NewClient("YOUR_CLIENT_ID", "YOUR_APP_ACCESS_TOKEN", nil)

g, err := c.Games.Search(
	"mario",
	SetFields("*"),
	SetFilter("rating", OpGreaterThanEqual, "80"),
	SetOrder("rating", OrderDescending),
	SetLimit(3))
if err != nil {
	fmt.Println(err)
	return
}

fmt.Println("IGDB entries for Super Mario 64, Mario Kart 8, and Mario Party")
for _, v := range g {
	fmt.Println(*v)
}
Output:

type GameStatus

type GameStatus int

GameStatus specifies the release status of a specific game.

const (
	StatusReleased GameStatus = iota

	StatusAlpha
	StatusBeta
	StatusEarlyAccess
	StatusOffline
	StatusCancelled
)

Expected GameStatus enums from the IGDB.

func (GameStatus) String

func (i GameStatus) String() string

type GameVersion

type GameVersion struct {
	CreatedAt int    `json:"created_at"`
	Features  []int  `json:"features"`
	Game      int    `json:"game"`
	Games     []int  `json:"games"`
	UpdatedAt int    `json:"updated_at"`
	URL       string `json:"url"`
}

GameVersion provides details about game editions and versions. For more information visit: https://api-docs.igdb.com/#game-version

type GameVersionFeature

type GameVersionFeature struct {
	ID          int                    `json:"id"`
	Category    VersionFeatureCategory `json:"category"`
	Description string                 `json:"description"`
	Position    int                    `json:"position"`
	Title       string                 `json:"title"`
	Values      []int                  `json:"values"`
}

GameVersionFeature represents features and descriptions of what makes each version/edition different from their main game. For more information visit: https://api-docs.igdb.com/#game-version-feature

type GameVersionFeatureService

type GameVersionFeatureService service

GameVersionFeatureService handles all the API calls for the IGDB GameVersionFeature endpoint.

func (*GameVersionFeatureService) Count

func (gs *GameVersionFeatureService) Count(opts ...Option) (int, error)

Count returns the number of GameVersionFeatures available in the IGDB. Provide the SetFilter functional option if you need to filter which GameVersionFeatures to count.

func (*GameVersionFeatureService) Fields

func (gs *GameVersionFeatureService) Fields() ([]string, error)

Fields returns the up-to-date list of fields in an IGDB GameVersionFeature object.

func (*GameVersionFeatureService) Get

func (gs *GameVersionFeatureService) Get(id int, opts ...Option) (*GameVersionFeature, error)

Get returns a single GameVersionFeature identified by the provided IGDB ID. Provide the SetFields functional option if you need to specify which fields to retrieve. If the ID does not match any GameVersionFeatures, an error is returned.

func (*GameVersionFeatureService) Index

func (gs *GameVersionFeatureService) Index(opts ...Option) ([]*GameVersionFeature, error)

Index returns an index of GameVersionFeatures based solely on the provided functional options used to sort, filter, and paginate the results. If no GameVersionFeatures can be found using the provided options, an error is returned.

func (*GameVersionFeatureService) List

func (gs *GameVersionFeatureService) List(ids []int, opts ...Option) ([]*GameVersionFeature, error)

List returns a list of GameVersionFeatures identified by the provided list of IGDB IDs. Provide functional options to sort, filter, and paginate the results. Any ID that does not match a GameVersionFeature is ignored. If none of the IDs match a GameVersionFeature, an error is returned.

type GameVersionFeatureValue

type GameVersionFeatureValue struct {
	ID              int                     `json:"id"`
	Game            int                     `json:"game"`
	GameFeature     int                     `json:"game_feature"`
	IncludedFeature VersionFeatureInclusion `json:"included_feature"`
	Note            string                  `json:"note"`
}

GameVersionFeatureValue represents the bool/text value of a particular feature. For more information visit: https://api-docs.igdb.com/#game-version-feature-value

type GameVersionFeatureValueService

type GameVersionFeatureValueService service

GameVersionFeatureValueService handles all the API calls for the IGDB GameVersionFeatureValue endpoint.

func (*GameVersionFeatureValueService) Count

func (gs *GameVersionFeatureValueService) Count(opts ...Option) (int, error)

Count returns the number of GameVersionFeatureValues available in the IGDB. Provide the SetFilter functional option if you need to filter which GameVersionFeatureValues to count.

func (*GameVersionFeatureValueService) Fields

func (gs *GameVersionFeatureValueService) Fields() ([]string, error)

Fields returns the up-to-date list of fields in an IGDB GameVersionFeatureValue object.

func (*GameVersionFeatureValueService) Get

Get returns a single GameVersionFeatureValue identified by the provided IGDB ID. Provide the SetFields functional option if you need to specify which fields to retrieve. If the ID does not match any GameVersionFeatureValues, an error is returned.

func (*GameVersionFeatureValueService) Index

Index returns an index of GameVersionFeatureValues based solely on the provided functional options used to sort, filter, and paginate the results. If no GameVersionFeatureValues can be found using the provided options, an error is returned.

func (*GameVersionFeatureValueService) List

List returns a list of GameVersionFeatureValues identified by the provided list of IGDB IDs. Provide functional options to sort, filter, and paginate the results. Any ID that does not match a GameVersionFeatureValue is ignored. If none of the IDs match a GameVersionFeatureValue, an error is returned.

type GameVersionService

type GameVersionService service

GameVersionService handles all the API calls for the IGDB GameVersion endpoint.

func (*GameVersionService) Count

func (gs *GameVersionService) Count(opts ...Option) (int, error)

Count returns the number of GameVersions available in the IGDB. Provide the SetFilter functional option if you need to filter which GameVersions to count.

func (*GameVersionService) Fields

func (gs *GameVersionService) Fields() ([]string, error)

Fields returns the up-to-date list of fields in an IGDB GameVersion object.

func (*GameVersionService) Get

func (gs *GameVersionService) Get(id int, opts ...Option) (*GameVersion, error)

Get returns a single GameVersion identified by the provided IGDB ID. Provide the SetFields functional option if you need to specify which fields to retrieve. If the ID does not match any GameVersions, an error is returned.

func (*GameVersionService) Index

func (gs *GameVersionService) Index(opts ...Option) ([]*GameVersion, error)

Index returns an index of GameVersions based solely on the provided functional options used to sort, filter, and paginate the results. If no GameVersions can be found using the provided options, an error is returned.

func (*GameVersionService) List

func (gs *GameVersionService) List(ids []int, opts ...Option) ([]*GameVersion, error)

List returns a list of GameVersions identified by the provided list of IGDB IDs. Provide functional options to sort, filter, and paginate the results. Any ID that does not match a GameVersion is ignored. If none of the IDs match a GameVersion, an error is returned.

type GameVideo

type GameVideo struct {
	Game    int    `json:"game"`
	Name    string `json:"name"`
	VideoID string `json:"video_id"`
}

GameVideo represents a video associated with a particular game. For more information visit: https://api-docs.igdb.com/#game-video

type GameVideoService

type GameVideoService service

GameVideoService handles all the API calls for the IGDB GameVideo endpoint.

func (*GameVideoService) Count

func (gs *GameVideoService) Count(opts ...Option) (int, error)

Count returns the number of GameVideos available in the IGDB. Provide the SetFilter functional option if you need to filter which GameVideos to count.

func (*GameVideoService) Fields

func (gs *GameVideoService) Fields() ([]string, error)

Fields returns the up-to-date list of fields in an IGDB GameVideo object.

func (*GameVideoService) Get

func (gs *GameVideoService) Get(id int, opts ...Option) (*GameVideo, error)

Get returns a single GameVideo identified by the provided IGDB ID. Provide the SetFields functional option if you need to specify which fields to retrieve. If the ID does not match any GameVideos, an error is returned.

func (*GameVideoService) Index

func (gs *GameVideoService) Index(opts ...Option) ([]*GameVideo, error)

Index returns an index of GameVideos based solely on the provided functional options used to sort, filter, and paginate the results. If no GameVideos can be found using the provided options, an error is returned.

func (*GameVideoService) List

func (gs *GameVideoService) List(ids []int, opts ...Option) ([]*GameVideo, error)

List returns a list of GameVideos identified by the provided list of IGDB IDs. Provide functional options to sort, filter, and paginate the results. Any ID that does not match a GameVideo is ignored. If none of the IDs match a GameVideo, an error is returned.

type Genre

type Genre struct {
	ID        int    `json:"id"`
	CreatedAt int    `json:"created_at"`
	Name      string `json:"name"`
	Slug      string `json:"slug"`
	UpdatedAt int    `json:"updated_at"`
	URL       string `json:"url"`
}

Genre represents the genre of a particular video game. For more information visit: https://api-docs.igdb.com/#genre

type GenreService

type GenreService service

GenreService handles all the API calls for the IGDB Genre endpoint.

func (*GenreService) Count

func (gs *GenreService) Count(opts ...Option) (int, error)

Count returns the number of Genres available in the IGDB. Provide the SetFilter functional option if you need to filter which Genres to count.

func (*GenreService) Fields

func (gs *GenreService) Fields() ([]string, error)

Fields returns the up-to-date list of fields in an IGDB Genre object.

func (*GenreService) Get

func (gs *GenreService) Get(id int, opts ...Option) (*Genre, error)

Get returns a single Genre identified by the provided IGDB ID. Provide the SetFields functional option if you need to specify which fields to retrieve. If the ID does not match any Genres, an error is returned.

func (*GenreService) Index

func (gs *GenreService) Index(opts ...Option) ([]*Genre, error)

Index returns an index of Genres based solely on the provided functional options used to sort, filter, and paginate the results. If no Genres can be found using the provided options, an error is returned.

func (*GenreService) List

func (gs *GenreService) List(ids []int, opts ...Option) ([]*Genre, error)

List returns a list of Genres identified by the provided list of IGDB IDs. Provide functional options to sort, filter, and paginate the results. Any ID that does not match a Genre is ignored. If none of the IDs match a Genre, an error is returned.

type Image

type Image struct {
	AlphaChannel bool   `json:"alpha_channel"`
	Animated     bool   `json:"animated"`
	Height       int    `json:"height"`
	ImageID      string `json:"image_id"`
	URL          string `json:"url"`
	Width        int    `json:"width"`
}

Image contains the URL, dimensions, and ID of a particular image. For more information visit: https://api-docs.igdb.com/#images

func (Image) SizedURL

func (i Image) SizedURL(size imageSize, ratio int) (string, error)

SizedURL returns the URL of this image at the provided image size and display pixel ratio. The display pixel ratio only multiplies the resolution of the image. The current available ratios are 1 and 2.

type InvolvedCompany

type InvolvedCompany struct {
	ID         int  `json:"id"`
	Company    int  `json:"company"`
	CreatedAt  int  `json:"created_at"`
	Developer  bool `json:"developer"`
	Game       int  `json:"game"`
	Porting    bool `json:"porting"`
	Publisher  bool `json:"publisher"`
	Supporting bool `json:"supporting"`
	UpdatedAt  int  `json:"updated_at"`
}

InvolvedCompany represents a company involved in the development of a particular video game. For more information visit: https://api-docs.igdb.com/#involved-company

type InvolvedCompanyService

type InvolvedCompanyService service

InvolvedCompanyService handles all the API calls for the IGDB InvolvedCompany endpoint.

func (*InvolvedCompanyService) Count

func (is *InvolvedCompanyService) Count(opts ...Option) (int, error)

Count returns the number of InvolvedCompanies available in the IGDB. Provide the SetFilter functional option if you need to filter which InvolvedCompanies to count.

func (*InvolvedCompanyService) Fields

func (is *InvolvedCompanyService) Fields() ([]string, error)

Fields returns the up-to-date list of fields in an IGDB InvolvedCompany object.

func (*InvolvedCompanyService) Get

func (is *InvolvedCompanyService) Get(id int, opts ...Option) (*InvolvedCompany, error)

Get returns a single InvolvedCompany identified by the provided IGDB ID. Provide the SetFields functional option if you need to specify which fields to retrieve. If the ID does not match any InvolvedCompanies, an error is returned.

func (*InvolvedCompanyService) Index

func (is *InvolvedCompanyService) Index(opts ...Option) ([]*InvolvedCompany, error)

Index returns an index of InvolvedCompanies based solely on the provided functional options used to sort, filter, and paginate the results. If no InvolvedCompanies can be found using the provided options, an error is returned.

func (*InvolvedCompanyService) List

func (is *InvolvedCompanyService) List(ids []int, opts ...Option) ([]*InvolvedCompany, error)

List returns a list of InvolvedCompanies identified by the provided list of IGDB IDs. Provide functional options to sort, filter, and paginate the results. Any ID that does not match a InvolvedCompany is ignored. If none of the IDs match a InvolvedCompany, an error is returned.

type Keyword

type Keyword struct {
	CreatedAt int    `json:"created_at"`
	Name      string `json:"name"`
	Slug      string `json:"slug"`
	UpdatedAt int    `json:"updated_at"`
	Url       string `json:"url"`
}

Keyword represents a word or phrase that get tagged to a game such as "World War 2" or "Steampunk". For more information visit: https://api-docs.igdb.com/#keyword

type KeywordService

type KeywordService service

KeywordService handles all the API calls for the IGDB Keyword endpoint.

func (*KeywordService) Count

func (ks *KeywordService) Count(opts ...Option) (int, error)

Count returns the number of Keywords available in the IGDB. Provide the SetFilter functional option if you need to filter which Keywords to count.

func (*KeywordService) Fields

func (ks *KeywordService) Fields() ([]string, error)

Fields returns the up-to-date list of fields in an IGDB Keyword object.

func (*KeywordService) Get

func (ks *KeywordService) Get(id int, opts ...Option) (*Keyword, error)

Get returns a single Keyword identified by the provided IGDB ID. Provide the SetFields functional option if you need to specify which fields to retrieve. If the ID does not match any Keywords, an error is returned.

func (*KeywordService) Index

func (ks *KeywordService) Index(opts ...Option) ([]*Keyword, error)

Index returns an index of Keywords based solely on the provided functional options used to sort, filter, and paginate the results. If no Keywords can be found using the provided options, an error is returned.

func (*KeywordService) List

func (ks *KeywordService) List(ids []int, opts ...Option) ([]*Keyword, error)

List returns a list of Keywords identified by the provided list of IGDB IDs. Provide functional options to sort, filter, and paginate the results. Any ID that does not match a Keyword is ignored. If none of the IDs match a Keyword, an error is returned.

type MultiplayerMode

type MultiplayerMode struct {
	Campaigncoop      bool `json:"campaigncoop"`
	Dropin            bool `json:"dropin"`
	Lancoop           bool `json:"lancoop"`
	Offlinecoop       bool `json:"offlinecoop"`
	Offlinecoopmax    int  `json:"offlinecoopmax"`
	Offlinemax        int  `json:"offlinemax"`
	Onlinecoop        bool `json:"onlinecoop"`
	Onlinecoopmax     int  `json:"onlinecoopmax"`
	Onlinemax         int  `json:"onlinemax"`
	Platform          int  `json:"platform"`
	Splitscreen       bool `json:"splitscreen"`
	Splitscreenonline bool `json:"splitscreenonline"`
}

MultiplayerMode contains data about the supported multiplayer types. For more information visit: https://api-docs.igdb.com/#multiplayer-mode

type MultiplayerModeService

type MultiplayerModeService service

MultiplayerModeService handles all the API calls for the IGDB MultiplayerMode endpoint.

func (*MultiplayerModeService) Count

func (ms *MultiplayerModeService) Count(opts ...Option) (int, error)

Count returns the number of MultiplayerModes available in the IGDB. Provide the SetFilter functional option if you need to filter which MultiplayerModes to count.

func (*MultiplayerModeService) Fields

func (ms *MultiplayerModeService) Fields() ([]string, error)

Fields returns the up-to-date list of fields in an IGDB MultiplayerMode object.

func (*MultiplayerModeService) Get

func (ms *MultiplayerModeService) Get(id int, opts ...Option) (*MultiplayerMode, error)

Get returns a single MultiplayerMode identified by the provided IGDB ID. Provide the SetFields functional option if you need to specify which fields to retrieve. If the ID does not match any MultiplayerModes, an error is returned.

func (*MultiplayerModeService) Index

func (ms *MultiplayerModeService) Index(opts ...Option) ([]*MultiplayerMode, error)

Index returns an index of MultiplayerModes based solely on the provided functional options used to sort, filter, and paginate the results. If no MultiplayerModes can be found using the provided options, an error is returned.

func (*MultiplayerModeService) List

func (ms *MultiplayerModeService) List(ids []int, opts ...Option) ([]*MultiplayerMode, error)

List returns a list of MultiplayerModes identified by the provided list of IGDB IDs. Provide functional options to sort, filter, and paginate the results. Any ID that does not match a MultiplayerMode is ignored. If none of the IDs match a MultiplayerMode, an error is returned.

type Option

type Option func() (apicalypse.Option, error)

Option functions are used to set the options for an API call. Option is the first-order function returned by the available functional options (e.g. SetLimit or SetFilter). This first-order function is then passed into a service's Get, List, Index, Search, or Count function.

func ComposeOptions

func ComposeOptions(opts ...Option) Option

ComposeOptions composes multiple functional options into a single Option. This is primarily used to create a single functional option that can be used repeatedly across multiple queries.

Example
c := NewClient("YOUR_CLIENT_ID", "YOUR_APP_ACCESS_TOKEN", nil)

// Composing FuncOptions to filter for top 5 popular games
composed := ComposeOptions(
	SetLimit(5),
	SetFields("name", "cover"),
	SetOrder("hypes", OrderDescending),
	SetFilter("category", OpEquals, "0"),
)

// Using composed FuncOptions
PS4, err := c.Games.Index(
	composed,
	SetFilter("platforms", OpEquals, "48"), // only PS4 games
)
if err != nil {
	log.Fatal(err)
}

// Reusing composed FuncOptions
XBOX, err := c.Games.Index(
	composed,
	SetFilter("platforms", OpEquals, "49"), // only XBOX games
)
if err != nil {
	log.Fatal(err)
}

fmt.Println("Top 5 PS4 Games: ")
for _, v := range PS4 {
	fmt.Println(*v)
}

fmt.Println("Top 5 Xbox Games: ")
for _, v := range XBOX {
	fmt.Println(*v)
}
Output:

func SetExclude

func SetExclude(fields ...string) Option

SetExclude is a functional option used to specify which fields of the requested IGDB object you want the API to exclude. Note that the field string must match an IGDB object's JSON field tag exactly, not the Go struct name.

For more information, visit: https://api-docs.igdb.com/#exclude

Example
c := NewClient("YOUR_CLIENT_ID", "YOUR_APP_ACCESS_TOKEN", nil)

// Exclude name field
c.Characters.Search("mario", SetFields("name"))

// Exclude gender field
c.Characters.Search("mario", SetFields("gender"))

// Exclude both name and gender field
c.Characters.Search("mario", SetFields("name", "gender"))

// Exclude whole mug_shot field
c.Characters.Search("mario", SetFields("mug_shot"))

// Exclude any number of fields
c.Characters.Search("mario", SetFields("name", "gender", "url", "species", "games", "mug_shot"))

// Exclude all available fields
c.Characters.Search("mario", SetFields("*"))
Output:

func SetFields

func SetFields(fields ...string) Option

SetFields is a functional option used to specify which fields of the requested IGDB object you want the API to provide. Subfields are accessed with a dot operator (e.g. cover.url). To select all available fields at once, use an asterisk character (i.e. *). Note that the field string must match an IGDB object's JSON field tag exactly, not the Go struct field name.

For more information, visit: https://api-docs.igdb.com/#fields

Example
c := NewClient("YOUR_CLIENT_ID", "YOUR_APP_ACCESS_TOKEN", nil)

// Retrieve name field
c.Characters.Search("mario", SetFields("name"))

// Retrieve gender field
c.Characters.Search("mario", SetFields("gender"))

// Retrieve both name and gender field
c.Characters.Search("mario", SetFields("name", "gender"))

// Retrieve whole mug_shot field
c.Characters.Search("mario", SetFields("mug_shot"))

// Retrieve any number of fields
c.Characters.Search("mario", SetFields("name", "gender", "url", "species", "games", "mug_shot"))

// Retrieve all available fields
c.Characters.Search("mario", SetFields("*"))
Output:

func SetFilter

func SetFilter(field string, op operator, val ...string) Option

SetFilter is a functional option used to filter the results from an API call. Filtering operations need three different arguments: an operator and 2 operands, the field and its value. The provided field and val string act as the operands for the provided operator. If multiple values are provided, they will be concatenated into a comma separated list. If no values are provided, an error is returned.

SetFilter is the only option allowed to be set multiple times in a single API call. By default, results are unfiltered.

Note that when filtering a field that consists of an enumerated type (e.g. Gender Code, Feed Category, Game Status, etc.), you must provide the number corresponding to the intended field value. For your convenience, you may also provide the enumerated constant.

For more information, visit: https://api-docs.igdb.com/#filters

Example
c := NewClient("YOUR_CLIENT_ID", "YOUR_APP_ACCESS_TOKEN", nil)

// Retrieve unfiltered games - default
c.Games.Index()

// Retrieve games with popularity above 50
c.Games.Index(SetFilter("hypes", OpGreaterThan, "50"))

// Retrieve games with cover art
c.Games.Index(SetFilter("cover", OpNotEquals, "null"))

// Retrieve games released on PS4 (platform ID of 48)
c.Games.Index(SetFilter("platforms", OpEquals, "48"))

// Retrieve games whose name does not match "Horizon: Zero Dawn"
c.Games.Index(SetFilter("name", OpNotEquals, "Horizon: Zero Dawn"))

// Retrieve games which have the Adventure genre (Genre ID of 31)
c.Games.Index(SetFilter("genres", OpContainsAtLeast, "31"))

// Retrieve games that meet all the previous requirements
c.Games.Index(
	SetFilter("hypes", OpGreaterThan, "50"),
	SetFilter("cover", OpNotEquals, "null"),
	SetFilter("platforms", OpEquals, "48"),
	SetFilter("name", OpNotEquals, "Horizon: Zero Dawn"),
	SetFilter("genres", OpContainsAtLeast, "31"),
)
Output:

func SetLimit

func SetLimit(lim int) Option

SetLimit is a functional option used to limit the number of results from an API call. The default limit is 10. The maximum limit is 500.

For more information, visit: https://api-docs.igdb.com/#pagination

Example
c := NewClient("YOUR_CLIENT_ID", "YOUR_APP_ACCESS_TOKEN", nil)

// Retrieve up to 10 results - default
c.Characters.Search("snake")

// Retrieve up to 50 results
c.Characters.Search("snake", SetLimit(50))

// Retrieve up to 1 result
c.Characters.Search("snake", SetLimit(1))
Output:

func SetOffset

func SetOffset(off int) Option

SetOffset is a functional option used to offset the results from an API call. The default offset is 0.

For more information, visit: https://api-docs.igdb.com/#pagination

Example
c := NewClient("YOUR_CLIENT_ID", "YOUR_APP_ACCESS_TOKEN", nil)

batchLimit := SetLimit(50)

// Retrieve first batch of results - default
c.Games.Index(batchLimit)

// Retrieve second batch of results
c.Games.Index(batchLimit, SetOffset(50))

// Retrieve third batch of results
c.Games.Index(batchLimit, SetOffset(100))

// Retrieve fourth batch of results
c.Games.Index(batchLimit, SetOffset(150))
Output:

func SetOrder

func SetOrder(field string, order order) Option

SetOrder is a functional option used to sort the results from an API call. The default order is by relevance.

For more information, visit: https://api-docs.igdb.com/#sorting

Example
c := NewClient("YOUR_CLIENT_ID", "YOUR_APP_ACCESS_TOKEN", nil)

// Retrieve most relevant games - default
c.Games.Search("zelda")

// Retrieve most hyped games
c.Games.Search("zelda", SetOrder("hypes", OrderDescending))

// Retrieve least hyped games
c.Games.Search("zelda", SetOrder("hypes", OrderAscending))
Output:

type Platform

type Platform struct {
	ID              int              `json:"id"`
	Abbreviation    string           `json:"abbreviation"`
	AlternativeName string           `json:"alternative_name"`
	Category        PlatformCategory `json:"category"`
	CreatedAt       int              `json:"created_at"`
	Generation      int              `json:"generation"`
	Name            string           `json:"name"`
	ProductFamily   int              `json:"product_family"`
	Slug            string           `json:"slug"`
	Summary         string           `json:"summary"`
	UpdatedAt       int              `json:"updated_at"`
	URL             string           `json:"url"`
	Versions        []int            `json:"versions"`
	Websites        []int            `json:"websites"`
}

Platform represents the hardware used to run the game or game delivery network. For more information visit: https://api-docs.igdb.com/#platform

type PlatformCategory

type PlatformCategory int

PlatformCategory specifies a type of platform.

const (
	PlatformConsole PlatformCategory = iota + 1
	PlatformArcade
	PlatformPlatform
	PlatformOperatingSystem
	PlatformPortableConsole
	PlatformComputer
)

Expected PlatformCategory enums from the IGDB.

func (PlatformCategory) String

func (i PlatformCategory) String() string

type PlatformFamily

type PlatformFamily struct {
	ID   int    `json:"id"`
	Name string `json:"name"`
	Slug string `json:"slug"`
}

PlatformFamily represents a collection of closely related platforms. For more information visit: https://api-docs.igdb.com/#platform-family

type PlatformFamilyService

type PlatformFamilyService service

PlatformFamilyService handles all the API calls for the IGDB PlatformFamily endpoint.

func (*PlatformFamilyService) Count

func (ps *PlatformFamilyService) Count(opts ...Option) (int, error)

Count returns the number of PlatformFamilies available in the IGDB. Provide the SetFilter functional option if you need to filter which PlatformFamilies to count.

func (*PlatformFamilyService) Fields

func (ps *PlatformFamilyService) Fields() ([]string, error)

Fields returns the up-to-date list of fields in an IGDB PlatformFamily object.

func (*PlatformFamilyService) Get

func (ps *PlatformFamilyService) Get(id int, opts ...Option) (*PlatformFamily, error)

Get returns a single PlatformFamily identified by the provided IGDB ID. Provide the SetFields functional option if you need to specify which fields to retrieve. If the ID does not match any PlatformFamilies, an error is returned.

func (*PlatformFamilyService) Index

func (ps *PlatformFamilyService) Index(opts ...Option) ([]*PlatformFamily, error)

Index returns an index of PlatformFamilies based solely on the provided functional options used to sort, filter, and paginate the results. If no PlatformFamilies can be found using the provided options, an error is returned.

func (*PlatformFamilyService) List

func (ps *PlatformFamilyService) List(ids []int, opts ...Option) ([]*PlatformFamily, error)

List returns a list of PlatformFamilies identified by the provided list of IGDB IDs. Provide functional options to sort, filter, and paginate the results. Any ID that does not match a PlatformFamily is ignored. If none of the IDs match a PlatformFamily, an error is returned.

type PlatformLogo struct {
	Image
	ID int `json:"id"`
}

PlatformLogo represents a logo for a particular platform. For more information visit: https://api-docs.igdb.com/#platform-logo

type PlatformLogoService

type PlatformLogoService service

PlatformLogoService handles all the API calls for the IGDB PlatformLogo endpoint.

func (*PlatformLogoService) Count

func (ps *PlatformLogoService) Count(opts ...Option) (int, error)

Count returns the number of PlatformLogos available in the IGDB. Provide the SetFilter functional option if you need to filter which PlatformLogos to count.

func (*PlatformLogoService) Fields

func (ps *PlatformLogoService) Fields() ([]string, error)

Fields returns the up-to-date list of fields in an IGDB PlatformLogo object.

func (*PlatformLogoService) Get

func (ps *PlatformLogoService) Get(id int, opts ...Option) (*PlatformLogo, error)

Get returns a single PlatformLogo identified by the provided IGDB ID. Provide the SetFields functional option if you need to specify which fields to retrieve. If the ID does not match any PlatformLogos, an error is returned.

func (*PlatformLogoService) Index

func (ps *PlatformLogoService) Index(opts ...Option) ([]*PlatformLogo, error)

Index returns an index of PlatformLogos based solely on the provided functional options used to sort, filter, and paginate the results. If no PlatformLogos can be found using the provided options, an error is returned.

func (*PlatformLogoService) List

func (ps *PlatformLogoService) List(ids []int, opts ...Option) ([]*PlatformLogo, error)

List returns a list of PlatformLogos identified by the provided list of IGDB IDs. Provide functional options to sort, filter, and paginate the results. Any ID that does not match a PlatformLogo is ignored. If none of the IDs match a PlatformLogo, an error is returned.

type PlatformService

type PlatformService service

PlatformService handles all the API calls for the IGDB Platform endpoint.

func (*PlatformService) Count

func (ps *PlatformService) Count(opts ...Option) (int, error)

Count returns the number of Platforms available in the IGDB. Provide the SetFilter functional option if you need to filter which Platforms to count.

func (*PlatformService) Fields

func (ps *PlatformService) Fields() ([]string, error)

Fields returns the up-to-date list of fields in an IGDB Platform object.

func (*PlatformService) Get

func (ps *PlatformService) Get(id int, opts ...Option) (*Platform, error)

Get returns a single Platform identified by the provided IGDB ID. Provide the SetFields functional option if you need to specify which fields to retrieve. If the ID does not match any Platforms, an error is returned.

func (*PlatformService) Index

func (ps *PlatformService) Index(opts ...Option) ([]*Platform, error)

Index returns an index of Platforms based solely on the provided functional options used to sort, filter, and paginate the results. If no Platforms can be found using the provided options, an error is returned.

func (*PlatformService) List

func (ps *PlatformService) List(ids []int, opts ...Option) ([]*Platform, error)

List returns a list of Platforms identified by the provided list of IGDB IDs. Provide functional options to sort, filter, and paginate the results. Any ID that does not match a Platform is ignored. If none of the IDs match a Platform, an error is returned.

func (*PlatformService) Search

func (ps *PlatformService) Search(qry string, opts ...Option) ([]*Platform, error)

Search returns a list of Platforms found by searching the IGDB using the provided query. Provide functional options to sort, filter, and paginate the results. If no Platforms are found using the provided query, an error is returned.

type PlatformVersion

type PlatformVersion struct {
	ID                          int    `json:"id"`
	Companies                   []int  `json:"companies"`
	Connectivity                string `json:"connectivity"`
	CPU                         string `json:"cpu"`
	Graphics                    string `json:"graphics"`
	MainManufacturer            int    `json:"main_manufacturer"`
	Media                       string `json:"media"`
	Memory                      string `json:"memory"`
	Name                        string `json:"name"`
	OS                          string `json:"os"`
	Output                      string `json:"output"`
	PlatformVersionReleaseDates []int  `json:"platform_version_release_dates"`
	Resolutions                 string `json:"resolutions"`
	Slug                        string `json:"slug"`
	Sound                       string `json:"sound"`
	Storage                     string `json:"storage"`
	Summary                     string `json:"summary"`
	URL                         string `json:"url"`
}

PlatformVersion represents a particular version of a platform. For more information visit: https://api-docs.igdb.com/#platform-version

type PlatformVersionCompany

type PlatformVersionCompany struct {
	ID           int    `json:"id"`
	Comment      string `json:"comment"`
	Company      int    `json:"company"`
	Developer    bool   `json:"developer"`
	Manufacturer bool   `json:"manufacturer"`
}

PlatformVersionCompany represents a platform developer. For more information visit: https://api-docs.igdb.com/#platform-version-company

type PlatformVersionCompanyService

type PlatformVersionCompanyService service

PlatformVersionCompanyService handles all the API calls for the IGDB PlatformVersionCompany endpoint.

func (*PlatformVersionCompanyService) Count

func (ps *PlatformVersionCompanyService) Count(opts ...Option) (int, error)

Count returns the number of PlatformVersionCompanies available in the IGDB. Provide the SetFilter functional option if you need to filter which PlatformVersionCompanies to count.

func (*PlatformVersionCompanyService) Fields

func (ps *PlatformVersionCompanyService) Fields() ([]string, error)

Fields returns the up-to-date list of fields in an IGDB PlatformVersionCompany object.

func (*PlatformVersionCompanyService) Get

Get returns a single PlatformVersionCompany identified by the provided IGDB ID. Provide the SetFields functional option if you need to specify which fields to retrieve. If the ID does not match any PlatformVersionCompanies, an error is returned.

func (*PlatformVersionCompanyService) Index

Index returns an index of PlatformVersionCompanies based solely on the provided functional options used to sort, filter, and paginate the results. If no PlatformVersionCompanies can be found using the provided options, an error is returned.

func (*PlatformVersionCompanyService) List

func (ps *PlatformVersionCompanyService) List(ids []int, opts ...Option) ([]*PlatformVersionCompany, error)

List returns a list of PlatformVersionCompanies identified by the provided list of IGDB IDs. Provide functional options to sort, filter, and paginate the results. Any ID that does not match a PlatformVersionCompany is ignored. If none of the IDs match a PlatformVersionCompany, an error is returned.

type PlatformVersionReleaseDate

type PlatformVersionReleaseDate struct {
	ID              int            `json:"id"`
	Category        DateCategory   `json:"category"`
	CreatedAt       int            `json:"created_at"`
	Date            int            `json:"date"`
	Human           string         `json:"human"`
	M               int            `json:"m"`
	PlatformVersion int            `json:"platform_version"`
	Region          RegionCategory `json:"region"`
	UpdatedAt       int            `json:"updated_at"`
	Y               int            `json:"y"`
}

PlatformVersionReleaseDate describes a platform release date. Used to dig deeper into release dates, platforms, and versions. For more information visit: https://api-docs.igdb.com/#platform-version-release-date

type PlatformVersionReleaseDateService

type PlatformVersionReleaseDateService service

PlatformVersionReleaseDateService handles all the API calls for the IGDB PlatformVersionReleaseDate endpoint.

func (*PlatformVersionReleaseDateService) Count

func (ps *PlatformVersionReleaseDateService) Count(opts ...Option) (int, error)

Count returns the number of PlatformVersionReleaseDates available in the IGDB. Provide the SetFilter functional option if you need to filter which PlatformVersionReleaseDates to count.

func (*PlatformVersionReleaseDateService) Fields

Fields returns the up-to-date list of fields in an IGDB PlatformVersionReleaseDate object.

func (*PlatformVersionReleaseDateService) Get

Get returns a single PlatformVersionReleaseDate identified by the provided IGDB ID. Provide the SetFields functional option if you need to specify which fields to retrieve. If the ID does not match any PlatformVersionReleaseDates, an error is returned.

func (*PlatformVersionReleaseDateService) Index

Index returns an index of PlatformVersionReleaseDates based solely on the provided functional options used to sort, filter, and paginate the results. If no PlatformVersionReleaseDates can be found using the provided options, an error is returned.

func (*PlatformVersionReleaseDateService) List

List returns a list of PlatformVersionReleaseDates identified by the provided list of IGDB IDs. Provide functional options to sort, filter, and paginate the results. Any ID that does not match a PlatformVersionReleaseDate is ignored. If none of the IDs match a PlatformVersionReleaseDate, an error is returned.

type PlatformVersionService

type PlatformVersionService service

PlatformVersionService handles all the API calls for the IGDB PlatformVersion endpoint.

func (*PlatformVersionService) Count

func (ps *PlatformVersionService) Count(opts ...Option) (int, error)

Count returns the number of PlatformVersions available in the IGDB. Provide the SetFilter functional option if you need to filter which PlatformVersions to count.

func (*PlatformVersionService) Fields

func (ps *PlatformVersionService) Fields() ([]string, error)

Fields returns the up-to-date list of fields in an IGDB PlatformVersion object.

func (*PlatformVersionService) Get

func (ps *PlatformVersionService) Get(id int, opts ...Option) (*PlatformVersion, error)

Get returns a single PlatformVersion identified by the provided IGDB ID. Provide the SetFields functional option if you need to specify which fields to retrieve. If the ID does not match any PlatformVersions, an error is returned.

func (*PlatformVersionService) Index

func (ps *PlatformVersionService) Index(opts ...Option) ([]*PlatformVersion, error)

Index returns an index of PlatformVersions based solely on the provided functional options used to sort, filter, and paginate the results. If no PlatformVersions can be found using the provided options, an error is returned.

func (*PlatformVersionService) List

func (ps *PlatformVersionService) List(ids []int, opts ...Option) ([]*PlatformVersion, error)

List returns a list of PlatformVersions identified by the provided list of IGDB IDs. Provide functional options to sort, filter, and paginate the results. Any ID that does not match a PlatformVersion is ignored. If none of the IDs match a PlatformVersion, an error is returned.

type PlatformWebsite

type PlatformWebsite struct {
	ID       int             `json:"id"`
	Category WebsiteCategory `json:"category"`
	Trusted  bool            `json:"trusted"`
	URL      string          `json:"url"`
}

PlatformWebsite represents the main website for a particular platform. For more information visit: https://api-docs.igdb.com/#platform-website

type PlatformWebsiteService

type PlatformWebsiteService service

PlatformWebsiteService handles all the API calls for the IGDB PlatformWebsite endpoint.

func (*PlatformWebsiteService) Count

func (ps *PlatformWebsiteService) Count(opts ...Option) (int, error)

Count returns the number of PlatformWebsites available in the IGDB. Provide the SetFilter functional option if you need to filter which PlatformWebsites to count.

func (*PlatformWebsiteService) Fields

func (ps *PlatformWebsiteService) Fields() ([]string, error)

Fields returns the up-to-date list of fields in an IGDB PlatformWebsite object.

func (*PlatformWebsiteService) Get

func (ps *PlatformWebsiteService) Get(id int, opts ...Option) (*PlatformWebsite, error)

Get returns a single PlatformWebsite identified by the provided IGDB ID. Provide the SetFields functional option if you need to specify which fields to retrieve. If the ID does not match any PlatformWebsites, an error is returned.

func (*PlatformWebsiteService) Index

func (ps *PlatformWebsiteService) Index(opts ...Option) ([]*PlatformWebsite, error)

Index returns an index of PlatformWebsites based solely on the provided functional options used to sort, filter, and paginate the results. If no PlatformWebsites can be found using the provided options, an error is returned.

func (*PlatformWebsiteService) List

func (ps *PlatformWebsiteService) List(ids []int, opts ...Option) ([]*PlatformWebsite, error)

List returns a list of PlatformWebsites identified by the provided list of IGDB IDs. Provide functional options to sort, filter, and paginate the results. Any ID that does not match a PlatformWebsite is ignored. If none of the IDs match a PlatformWebsite, an error is returned.

type PlayerPerspective

type PlayerPerspective struct {
	ID        int    `json:"id"`
	CreatedAt int    `json:"created_at"`
	Name      string `json:"name"`
	Slug      string `json:"slug"`
	UpdatedAt int    `json:"updated_at"`
	URL       string `json:"url"`
}

PlayerPerspective describes the view or perspective of the player in a video game. For more information visit: https://api-docs.igdb.com/#player-perspective

type PlayerPerspectiveService

type PlayerPerspectiveService service

PlayerPerspectiveService handles all the API calls for the IGDB PlayerPerspective endpoint.

func (*PlayerPerspectiveService) Count

func (ps *PlayerPerspectiveService) Count(opts ...Option) (int, error)

Count returns the number of PlayerPerspectives available in the IGDB. Provide the SetFilter functional option if you need to filter which PlayerPerspectives to count.

func (*PlayerPerspectiveService) Fields

func (ps *PlayerPerspectiveService) Fields() ([]string, error)

Fields returns the up-to-date list of fields in an IGDB PlayerPerspective object.

func (*PlayerPerspectiveService) Get

func (ps *PlayerPerspectiveService) Get(id int, opts ...Option) (*PlayerPerspective, error)

Get returns a single PlayerPerspective identified by the provided IGDB ID. Provide the SetFields functional option if you need to specify which fields to retrieve. If the ID does not match any PlayerPerspectives, an error is returned.

func (*PlayerPerspectiveService) Index

func (ps *PlayerPerspectiveService) Index(opts ...Option) ([]*PlayerPerspective, error)

Index returns an index of PlayerPerspectives based solely on the provided functional options used to sort, filter, and paginate the results. If no PlayerPerspectives can be found using the provided options, an error is returned.

func (*PlayerPerspectiveService) List

func (ps *PlayerPerspectiveService) List(ids []int, opts ...Option) ([]*PlayerPerspective, error)

List returns a list of PlayerPerspectives identified by the provided list of IGDB IDs. Provide functional options to sort, filter, and paginate the results. Any ID that does not match a PlayerPerspective is ignored. If none of the IDs match a PlayerPerspective, an error is returned.

type RegionCategory

type RegionCategory int

RegionCategory specifies a specific geographic region.

const (
	RegionEurope RegionCategory = iota + 1
	RegionNorthAmerica
	RegionAustralia
	RegionNewZealand
	RegionJapan
	RegionChina
	RegionAsia
	RegionWorldwide
)

Expected RegionCategory enums from the IGDB.

func (RegionCategory) String

func (i RegionCategory) String() string

type ReleaseDate

type ReleaseDate struct {
	ID        int            `json:"id"`
	Category  DateCategory   `json:"category"`
	CreatedAt int            `json:"created_at"`
	Date      int            `json:"date"`
	Game      int            `json:"game"`
	Human     string         `json:"human"`
	M         int            `json:"m"`
	Platform  int            `json:"platform"`
	Region    RegionCategory `json:"region"`
	UpdatedAt int            `json:"updated_at"`
	Y         int            `json:"y"`
}

ReleaseDate represents the release date for a particular game. Used to dig deeper into release dates, platforms, and versions. For more information visit: https://api-docs.igdb.com/#release-date

type ReleaseDateService

type ReleaseDateService service

ReleaseDateService handles all the API calls for the IGDB ReleaseDate endpoint.

func (*ReleaseDateService) Count

func (rs *ReleaseDateService) Count(opts ...Option) (int, error)

Count returns the number of ReleaseDates available in the IGDB. Provide the SetFilter functional option if you need to filter which ReleaseDates to count.

func (*ReleaseDateService) Fields

func (rs *ReleaseDateService) Fields() ([]string, error)

Fields returns the up-to-date list of fields in an IGDB ReleaseDate object.

func (*ReleaseDateService) Get

func (rs *ReleaseDateService) Get(id int, opts ...Option) (*ReleaseDate, error)

Get returns a single ReleaseDate identified by the provided IGDB ID. Provide the SetFields functional option if you need to specify which fields to retrieve. If the ID does not match any ReleaseDates, an error is returned.

func (*ReleaseDateService) Index

func (rs *ReleaseDateService) Index(opts ...Option) ([]*ReleaseDate, error)

Index returns an index of ReleaseDates based solely on the provided functional options used to sort, filter, and paginate the results. If no ReleaseDates can be found using the provided options, an error is returned.

func (*ReleaseDateService) List

func (rs *ReleaseDateService) List(ids []int, opts ...Option) ([]*ReleaseDate, error)

List returns a list of ReleaseDates identified by the provided list of IGDB IDs. Provide functional options to sort, filter, and paginate the results. Any ID that does not match a ReleaseDate is ignored. If none of the IDs match a ReleaseDate, an error is returned.

type Screenshot

type Screenshot struct {
	Image
	ID   int `json:"id"`
	Game int `json:"game"`
}

Screenshot represents a screenshot of a particular game. For more information visit: https://api-docs.igdb.com/#screenshot

type ScreenshotService

type ScreenshotService service

ScreenshotService handles all the API calls for the IGDB Screenshot endpoint.

func (*ScreenshotService) Count

func (ss *ScreenshotService) Count(opts ...Option) (int, error)

Count returns the number of Screenshots available in the IGDB. Provide the SetFilter functional option if you need to filter which Screenshots to count.

func (*ScreenshotService) Fields

func (ss *ScreenshotService) Fields() ([]string, error)

Fields returns the up-to-date list of fields in an IGDB Screenshot object.

func (*ScreenshotService) Get

func (ss *ScreenshotService) Get(id int, opts ...Option) (*Screenshot, error)

Get returns a single Screenshot identified by the provided IGDB ID. Provide the SetFields functional option if you need to specify which fields to retrieve. If the ID does not match any Screenshots, an error is returned.

func (*ScreenshotService) Index

func (ss *ScreenshotService) Index(opts ...Option) ([]*Screenshot, error)

Index returns an index of Screenshots based solely on the provided functional options used to sort, filter, and paginate the results. If no Screenshots can be found using the provided options, an error is returned.

func (*ScreenshotService) List

func (ss *ScreenshotService) List(ids []int, opts ...Option) ([]*Screenshot, error)

List returns a list of Screenshots identified by the provided list of IGDB IDs. Provide functional options to sort, filter, and paginate the results. Any ID that does not match a Screenshot is ignored. If none of the IDs match a Screenshot, an error is returned.

type SearchResult

type SearchResult struct {
	AlternativeName string `json:"alternative_name"`
	Character       int    `json:"character"`
	Collection      int    `json:"collection"`
	Company         int    `json:"company"`
	Description     string `json:"description"`
	Game            int    `json:"game"`
	Name            string `json:"name"`
	Person          int    `json:"person"`
	Platform        int    `json:"platform"`
	PublishedAt     int    `json:"published_at"`
	TestDummy       int    `json:"test_dummy"`
	Theme           int    `json:"theme"`
}

SearchResult represents a result from searching the IGDB. It can contain: Characters, Collections Games, People, Platforms, and Themes.

type ServerError

type ServerError struct {
	Status int    `json:"status"`
	Msg    string `json:"message"`
	Temp   bool   `json:"temporary"`
}

ServerError contains information on an error returned from an IGDB API call.

func (ServerError) Error

func (e ServerError) Error() string

Error formats the ServerError and fulfills the error interface.

func (ServerError) Temporary

func (e ServerError) Temporary() bool

Temporary returns true if the error is temporary.

type Tag

type Tag int

Tag is a generated number that represents a specific IGDB object. Tag provides a quick and compact way to do complex filtering on the IGDB API.

func GenerateTag

func GenerateTag(typeID tagType, objectID int) (Tag, error)

GenerateTag uses the ID of an IGDB object type and the ID of an IGDB object to generate a Tag addressed to that object. Negative ID values are considered invalid.

func (Tag) String

func (t Tag) String() string

String returns the provided Tag as a string.

type Theme

type Theme struct {
	ID        int    `json:"id"`
	CreatedAt int    `json:"created_at"`
	Name      string `json:"name"`
	Slug      string `json:"slug"`
	UpdatedAt int    `json:"updated_at"`
	URL       string `json:"url"`
}

Theme represents a particular video game theme. For more information visit: https://api-docs.igdb.com/#theme

type ThemeService

type ThemeService service

ThemeService handles all the API calls for the IGDB Theme endpoint.

func (*ThemeService) Count

func (ts *ThemeService) Count(opts ...Option) (int, error)

Count returns the number of Themes available in the IGDB. Provide the SetFilter functional option if you need to filter which Themes to count.

func (*ThemeService) Fields

func (ts *ThemeService) Fields() ([]string, error)

Fields returns the up-to-date list of fields in an IGDB Theme object.

func (*ThemeService) Get

func (ts *ThemeService) Get(id int, opts ...Option) (*Theme, error)

Get returns a single Theme identified by the provided IGDB ID. Provide the SetFields functional option if you need to specify which fields to retrieve. If the ID does not match any Themes, an error is returned.

func (*ThemeService) Index

func (ts *ThemeService) Index(opts ...Option) ([]*Theme, error)

Index returns an index of Themes based solely on the provided functional options used to sort, filter, and paginate the results. If no Themes can be found using the provided options, an error is returned.

func (*ThemeService) List

func (ts *ThemeService) List(ids []int, opts ...Option) ([]*Theme, error)

List returns a list of Themes identified by the provided list of IGDB IDs. Provide functional options to sort, filter, and paginate the results. Any ID that does not match a Theme is ignored. If none of the IDs match a Theme, an error is returned.

func (*ThemeService) Search

func (ts *ThemeService) Search(qry string, opts ...Option) ([]*Theme, error)

Search returns a list of Themes found by searching the IGDB using the provided query. Provide functional options to sort, filter, and paginate the results. If no Themes are found using the provided query, an error is returned.

type VersionFeatureCategory

type VersionFeatureCategory int

VersionFeatureCategory specifies the type of feature for a particular game.

const (
	VersionFeatureBoolean VersionFeatureCategory = iota
	VersionFeatureDescription
)

Expected VersionFeatureCategory enums from the IGDB.

func (VersionFeatureCategory) String

func (i VersionFeatureCategory) String() string

type VersionFeatureInclusion

type VersionFeatureInclusion int

VersionFeatureInclusion specifies whether a feature is included or not.

const (
	VersionFeatureNotIncluded VersionFeatureInclusion = iota
	VersionFeatureIncluded
	VersionFeaturePreOrderOnly
)

Expected VersionFeatureInclusion enums from the IGDB.

func (VersionFeatureInclusion) String

func (i VersionFeatureInclusion) String() string

type Website

type Website struct {
	ID       int             `json:"id"`
	Category WebsiteCategory `json:"category"`
	Trusted  bool            `json:"trusted"`
	URL      string          `json:"url"`
}

Website represents a website and its URL; usually associated with a game. For more information visit: https://api-docs.igdb.com/#website

type WebsiteCategory

type WebsiteCategory int

WebsiteCategory specifies a specific popular website.

const (
	WebsiteOfficial WebsiteCategory = iota + 1
	WebsiteWikia
	WebsiteWikipedia
	WebsiteFacebook
	WebsiteTwitter
	WebsiteTwitch

	WebsiteInstagram
	WebsiteYoutube
	WebsiteIphone
	WebsiteIpad
	WebsiteAndroid
	WebsiteSteam
	WebsiteReddit
	WebsiteDiscord
	WebsiteGooglePlus
	WebsiteTumblr
	WebsiteLinkedin
	WebsitePinterest
	WebsiteSoundcloud
)

Expected WebsiteCategory enums from the IGDB.

type WebsiteService

type WebsiteService service

WebsiteService handles all the API calls for the IGDB Website endpoint.

func (*WebsiteService) Count

func (ws *WebsiteService) Count(opts ...Option) (int, error)

Count returns the number of Websites available in the IGDB. Provide the SetFilter functional option if you need to filter which Websites to count.

func (*WebsiteService) Fields

func (ws *WebsiteService) Fields() ([]string, error)

Fields returns the up-to-date list of fields in an IGDB Website object.

func (*WebsiteService) Get

func (ws *WebsiteService) Get(id int, opts ...Option) (*Website, error)

Get returns a single Website identified by the provided IGDB ID. Provide the SetFields functional option if you need to specify which fields to retrieve. If the ID does not match any Websites, an error is returned.

func (*WebsiteService) Index

func (ws *WebsiteService) Index(opts ...Option) ([]*Website, error)

Index returns an index of Websites based solely on the provided functional options used to sort, filter, and paginate the results. If no Websites can be found using the provided options, an error is returned.

func (*WebsiteService) List

func (ws *WebsiteService) List(ids []int, opts ...Option) ([]*Website, error)

List returns a list of Websites identified by the provided list of IGDB IDs. Provide functional options to sort, filter, and paginate the results. Any ID that does not match a Website is ignored. If none of the IDs match a Website, an error is returned.

Directories

Path Synopsis
examples

Jump to

Keyboard shortcuts

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