Liking cljdoc? Tell your friends :D

active-graphql.builder

Helper functions for easier construction of graphql queries. Most importantly, provides the functions field, query and mutation (refer to active-graphql.examples for usage).

Helper functions for easier construction of graphql queries. Most
importantly, provides the functions `field`, `query` and `mutation` (refer to
`active-graphql.examples` for usage).
raw docstring

compilecljs

(compile constr qs)

Takes a graphql method contructor function (either query or mutation) and returns a grapqhl document with the fields qs that can be printed via print-document.

Takes a graphql method contructor function (either `query` or `mutation`)
and returns a grapqhl document with the fields `qs` that can be printed via
`print-document`.
sourceraw docstring

fieldcljs

(field the-name & args)

Takes the name of a graphql query or mutation the-name and a number of args. args can be elements of type keyword, string or fields themselves. If the-name is a vector, it's first element is the alias for the query, the second one the 'real' name.

Takes the name of a graphql query or mutation `the-name` and a number of
args. `args` can be elements of type keyword, string or `field`s themselves.
If `the-name` is a vector, it's first element is the alias for the query, the
second one the 'real' name.
sourceraw docstring

mutationcljs

(mutation & qs)

Takes an arbitrary number of field and wraps them in a mutation document.

Takes an arbitrary number of `field` and wraps them in a mutation document.
sourceraw docstring

projectcljs

(project args)

Takes a seq (list or vector) or args and converts them to active-graphql.core/field*s. Each entry is either:

  • a keyword or string
  • a vector or [alias field-name] (i.e. [:id :userId])
  • a active-graphql/field

Converts fields recursively.

Takes a seq (list or vector) or `args` and converts them to
`active-graphql.core/field*`s. Each entry is either:

* a keyword or string
* a vector or `[alias field-name]` (i.e. `[:id :userId]`)
* a `active-graphql/field`

Converts `fields` recursively.
sourceraw docstring

querycljs

(query & qs)

Takes an arbitrary number of field and wraps them in a query document.

Takes an arbitrary number of `field` and wraps them in a query document.
sourceraw docstring

requestcljs

(request document)

request takes a graphql document and returns a stringified version ready for sending to an endpoint.

Examples:

(request (query (field :foo :bar)))
;; => "\"query\": \"query { foo { bar }}\""

(request (query (field :foo {:obj (stringify {:name "wilhelm"})} :bar)))
;; => "\"query\": \"query { foo(obj: \\\"foo\\\":\\\"bar\\\"}\\\") { bar }\"
`request` takes a graphql `document` and returns a stringified version ready
for sending to an endpoint.

Examples:

```
(request (query (field :foo :bar)))
;; => "\"query\": \"query { foo { bar }}\""

(request (query (field :foo {:obj (stringify {:name "wilhelm"})} :bar)))
;; => "\"query\": \"query { foo(obj: \\\"foo\\\":\\\"bar\\\"}\\\") { bar }\"
```
sourceraw docstring

selectcljs

(select arg-pairs)

Takes a map or seq containing pairs of keys (either keyword or string) and values (in #{int float boolean string}) and returns a map prepared for usage as a graphql map. The key is converted to a string, the val is wrapped via active-graphql.builder/wrap-in-graphql-arg.

Takes a map or seq containing pairs of keys (either keyword or string) and
values (in `#{int float boolean string}`) and returns a map prepared for
usage as a graphql map. The key is converted to a string, the val is wrapped
via `active-graphql.builder/wrap-in-graphql-arg`.
sourceraw docstring

subscriptioncljs

(subscription q)

Takes a single field and wraps it in a subscription document.

Takes a single `field` and wraps it in a subscription document.
sourceraw docstring

wrap-in-graphql-argcljs

(wrap-in-graphql-arg value)

Takes a value in #{int float boolean string map} and wraps it in a graphql value. When encountering a map, convert it into a Javascript object and [[active-grpahl.core/stringify]] it.

Takes a `value` in `#{int float boolean string map}` and wraps it in a
graphql value. When encountering a map, convert it into a Javascript object
and [[active-grpahl.core/stringify]] it.
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close