igdb v0.1.0 Igdb.Character
Represents an Character resource in the IGDB API.
Examples
Igdb.Character.search(%{fields: "*", order: "created_at:asc", limit: 1})
{:ok,
[
%Igdb.Character{
akas: nil,
created_at: 1384003893461,
games: 'I',
gender: 2,
id: 1,
mug_shot: %{
"cloudinary_id" => "prnqmxc3v0racivehw6l",
"height" => 550,
"url" => "//images.igdb.com/igdb/image/upload/t_thumb/prnqmxc3v0racivehw6l.jpg",
"width" => 650
},
name: "Urdnot Wrex",
people: [421],
slug: "urdnot-wrex",
species: 5,
updated_at: 1512377108353,
url: "https://www.igdb.com/characters/urdnot-wrex"
}
]}
Link to this section Summary
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()
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:
Option | Values | Example |
---|---|---|
fields | string; comma separated, can be nested with periods | "id,game.name" "*" |
expand | string; comma separated list of nested objects to expand | "game" |
order | string; column with the direction (asc/desc) | "created_at:desc" |
limit | integer | 10 |
search | string; text you want to search for | "Final Fantasy" |
filter | nested 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: "*"})