-
Notifications
You must be signed in to change notification settings - Fork 4
/
volumes.clj
182 lines (161 loc) · 5.08 KB
/
volumes.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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
(ns happygapi.books.volumes
"Books API: volumes.
Searches for books and manages your Google Books library.
See: https://developers.google.com/books/docs/v1/getting_startedapi/reference/rest/v1/volumes"
(:require [cheshire.core :as json]
[clj-http.client :as http]
[happy.util :as util]))
(defn get$
"https://developers.google.com/books/docs/v1/getting_startedapi/reference/rest/v1/volumes/get
Required parameters: volumeId
Optional parameters: country, includeNonComicsSeries, partner, projection, source, user_library_consistent_read
Gets volume information for a single volume."
{:scopes ["https://www.googleapis.com/auth/books"]}
[auth args]
{:pre [(util/has-keys? args #{:volumeId})]}
(util/get-response
(http/get
(util/get-url
"https://www.googleapis.com/books/v1/"
"volumes/{volumeId}"
#{:volumeId}
args)
(merge-with
merge
{:throw-exceptions false,
:query-params args,
:accept :json,
:as :json}
auth))))
(defn list$
"https://developers.google.com/books/docs/v1/getting_startedapi/reference/rest/v1/volumes/list
Required parameters: q
Optional parameters: maxAllowedMaturityRating, partner, printType, libraryRestrict, langRestrict, source, filter, showPreorders, download, startIndex, projection, maxResults, orderBy
Performs a book search."
{:scopes ["https://www.googleapis.com/auth/books"]}
[auth args]
{:pre [(util/has-keys? args #{:q})]}
(util/get-response
(http/get
(util/get-url
"https://www.googleapis.com/books/v1/"
"volumes"
#{:q}
args)
(merge-with
merge
{:throw-exceptions false,
:query-params args,
:accept :json,
:as :json}
auth))))
(defn associated-list$
"https://developers.google.com/books/docs/v1/getting_startedapi/reference/rest/v1/volumes/associated/list
Required parameters: volumeId
Optional parameters: association, locale, maxAllowedMaturityRating, source
Return a list of associated books."
{:scopes ["https://www.googleapis.com/auth/books"]}
[auth args]
{:pre [(util/has-keys? args #{:volumeId})]}
(util/get-response
(http/get
(util/get-url
"https://www.googleapis.com/books/v1/"
"volumes/{volumeId}/associated"
#{:volumeId}
args)
(merge-with
merge
{:throw-exceptions false,
:query-params args,
:accept :json,
:as :json}
auth))))
(defn mybooks-list$
"https://developers.google.com/books/docs/v1/getting_startedapi/reference/rest/v1/volumes/mybooks/list
Required parameters: none
Optional parameters: acquireMethod, country, locale, maxResults, processingState, source, startIndex
Return a list of books in My Library."
{:scopes ["https://www.googleapis.com/auth/books"]}
[auth args]
{:pre [(util/has-keys? args #{})]}
(util/get-response
(http/get
(util/get-url
"https://www.googleapis.com/books/v1/"
"volumes/mybooks"
#{}
args)
(merge-with
merge
{:throw-exceptions false,
:query-params args,
:accept :json,
:as :json}
auth))))
(defn recommended-list$
"https://developers.google.com/books/docs/v1/getting_startedapi/reference/rest/v1/volumes/recommended/list
Required parameters: none
Optional parameters: locale, maxAllowedMaturityRating, source
Return a list of recommended books for the current user."
{:scopes ["https://www.googleapis.com/auth/books"]}
[auth args]
{:pre [(util/has-keys? args #{})]}
(util/get-response
(http/get
(util/get-url
"https://www.googleapis.com/books/v1/"
"volumes/recommended"
#{}
args)
(merge-with
merge
{:throw-exceptions false,
:query-params args,
:accept :json,
:as :json}
auth))))
(defn recommended-rate$
"https://developers.google.com/books/docs/v1/getting_startedapi/reference/rest/v1/volumes/recommended/rate
Required parameters: rating, volumeId
Optional parameters: locale, source
Rate a recommended book for the current user."
{:scopes ["https://www.googleapis.com/auth/books"]}
[auth args]
{:pre [(util/has-keys? args #{:volumeId :rating})]}
(util/get-response
(http/post
(util/get-url
"https://www.googleapis.com/books/v1/"
"volumes/recommended/rate"
#{:volumeId :rating}
args)
(merge-with
merge
{:throw-exceptions false,
:query-params args,
:accept :json,
:as :json}
auth))))
(defn useruploaded-list$
"https://developers.google.com/books/docs/v1/getting_startedapi/reference/rest/v1/volumes/useruploaded/list
Required parameters: none
Optional parameters: locale, maxResults, processingState, source, startIndex, volumeId
Return a list of books uploaded by the current user."
{:scopes ["https://www.googleapis.com/auth/books"]}
[auth args]
{:pre [(util/has-keys? args #{})]}
(util/get-response
(http/get
(util/get-url
"https://www.googleapis.com/books/v1/"
"volumes/useruploaded"
#{}
args)
(merge-with
merge
{:throw-exceptions false,
:query-params args,
:accept :json,
:as :json}
auth))))