github command interface has been added to john titor

This commit is contained in:
Sameer Rahmani 2019-01-14 22:14:29 +00:00
parent 79b6ffeca1
commit d90c2ee044
5 changed files with 42 additions and 14 deletions

View File

@ -0,0 +1,16 @@
(ns john-titor.commands.github
(:require
[john-titor.github :as github]
[john-titor.utils :as u]
[john-titor.commands.protocols :as proto :refer [defcommand]]))
(deftype GithubCommandRouter []
proto/CommandRouter
(init [_ server]
(defcommand server
"github-notifications"
#(u/on-value (github/notification-command %)))))
(comment
(u/on-value (github/notification-command [])
#(println %)))

View File

@ -0,0 +1,8 @@
(ns john-titor.github
(:require
[john-titor.github.core :as g]))
(defn notification-command
[args]
(g/notifications))

View File

@ -41,14 +41,16 @@
([]
(notifications {}))
([opts]
(api-get "/notifications" {})))
(api-get "/notifications" {})
(go `(message "hello"))))
(process-response (fn [res]
(println (doseq [x (:body res)]
(println (str (:name (:repository x))
" "
;;(:title (:subject x))
" "
(:reason x))))))
(notifications))
(comment
(notifications)
(process-response (fn [res]
(println (doseq [x (:body res)]
(println (str (:name (:repository x))
" "
;;(:title (:subject x))
" "
(:reason x))))))
(notifications)))

View File

@ -1,7 +1,7 @@
(ns john-titor.utils
(:require
[clojure.core.async :refer [take!]]))
[clojure.core.async :refer [take! <!!]]))
(defn wait-for
(defn on-value
[ch]
(take! ch))
(<!! ch))

View File

@ -9,7 +9,9 @@
(defun john_titor/connect ()
"Connect to john titor via RPC."
(setq epc-connection
(epc:start-epc "node" '("../../../john_titor/target/main.js"))))
(if debug-on-error
(epc:start-epc "node" '("../../../john_titor/target/main.js"))
(epc:start-epc "node" '("../../../john_titor/app.js")))))
(defun john_titor/call-sync (command args)
"Call the given COMMAND with the given ARGS via john titor epc."