View Source GraphQL (GitHub GraphQL Smart Cell v0.1.0)
Useful functions to parse data from GraphQL response data
Link to this section Summary
Functions
Find "nodes" within a GraphQL response.
Find the "pageInfo" data within a GraphQL response.
Link to this section Functions
Find "nodes" within a GraphQL response.
examples
Examples
iex> %{
...> "a" => %{
...> "b" => %{
...> "pageInfo" => %{
...> "hasNextPage" => true,
...> "endCursor" => "abc123"
...> },
...> "nodes" => [:one, :two, :three, :etc]
...> }
...> }
...> } |> GraphQL.find_nodes()
[:one, :two, :three, :etc]
iex> GraphQL.find_nodes(%{})
[]
Find the "pageInfo" data within a GraphQL response.
examples
Examples
iex> %{
...> "a" => %{
...> "b" => %{
...> "pageInfo" => %{
...> "hasNextPage" => true,
...> "endCursor" => "abc123"
...> },
...> "nodes" => [:one, :two, :three, :etc]
...> }
...> }
...> } |> GraphQL.find_pageinfo()
%{
"hasNextPage" => true,
"endCursor" => "abc123"
}
iex> GraphQL.find_pageinfo(%{})
nil