Ninigi / neuron

A GraphQL client for Elixir

Home Page:https://hex.pm/packages/neuron

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

neuron

Build Status Hex Version

A GraphQL client for Elixir.

Index

Installation

def deps do
  [{:neuron, "~> 1.0.0"}]
end

Usage

iex> Neuron.Config.set(url: "https://example.com/graph")

iex> Neuron.query("""
      {
        films {
          count
        }
      }
    """)

# Response will be:

{:ok, %Neuron.Response{body: %{"data" => {"films" => { "count": 123 }}}%, status_code: 200, headers: []}}

# You can also run mutations

iex> Neuron.query("""
      mutation createUser($name: String!) {
        createUser(name: $name) {
          id
          name
        }
      }
    """,
    %{name: "uesteibar"}
    )

More extensive documentation can be found at https://hexdocs.pm/neuron.

Running locally

Clone the repository

git clone git@github.com:uesteibar/neuron.git

Install dependencies

cd neuron
mix deps.get

To run the tests

mix test

To run the lint

mix credo

Contributing

Pull requests are always welcome =)

The project uses standard-changelog to update the Changelog with each commit message and upgrade the package version. For that reason every contribution should have a title and body that follows the conventional commits standard conventions (e.g. feat(connection): Make it smarter than Jarvis).

To make this process easier, you can do the following:

Install commitizen and cz-conventional-changelog globally

npm i -g commitizen cz-conventional-changelog

Save cz-conventional-changelog as default

echo '{ "path": "cz-conventional-changelog" }' > ~/.czrc

Instead of git commit, you can now run

git cz

and follow the instructions to generate the commit message.

About

A GraphQL client for Elixir

https://hex.pm/packages/neuron

License:Other


Languages

Language:Elixir 100.0%