mirror of
https://github.com/penpot/penpot.git
synced 2025-05-30 09:36:14 +02:00
Add initial reposotory abstraction with auth methods.
This commit is contained in:
parent
e9a51c14b8
commit
09c5e4e3c0
3 changed files with 118 additions and 38 deletions
|
@ -2,51 +2,20 @@
|
|||
;; License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
;; file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
;;
|
||||
;; Copyright (c) 2015-2016 Andrey Antukh <niwi@niwi.nz>
|
||||
;; Copyright (c) 2015-2016 Juan de la Cruz <delacruzgarciajuan@gmail.com>
|
||||
;; Copyright (c) 2016 Andrey Antukh <niwi@niwi.nz>
|
||||
|
||||
(ns uxbox.repo
|
||||
"A main interface for access to remote resources."
|
||||
(:refer-clojure :exclude [do])
|
||||
(:require [postal.client :as ps]
|
||||
(:require [uxbox.repo.core :as urc]
|
||||
[uxbox.repo.auth]
|
||||
[uxbox.repo.projects]
|
||||
[beicon.core :as rx]))
|
||||
|
||||
(def ^:private ^:const +client+
|
||||
"https://test.uxbox.io")
|
||||
|
||||
(defn novelty
|
||||
[type data]
|
||||
(rx/from-promise
|
||||
(ps/novelty +client+ type data)))
|
||||
|
||||
(defn query
|
||||
([type]
|
||||
(rx/from-promise
|
||||
(ps/query +client+ type)))
|
||||
([type data]
|
||||
(rx/from-promise
|
||||
(ps/query +client+ type data))))
|
||||
|
||||
(defmulti -do
|
||||
(fn [type data] type))
|
||||
|
||||
(defn do
|
||||
"Perform a side effectfull action accesing
|
||||
remote remote resources."
|
||||
remote resources."
|
||||
([type]
|
||||
(-do type nil))
|
||||
(urc/-do type nil))
|
||||
([type data]
|
||||
(-do type data)))
|
||||
|
||||
;; (defmethod do :login
|
||||
;; [type data]
|
||||
;; (rx/from-promise
|
||||
;; (ps/novelty :login data)))
|
||||
|
||||
(defmethod -do :login
|
||||
[type data]
|
||||
(->> (rx/of {:fullname "Cirilla Fiona"
|
||||
:photo "/images/favicon.png"
|
||||
:username "cirilla"
|
||||
:email "cirilla@uxbox.io"})
|
||||
(rx/delay 100)))
|
||||
(urc/-do type data)))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue