-
Notifications
You must be signed in to change notification settings - Fork 4
/
players.clj
57 lines (51 loc) · 1.65 KB
/
players.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
45
46
47
48
49
50
51
52
53
54
55
56
57
(ns happygapi.games.players
"Google Play Game Services API: players.
The API for Google Play Game Services.
See: https://developers.google.com/games/services/api/reference/rest/v1/players"
(:require [cheshire.core :as json]
[clj-http.client :as http]
[happy.util :as util]))
(defn get$
"https://developers.google.com/games/services/api/reference/rest/v1/players/get
Required parameters: playerId
Optional parameters: language
Retrieves the Player resource with the given ID. To retrieve the player for the currently authenticated user, set playerId to me."
{:scopes ["https://www.googleapis.com/auth/games"]}
[auth args]
{:pre [(util/has-keys? args #{:playerId})]}
(util/get-response
(http/get
(util/get-url
"https://www.googleapis.com/games/v1/"
"players/{playerId}"
#{:playerId}
args)
(merge-with
merge
{:throw-exceptions false,
:query-params args,
:accept :json,
:as :json}
auth))))
(defn list$
"https://developers.google.com/games/services/api/reference/rest/v1/players/list
Required parameters: collection
Optional parameters: language, maxResults, pageToken
Get the collection of players for the currently authenticated user."
{:scopes ["https://www.googleapis.com/auth/games"]}
[auth args]
{:pre [(util/has-keys? args #{:collection})]}
(util/get-response
(http/get
(util/get-url
"https://www.googleapis.com/games/v1/"
"players/me/players/{collection}"
#{:collection}
args)
(merge-with
merge
{:throw-exceptions false,
:query-params args,
:accept :json,
:as :json}
auth))))