16 lines
523 B
Elixir
16 lines
523 B
Elixir
defmodule EzcontainerRailway.GraphqlClient do
|
|
@graphql_url "https://backboard.railway.app/graphql/v2"
|
|
@token "98237cc5-d503-4514-bb59-984d3403afe6"
|
|
|
|
def query(query, opts) when is_binary(query) and is_list(opts) do
|
|
body = %{
|
|
"query" => query,
|
|
"variables" => opts[:variables]
|
|
}
|
|
|
|
case Req.Request.put_headers(Req.new(), [{"Authorization", "Bearer #{opts[:token]}"}]) |> Req.post(url: @graphql_url, json: body) do
|
|
{:ok, resp} -> resp
|
|
{:error, _} -> :error
|
|
end
|
|
end
|
|
end
|