igdb v0.1.0 Igdb.GameMode

Represents an Game Mode resource in the IGDB API.

Link to this section Summary

Functions

Finds a single resource by id

Returns a list of resources found from given search options

Link to this section Functions

Link to this function get(id, options \\ %{})
get(integer(), map()) :: {:ok, list()} | {:error, String.t()}

Finds a single resource by id.

Examples

If the resource was found, get/2 will return a two-element tuple in this format, {:ok, item}.

Igdb.Game.get(359)
{:ok, %Igdb.Game{ ... }}

If the resource could not be found, get/2 will return a 2-element tuple in this format, {:ok, nil}. The code is the HTTP status code returned by the IGDB API, for example, 404.

Igdb.Game.get(100000000)
{:ok, nil}

If the resource could not be loaded, get/2 will return a 3-element tuple in this format, {:error, message, code}. The code is the HTTP status code returned by the IGDB API, for example, 404.

Link to this function resource_collection_name()
Link to this function search(options \\ %{})
search(map()) :: {:ok, list()} | {:error, String.t()}

Returns a list of resources found from given search options.

Options

The options should be passed as a map. Below is a list of allowed keys:

OptionValuesExample
fieldsstring; comma separated, can be nested with periods"id,game.name" "*"
expandstring; comma separated list of nested objects to expand"game"
orderstring; column with the direction (asc/desc)"created_at:desc"
limitinteger10
searchstring; text you want to search for"Final Fantasy"
filternested list; for each column you can have comparison with gt, lt, eq%{date: %{gt: 1500619813000}, platform: %{eq: 48}}

Refer to individual resources for the available columns to filter on.

Examples

Igdb.Game.search(%{search: "Final Fantasy", order: "popularity:desc", limit: 5, filter: %{platforms: %{eq: 48}}, fields: "*"})