-
Notifications
You must be signed in to change notification settings - Fork 4
/
blogs.clj
85 lines (76 loc) · 2.31 KB
/
blogs.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
(ns happygapi.blogger.blogs
"Blogger API: blogs.
API for access to the data within Blogger.
See: https://developers.google.com/blogger/docs/3.0/getting_startedapi/reference/rest/v3/blogs"
(:require [cheshire.core :as json]
[clj-http.client :as http]
[happy.util :as util]))
(defn get$
"https://developers.google.com/blogger/docs/3.0/getting_startedapi/reference/rest/v3/blogs/get
Required parameters: blogId
Optional parameters: maxPosts, view
Gets one blog by ID."
{:scopes ["https://www.googleapis.com/auth/blogger"
"https://www.googleapis.com/auth/blogger.readonly"]}
[auth args]
{:pre [(util/has-keys? args #{:blogId})]}
(util/get-response
(http/get
(util/get-url
"https://www.googleapis.com/blogger/v3/"
"blogs/{blogId}"
#{:blogId}
args)
(merge-with
merge
{:throw-exceptions false,
:query-params args,
:accept :json,
:as :json}
auth))))
(defn getByUrl$
"https://developers.google.com/blogger/docs/3.0/getting_startedapi/reference/rest/v3/blogs/getByUrl
Required parameters: url
Optional parameters: view
Retrieve a Blog by URL."
{:scopes ["https://www.googleapis.com/auth/blogger"
"https://www.googleapis.com/auth/blogger.readonly"]}
[auth args]
{:pre [(util/has-keys? args #{:url})]}
(util/get-response
(http/get
(util/get-url
"https://www.googleapis.com/blogger/v3/"
"blogs/byurl"
#{:url}
args)
(merge-with
merge
{:throw-exceptions false,
:query-params args,
:accept :json,
:as :json}
auth))))
(defn listByUser$
"https://developers.google.com/blogger/docs/3.0/getting_startedapi/reference/rest/v3/blogs/listByUser
Required parameters: userId
Optional parameters: fetchUserInfo, role, status, view
Retrieves a list of blogs, possibly filtered."
{:scopes ["https://www.googleapis.com/auth/blogger"
"https://www.googleapis.com/auth/blogger.readonly"]}
[auth args]
{:pre [(util/has-keys? args #{:userId})]}
(util/get-response
(http/get
(util/get-url
"https://www.googleapis.com/blogger/v3/"
"users/{userId}/blogs"
#{:userId}
args)
(merge-with
merge
{:throw-exceptions false,
:query-params args,
:accept :json,
:as :json}
auth))))