changes
This commit is contained in:
parent
6a258db47f
commit
beaf92f7c4
22 changed files with 773 additions and 238 deletions
|
|
@ -9,7 +9,7 @@ defmodule EzcontainerRailway.Application do
|
|||
def start(_type, _args) do
|
||||
children = [
|
||||
EzcontainerRailwayWeb.Telemetry,
|
||||
EzcontainerRailway.Repo,
|
||||
# EzcontainerRailway.Repo,
|
||||
{DNSCluster, query: Application.get_env(:ezcontainer_railway, :dns_cluster_query) || :ignore},
|
||||
{Phoenix.PubSub, name: EzcontainerRailway.PubSub},
|
||||
# Start the Finch HTTP client for sending emails
|
||||
|
|
|
|||
16
lib/ezcontainer_railway/graphql_client.ex
Normal file
16
lib/ezcontainer_railway/graphql_client.ex
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
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
|
||||
19
lib/ezcontainer_railway/railway.ex
Normal file
19
lib/ezcontainer_railway/railway.ex
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
defmodule EzcontainerRailway.Railway do
|
||||
alias EzcontainerRailway.GraphqlClient
|
||||
def get_projects(token) do
|
||||
GraphqlClient.query(
|
||||
"""
|
||||
query {
|
||||
projects {
|
||||
edges {
|
||||
node {
|
||||
id
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
""",
|
||||
token: token
|
||||
)
|
||||
end
|
||||
end
|
||||
|
|
@ -1,5 +1,2 @@
|
|||
defmodule EzcontainerRailway.Repo do
|
||||
use Ecto.Repo,
|
||||
otp_app: :ezcontainer_railway,
|
||||
adapter: Ecto.Adapters.Postgres
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue