-
Notifications
You must be signed in to change notification settings - Fork 4
/
playlists.clj
160 lines (142 loc) · 4.75 KB
/
playlists.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
(ns happygapi.youtube.playlists
"YouTube Data API: playlists.
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/playlists"
(:require [cheshire.core :as json]
[clj-http.client :as http]
[happy.util :as util]))
(defn delete$
"https://developers.google.com/youtube/v3api/reference/rest/v3/playlists/delete
Required parameters: id
Optional parameters: onBehalfOfContentOwner
Deletes a playlist."
{:scopes ["https://www.googleapis.com/auth/youtube"
"https://www.googleapis.com/auth/youtube.force-ssl"
"https://www.googleapis.com/auth/youtubepartner"]}
[auth args]
{:pre [(util/has-keys? args #{:id})]}
(util/get-response
(http/delete
(util/get-url
"https://www.googleapis.com/youtube/v3/"
"playlists"
#{:id}
args)
(merge-with
merge
{:throw-exceptions false,
:query-params args,
:accept :json,
:as :json}
auth))))
(defn insert$
"https://developers.google.com/youtube/v3api/reference/rest/v3/playlists/insert
Required parameters: part
Optional parameters: onBehalfOfContentOwner, onBehalfOfContentOwnerChannel
Body:
{:contentDetails {:itemCount integer},
:etag string,
:id string,
:kind string,
:localizations {},
:player {:embedHtml string},
:snippet {:description string,
:tags [string],
:publishedAt string,
:channelId string,
:thumbnails ThumbnailDetails,
:title string,
:localized PlaylistLocalization,
:channelTitle string,
:defaultLanguage string},
:status {:privacyStatus string}}
Creates a playlist."
{:scopes ["https://www.googleapis.com/auth/youtube"
"https://www.googleapis.com/auth/youtube.force-ssl"
"https://www.googleapis.com/auth/youtubepartner"]}
[auth args body]
{:pre [(util/has-keys? args #{:part})]}
(util/get-response
(http/post
(util/get-url
"https://www.googleapis.com/youtube/v3/"
"playlists"
#{:part}
args)
(merge-with
merge
{:content-type :json,
:body (json/generate-string body),
:throw-exceptions false,
:query-params args,
:accept :json,
:as :json}
auth))))
(defn list$
"https://developers.google.com/youtube/v3api/reference/rest/v3/playlists/list
Required parameters: part
Optional parameters: onBehalfOfContentOwnerChannel, channelId, pageToken, mine, hl, id, onBehalfOfContentOwner, maxResults
Returns a collection of playlists that match the API request parameters. For example, you can retrieve all playlists that the authenticated user owns, or you can retrieve one or more playlists by their unique IDs."
{:scopes ["https://www.googleapis.com/auth/youtube"
"https://www.googleapis.com/auth/youtube.force-ssl"
"https://www.googleapis.com/auth/youtube.readonly"
"https://www.googleapis.com/auth/youtubepartner"]}
[auth args]
{:pre [(util/has-keys? args #{:part})]}
(util/get-response
(http/get
(util/get-url
"https://www.googleapis.com/youtube/v3/"
"playlists"
#{:part}
args)
(merge-with
merge
{:throw-exceptions false,
:query-params args,
:accept :json,
:as :json}
auth))))
(defn update$
"https://developers.google.com/youtube/v3api/reference/rest/v3/playlists/update
Required parameters: part
Optional parameters: onBehalfOfContentOwner
Body:
{:contentDetails {:itemCount integer},
:etag string,
:id string,
:kind string,
:localizations {},
:player {:embedHtml string},
:snippet {:description string,
:tags [string],
:publishedAt string,
:channelId string,
:thumbnails ThumbnailDetails,
:title string,
:localized PlaylistLocalization,
:channelTitle string,
:defaultLanguage string},
:status {:privacyStatus string}}
Modifies a playlist. For example, you could change a playlist's title, description, or privacy status."
{:scopes ["https://www.googleapis.com/auth/youtube"
"https://www.googleapis.com/auth/youtube.force-ssl"
"https://www.googleapis.com/auth/youtubepartner"]}
[auth args body]
{:pre [(util/has-keys? args #{:part})]}
(util/get-response
(http/put
(util/get-url
"https://www.googleapis.com/youtube/v3/"
"playlists"
#{:part}
args)
(merge-with
merge
{:content-type :json,
:body (json/generate-string body),
:throw-exceptions false,
:query-params args,
:accept :json,
:as :json}
auth))))