Skip to content

Instantly share code, notes, and snippets.

@hmaurer
Last active September 14, 2017 12:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hmaurer/79c838966dff65b94d9c6a7102c9f7eb to your computer and use it in GitHub Desktop.
Save hmaurer/79c838966dff65b94d9c6a7102c9f7eb to your computer and use it in GitHub Desktop.
{
object(rid: "2450090569620309683") {
id
children {
rid
name
children {
id
}
}
}
}
{
"data": {
"object": {
"id": "ORGANISATION",
"children": [
{
"rid": "222897136273728385",
"name": "Organization default",
"children": []
},
{
"rid": "1405209353840064631",
"name": "Test Stefan 1",
"children": []
}
]
}
}
}
(defn read-object-rid
[context args _value]
(print args)
(-> (client/request-backend (:rid args))
(get :body)))
(defn read-object-key
[context args _value]
(-> (client/request-backend nil)
(get :body)
(get (keyword (:key args)))
(get :rid)
(client/request-backend)
(get :body)))
{:enums
{:model
{:description "The root models in the API"
:values [:accessProfile
:actionPlan
:classConfig
:custom_Period
:defaults
:expression
:externalResource
:forms
:group
:node
:nodeDataImport
:nodeType
:notification
:organisation
:page
:portal
:property
:reporter
:risk
:templateCategory
:transformer
:user]}}
:objects
{:Object {:description "An object."
:fields {:rid {:type (non-null ID)}
:id {:type String}
:name {:type String}
:children {:type (list Object)}
:className {:type (non-null String)}}
:args {:rid {:type (non-null ID)
:description "Unique object rid."}}
:resolve :resolve-read-object-rid}
:Model {:description "A model."
:fields {:rid {:type (non-null ID)}
:id {:type String}
:name {:type String}
:key {:type :model}
:children {:type (list Object)}
:className {:type (non-null String)}}}}
:queries
{:object {:type Object
:description "Retrieve object by rid"
:args {:rid {:type ID
:description "Unique object rid."}}
:resolve :resolve-read-object-rid}
:model {:type Model
:description "Retrieve a single model root by its key"
:args {:key {:type String
:description "Unique object key"}}
:resolve :resolve-read-model-root}}}
@hmaurer
Copy link
Author

hmaurer commented Sep 14, 2017

(fn [context args _value]
  (map (fn [val]
              (:body (client/request-backend (:rid val)))) _value))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment