/
commentThreads.clj
115 lines (99 loc) · 3.22 KB
/
commentThreads.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
(ns happygapi.youtube.commentThreads
"YouTube Data API: commentThreads.
Supports core YouTube features, such as uploading videos, creating and managing playlists, searching for content, and much more.
See: https://developers.google.com/youtube/v3api/reference/rest/v3/commentThreads"
(:require [cheshire.core :as json]
[clj-http.client :as http]
[happy.util :as util]))
(defn insert$
"https://developers.google.com/youtube/v3api/reference/rest/v3/commentThreads/insert
Required parameters: part
Optional parameters: none
Body:
{:etag string,
:id string,
:kind string,
:replies {:comments [Comment]},
:snippet {:canReply boolean,
:channelId string,
:isPublic boolean,
:topLevelComment Comment,
:totalReplyCount integer,
:videoId string}}
Creates a new top-level comment. To add a reply to an existing comment, use the comments.insert method instead."
{:scopes ["https://www.googleapis.com/auth/youtube.force-ssl"]}
[auth parameters body]
{:pre [(util/has-keys? parameters #{:part})]}
(util/get-response
(http/post
(util/get-url
"https://www.googleapis.com/youtube/v3/"
"commentThreads"
#{:part}
parameters)
(merge-with
merge
{:content-type :json,
:body (json/generate-string body),
:throw-exceptions false,
:query-params parameters,
:accept :json,
:as :json}
auth))))
(defn list$
"https://developers.google.com/youtube/v3api/reference/rest/v3/commentThreads/list
Required parameters: part
Optional parameters: textFormat, channelId, allThreadsRelatedToChannelId, pageToken, id, videoId, order, searchTerms, moderationStatus, maxResults
Returns a list of comment threads that match the API request parameters."
{:scopes ["https://www.googleapis.com/auth/youtube.force-ssl"]}
[auth parameters]
{:pre [(util/has-keys? parameters #{:part})]}
(util/get-response
(http/get
(util/get-url
"https://www.googleapis.com/youtube/v3/"
"commentThreads"
#{:part}
parameters)
(merge-with
merge
{:throw-exceptions false,
:query-params parameters,
:accept :json,
:as :json}
auth))))
(defn update$
"https://developers.google.com/youtube/v3api/reference/rest/v3/commentThreads/update
Required parameters: part
Optional parameters: none
Body:
{:etag string,
:id string,
:kind string,
:replies {:comments [Comment]},
:snippet {:canReply boolean,
:channelId string,
:isPublic boolean,
:topLevelComment Comment,
:totalReplyCount integer,
:videoId string}}
Modifies the top-level comment in a comment thread."
{:scopes ["https://www.googleapis.com/auth/youtube.force-ssl"]}
[auth parameters body]
{:pre [(util/has-keys? parameters #{:part})]}
(util/get-response
(http/put
(util/get-url
"https://www.googleapis.com/youtube/v3/"
"commentThreads"
#{:part}
parameters)
(merge-with
merge
{:content-type :json,
:body (json/generate-string body),
:throw-exceptions false,
:query-params parameters,
:accept :json,
:as :json}
auth))))