View Source ElixirLokaliseApi.Processor (ElixirLokaliseApi v3.1.0)

Performs processing of user-supplied data and data returned by the API.

Summary

Functions

Encodes user-supplied data sent to the API.

Parses data returned by the API. It can return a model, a collection, and a raw response. All returned values are represented as tuples with two elements (:ok and the actual data)

Functions

Encodes user-supplied data sent to the API.

Link to this function

parse(response, module, type)

View Source
@spec parse(HTTPoison.Response.t(), atom(), String.t()) ::
  {:ok, struct() | map()} | {:error, map(), integer()}

Parses data returned by the API. It can return a model, a collection, and a raw response. All returned values are represented as tuples with two elements (:ok and the actual data):

{:ok, data} = ElixirLokaliseApi.Projects.find(project_id)

If an error is raised by the API, the returned tuple contains an :error atom, the error details, and the HTTP status code:

{:error, error, status} = ElixirLokaliseApi.Projects.find(nil)