PlanetSide 2 API v0.1.2 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,
  terms: %{},
  tree: nil
}
iex> PS2.API.send_query(q)
{:ok,
  %{
    character_name_list: [
      %{
        character_id: "5428407427900254785",
        name: %{first: "B3ASTSALVA23", first_lower: "b3astsalva23"}
      }
    ],
  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.

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() :: %{}

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

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.