diff --git a/404.html b/404.html index a9896945a2..0842c326a0 100644 --- a/404.html +++ b/404.html @@ -5,12 +5,12 @@ - + - 404 — bonfire_umbrella v0.9.10-cooperation-beta.61 + 404 — bonfire_umbrella v0.9.10-cooperation-beta.62 @@ -61,7 +61,7 @@ bonfire_umbrella diff --git a/AbsintheClient.Helpers.html b/AbsintheClient.Helpers.html index 15111adcce..92cf491c91 100644 --- a/AbsintheClient.Helpers.html +++ b/AbsintheClient.Helpers.html @@ -5,10 +5,10 @@ - + - AbsintheClient.Helpers — bonfire_umbrella v0.9.10-cooperation-beta.61 + AbsintheClient.Helpers — bonfire_umbrella v0.9.10-cooperation-beta.62 @@ -59,7 +59,7 @@ bonfire_umbrella @@ -127,7 +127,7 @@ Pages AbsintheClient.Helpers - (bonfire_umbrella v0.9.10-cooperation-beta.61) + (bonfire_umbrella v0.9.10-cooperation-beta.62) diff --git a/AbsintheClient.html b/AbsintheClient.html index 02475dde0f..39eeab0044 100644 --- a/AbsintheClient.html +++ b/AbsintheClient.html @@ -5,10 +5,10 @@ - + - AbsintheClient — bonfire_umbrella v0.9.10-cooperation-beta.61 + AbsintheClient — bonfire_umbrella v0.9.10-cooperation-beta.62 @@ -59,7 +59,7 @@ bonfire_umbrella @@ -127,7 +127,7 @@ Pages AbsintheClient behaviour - (bonfire_umbrella v0.9.10-cooperation-beta.61) + (bonfire_umbrella v0.9.10-cooperation-beta.62) @@ -140,29 +140,29 @@ Pages 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: