-
Notifications
You must be signed in to change notification settings - Fork 4
/
reviews.clj
89 lines (77 loc) · 2.54 KB
/
reviews.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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
(ns happygapi.androidpublisher.reviews
"Google Play Developer API: reviews.
Accesses Android application developers' Google Play accounts.
See: https://developers.google.com/android-publisherapi/reference/rest/v3/reviews"
(:require [cheshire.core :as json]
[clj-http.client :as http]
[happy.util :as util]))
(defn get$
"https://developers.google.com/android-publisherapi/reference/rest/v3/reviews/get
Required parameters: packageName, reviewId
Optional parameters: translationLanguage
Returns a single review."
{:scopes ["https://www.googleapis.com/auth/androidpublisher"]}
[auth args]
{:pre [(util/has-keys? args #{:packageName :reviewId})]}
(util/get-response
(http/get
(util/get-url
"https://www.googleapis.com/androidpublisher/v3/applications/"
"{packageName}/reviews/{reviewId}"
#{:packageName :reviewId}
args)
(merge-with
merge
{:throw-exceptions false,
:query-params args,
:accept :json,
:as :json}
auth))))
(defn list$
"https://developers.google.com/android-publisherapi/reference/rest/v3/reviews/list
Required parameters: packageName
Optional parameters: maxResults, startIndex, token, translationLanguage
Returns a list of reviews. Only reviews from last week will be returned."
{:scopes ["https://www.googleapis.com/auth/androidpublisher"]}
[auth args]
{:pre [(util/has-keys? args #{:packageName})]}
(util/get-response
(http/get
(util/get-url
"https://www.googleapis.com/androidpublisher/v3/applications/"
"{packageName}/reviews"
#{:packageName}
args)
(merge-with
merge
{:throw-exceptions false,
:query-params args,
:accept :json,
:as :json}
auth))))
(defn reply$
"https://developers.google.com/android-publisherapi/reference/rest/v3/reviews/reply
Required parameters: packageName, reviewId
Optional parameters: none
Body:
{:replyText string}
Reply to a single review, or update an existing reply."
{:scopes ["https://www.googleapis.com/auth/androidpublisher"]}
[auth args body]
{:pre [(util/has-keys? args #{:packageName :reviewId})]}
(util/get-response
(http/post
(util/get-url
"https://www.googleapis.com/androidpublisher/v3/applications/"
"{packageName}/reviews/{reviewId}:reply"
#{:packageName :reviewId}
args)
(merge-with
merge
{:content-type :json,
:body (json/generate-string body),
:throw-exceptions false,
:query-params args,
:accept :json,
:as :json}
auth))))