igdb v0.1.0 Igdb.Credit
Represents an Credit resource in the IGDB API.
Examples
Igdb.Credit.search(%{fields: "*", limit: 1, expand: "person"})
{:ok,
[
%Igdb.Credit{
category: 4,
character: nil,
character_credited_name: nil,
company: 3441,
country: nil,
created_at: 1413229824629,
credited_name: nil,
game: 1291,
id: 1073795615,
name: nil,
person: %{
"created_at" => 1411769315951,
"games" => [1941, 1291, 7330, 565, 1352, 7316, 499, 1602, 512, 493, 550],
"gender" => 0,
"id" => 31649,
"name" => "Sakura Wang",
"slug" => "sakura-wang",
"updated_at" => 1475087786271,
"url" => "https://www.igdb.com/people/sakura-wang"
},
person_title: 367,
position: 1376,
slug: nil,
updated_at: 1413229824629,
url: nil
}
]}
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: "*"})