/
accounts.clj
44 lines (38 loc) · 1.21 KB
/
accounts.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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
(ns happygapi.mirror.accounts
"Google Mirror API: accounts.
Interacts with Glass users via the timeline.
See: https://developers.google.com/glassapi/reference/rest/v1/accounts"
(:require [cheshire.core :as json]
[clj-http.client :as http]
[happy.util :as util]))
(defn insert$
"https://developers.google.com/glassapi/reference/rest/v1/accounts/insert
Required parameters: accountName, accountType, userToken
Optional parameters: none
Body:
{:authTokens [{:authToken string, :type string}],
:features [string],
:password string,
:userData [{:key string, :value string}]}
Inserts a new account for a user"
{:scopes nil}
[auth parameters body]
{:pre [(util/has-keys?
parameters
#{:userToken :accountName :accountType})]}
(util/get-response
(http/post
(util/get-url
"https://www.googleapis.com/mirror/v1/"
"accounts/{userToken}/{accountType}/{accountName}"
#{:userToken :accountName :accountType}
parameters)
(merge-with
merge
{:content-type :json,
:body (json/generate-string body),
:throw-exceptions false,
:query-params parameters,
:accept :json,
:as :json}
auth))))