Open reborg opened 1 year ago
Also pretty important: grapqhql-request
input/output should take/return idiomatic Clojure data structures, that is {:id 1 :last-name "jack"}
and not {"id" 1 "lastName" "jack"}
. This is because GraphQL will likely take and return json, so some conversion between formats is necessary (and Blip can do that).
Some more details from chatting around on Slack. If we want Site to be more Site-friendly, we could have a blip.site namespace which specialises with tokens and whatnot. So the interaction in that case could be:
(require '[blip.site :as site])
(def site-request
(site/init
(slurp "test/blip/test-query.graphql")
{:endpoint "http://localhost:2021"}))
(site-request "query-entity" {:id "entity-id"}) ;; no token header
(require '[blip.site :as site])
(def site-request
(site/init
{:endpoint "http://localhost:2021"
:auth-path "/_site/token" ;; optional
:auth-basic {:user "admin" :pass "admin"} ;; optional, defaults to admin:admin
:query-path "/questionnaire/query" ;; Either a string containing the slurped query file or a path on the endpoint
:post-path "/questionnaire/graphql" ;; So blip knows where to post the queries
}))
(site-request "query-entity" {:id "entity-id"})
This would be necessary because
Note that points 1 and 2 are also applicable to the general case (unwrapped)
As far as it stays all in the Site namespace case, looking good to me to delegate more down to Blip. I wouldn't touch the unwrapped.
As far as it stays all in the Site namespace case, looking good to me to delegate more down to Blip. I wouldn't touch the unwrapped.
That should be fine provided the user knows to give the entire endpoint including the path and not just the host
Long term. Some interesting aspects to consider in this similar library: https://github.com/retro/graphql-builder
Discussing with @herichovadajana we agreed that the following could be a good interface to interact with the Blip library:
When Site is involved (or any other graphql engine that requires more than just an endpoint) we could pass more initialisation parameters, for example: