diff --git a/404.html b/404.html index cafe0e8dd0..705959ca8a 100644 --- a/404.html +++ b/404.html @@ -5,12 +5,12 @@ - + - 404 — Bonfire v0.9.10-classic-beta.160 + 404 — Bonfire v0.9.10-classic-beta.161 @@ -56,7 +56,7 @@ Bonfire diff --git a/AbsintheClient.Helpers.html b/AbsintheClient.Helpers.html index 97e4deb221..bef2025b46 100644 --- a/AbsintheClient.Helpers.html +++ b/AbsintheClient.Helpers.html @@ -5,10 +5,10 @@ - + - AbsintheClient.Helpers — Bonfire v0.9.10-classic-beta.160 + AbsintheClient.Helpers — Bonfire v0.9.10-classic-beta.161 @@ -54,7 +54,7 @@ Bonfire @@ -132,7 +132,7 @@

AbsintheClient.Helpers - (Bonfire v0.9.10-classic-beta.160) + (Bonfire v0.9.10-classic-beta.161)

diff --git a/AbsintheClient.html b/AbsintheClient.html index c333aa27e8..f233f513bc 100644 --- a/AbsintheClient.html +++ b/AbsintheClient.html @@ -5,10 +5,10 @@ - + - AbsintheClient — Bonfire v0.9.10-classic-beta.160 + AbsintheClient — Bonfire v0.9.10-classic-beta.161 @@ -54,7 +54,7 @@ Bonfire @@ -132,7 +132,7 @@

AbsintheClient behaviour - (Bonfire v0.9.10-classic-beta.160) + (Bonfire v0.9.10-classic-beta.161)

@@ -145,29 +145,29 @@

Example

First, use AbsintheClient, passing your schema and -notifying Absinthe to operate in internal mode:

defmodule MyAppWeb.UserController do
+notifying Absinthe to operate in internal mode:

defmodule MyAppWeb.UserController do
   use MyAppWeb, :controller
-  use AbsintheClient, schema: MyAppWeb.Schema, action: [mode: :internal]
+  use AbsintheClient, schema: MyAppWeb.Schema, action: [mode: :internal]
 
   # ... actions
 
-end

For each action you want Absinthe to process, provide a GraphQL document using +end

For each action you want Absinthe to process, provide a GraphQL document using the @graphql module attribute (before the action):

@graphql """
   query ($filter: UserFilter) {
     users(filter: $filter, limit: 10)
   }
 """
-def index(conn_or_socket, %{data: data}) do
+def index(conn_or_socket, %{data: data}) do
   render conn_or_socket, "index.html", data
-end

The params for the action will be intercepted by the +end

The params for the action will be intercepted by the AbsintheClient.Action plug, and used as variables for the GraphQL document you've specified.

For instance, given a definition for a :user_filter input object -type like this:

input_object :user_filter do
+type like this:

input_object :user_filter do
   field :name_matches, :string
   field :age_above, :integer
   field :age_below, :integer
-end

And a query that looks like this (assuming you have the normal -Plug.Parsers configuration for param parsing):

?filter[name_matches]=joe&filter[age_above]=42

Then Absinthe will receive variable definitions of:

%{"filter" => %{"name_matches" => "joe", "age_above" => 42}}

(For how the string "42" was converted into 42, see cast_param/3).

The params on the conn_or_socket will then be replaced by the result of the +end

And a query that looks like this (assuming you have the normal +Plug.Parsers configuration for param parsing):

?filter[name_matches]=joe&filter[age_above]=42

Then Absinthe will receive variable definitions of:

%{"filter" => %{"name_matches" => "joe", "age_above" => 42}}

(For how the string "42" was converted into 42, see cast_param/3).

The params on the conn_or_socket will then be replaced by the result of the execution by Absinthe. The action function can then match against that result to respond correctly to the user:

It's up to you to handle the three possible results: