PlanetSide 2 API v0.1.3 PS2.API View Source
Your gateway to the Census API.
Pass you queries to send_query/1
and get {:ok, result}
, where
result
is a map.
iex> q = PS2.API.Query.new(collection: "character_name")
%PS2.API.Query{
collection: "character_name",
joins: [],
sort: nil,
params: %{},
tree: nil
}
iex> PS2.API.send_query(q)
{:ok,
%{
"character_name_list" => [
%{
"character_id" => "1",
"name" => %{"first" => "test character", "first_lower" => "test character"}
}
],
"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, encoding it if necessary. Returns {:ok, result}
if successful, where result
is a map.
Link to this section Types
Specs
result() :: map()
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, result()} | {: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
send_query(PS2.API.Query.t() | String.t()) :: {:ok, result()} | {:error, HTTPoison.Error.t() | Jason.DecodeError.t() | PS2.API.Error.t()}
Sends query
to the API, encoding it if necessary. Returns {:ok, result}
if successful, where result
is a map.