File: examples.el

package info (click to toggle)
graphql-el 0.1.1-5
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 92 kB
  • sloc: lisp: 245; makefile: 11
file content (28 lines) | stat: -rw-r--r-- 755 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
(require 'subr-x)
(require 'json)
(require 'ghub)
(require 'graphql)

;;; The following functions create

(defun ghubp--graphql-submit (type object)
  (thread-last (graphql-encode object)
    (cons type)
    (list)
    (json-encode)
    (ghub-post "/graphql" nil)))
(defun ghubp-graphql-query (query)
  (ghubp--graphql-submit "query" (cons 'query query)))
(defun ghubp-graphql-mutation (mutation)
  (ghubp--graphql-submit "mutation" (cons 'mutation mutation)))

;;; Begin examples

(ghubp-graphql-query
 ;; Get the first hundred issues from vermiculus/magithub
 '((repository
    :arguments ((owner . "vermiculus")
                (name . "magithub"))
    (issues :arguments ((first . 100))
            (edges
             (node number title url id))))))