systran v0.1.0 Systran.Client View Source

Client requests

Link to this section Summary

Link to this section Functions

Link to this function

call(type, endpoint, attrs)

View Source
call(atom(), String.t(), list()) :: {}

Performs a request

Examples

iex> Systran.Client.call(:post, "translation/text/translate", attrs)

{:ok,
  %{
    "outputs" => [
      %{
        "output" => "Hola mundo",
        "stats" => %{}
      }
    ]
  }
}

{:error, :timeout}

{:error,
  %{
    "error" => %{
      "info" => %{"statusCode" => 400},
      "message" => "no target provided",
      "statusCode" => 400
    }
  }
}