-
Notifications
You must be signed in to change notification settings - Fork 2
/
core.clj
30 lines (28 loc) 路 1.09 KB
/
core.clj
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
29
30
(ns lovelace.users.core
(:require [cheshire.core :as json]
[lovelace.users.requests :refer [fetch-user fetch-users]]))
(defn list-all-users
"Retrieves a list of users of a given workspace. Takes the authentication token as a parameter.
Is also able to take the optional parameters `page-size` and `start-cursor`"
([token]
(let [response (fetch-users token)]
(if (:error response)
response
(json/parse-string (:body response) true))))
([token page-size]
(let [response (fetch-users token page-size)]
(if (:error response)
response
(json/parse-string (:body response) true))))
([token page-size start-cursor]
(let [response (fetch-users token page-size start-cursor)]
(if (:error response)
response
(json/parse-string (:body response) true)))))
(defn retrieve-user
"Retrieves a single users of a given workspace. Takes the authentication token and the user's id as parameters."
[token id]
(let [response (fetch-user token id)]
(if (:error response)
response
(json/parse-string (:body response) true))))