PlanetSide 2 API v0.2.0 PS2.API View Source
Your gateway to the Census API.
Use query/1
to get data from the Census.
iex> q = PS2.API.Query.new(collection: "character_name")
...> |> PS2.API.QueryBuilder.term("name.first_lower", "snowful")
%PS2.API.Query{
collection: "character_name",
joins: [],
params: %{"name.first_lower" => {"", "snowful"}},
sort: nil,
tree: nil
}
iex> PS2.API.query(q)
{:ok,
%PS2.API.QueryResult{
data: [
%{
"character_id" => "5428713425545165425",
"name" => %{"first" => "Snowful", "first_lower" => "snowful"}
}
],
returned: 1
}
}
Link to this section Summary
Functions
Encodes a Query struct into an API-ready string.
View a list of all the public API collections and their resolves.
Gets the image binary for a .png.
Gets the image link.
Sends query
to the API and returns a list of results if successful.
Sends query
to the API and returns the first result if successful.
Link to this section Functions
Specs
encode(PS2.API.Query.t()) :: {:ok, String.t()} | {:error, PS2.API.Query.Error.t()}
Encodes a Query struct into an API-ready string.
Specs
get_collections() :: {:ok, PS2.API.QueryResult.t()} | {:error, HTTPoison.Error.t() | Jason.DecodeError.t() | PS2.API.Error.t()}
View a list of all the public API collections and their resolves.
Specs
get_image(String.t()) :: {:ok, binary()} | {:error, HTTPoison.Error.t()}
Gets the image binary for a .png.
Specs
Gets the image link.
Specs
query(PS2.API.Query.t()) :: {:ok, PS2.API.QueryResult.t()} | {:error, HTTPoison.Error.t() | Jason.DecodeError.t() | PS2.API.Error.t()}
Sends query
to the API and returns a list of results if successful.
Specs
query_one(PS2.API.Query.t()) :: {:ok, PS2.API.QueryResult.t()} | {:error, HTTPoison.Error.t() | Jason.DecodeError.t() | PS2.API.Error.t()}
Sends query
to the API and returns the first result if successful.