/
channels.clj
111 lines (101 loc) · 4.08 KB
/
channels.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
(ns happygapi.youtube.channels
"YouTube Data API: channels.
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/channels"
(:require [cheshire.core :as json]
[clj-http.client :as http]
[happy.util :as util]))
(defn list$
"https://developers.google.com/youtube/v3api/reference/rest/v3/channels/list
Required parameters: part
Optional parameters: managedByMe, categoryId, forUsername, pageToken, mine, hl, id, mySubscribers, onBehalfOfContentOwner, maxResults
Returns a collection of zero or more channel resources that match the request criteria."
{: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"
"https://www.googleapis.com/auth/youtubepartner-channel-audit"]}
[auth parameters]
{:pre [(util/has-keys? parameters #{:part})]}
(util/get-response
(http/get
(util/get-url
"https://www.googleapis.com/youtube/v3/"
"channels"
#{: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/channels/update
Required parameters: part
Optional parameters: onBehalfOfContentOwner
Body:
{:contentOwnerDetails {:contentOwner string, :timeLinked string},
:localizations {},
:brandingSettings {:channel ChannelSettings,
:hints [PropertyValue],
:image ImageSettings,
:watch WatchSettings},
:snippet {:country string,
:customUrl string,
:defaultLanguage string,
:description string,
:localized ChannelLocalization,
:publishedAt string,
:thumbnails ThumbnailDetails,
:title string},
:etag string,
:invideoPromotion {:defaultTiming InvideoTiming,
:items [PromotedItem],
:position InvideoPosition,
:useSmartTiming boolean},
:auditDetails {:communityGuidelinesGoodStanding boolean,
:contentIdClaimsGoodStanding boolean,
:copyrightStrikesGoodStanding boolean},
:conversionPings {:pings [ChannelConversionPing]},
:statistics {:commentCount string,
:hiddenSubscriberCount boolean,
:subscriberCount string,
:videoCount string,
:viewCount string},
:status {:isLinked boolean,
:longUploadsStatus string,
:madeForKids boolean,
:privacyStatus string,
:selfDeclaredMadeForKids boolean},
:id string,
:kind string,
:contentDetails {:relatedPlaylists {:favorites string,
:likes string,
:uploads string,
:watchHistory string,
:watchLater string}},
:topicDetails {:topicCategories [string], :topicIds [string]}}
Updates a channel's metadata. Note that this method currently only supports updates to the channel resource's brandingSettings and invideoPromotion objects and their child properties."
{:scopes ["https://www.googleapis.com/auth/youtube"
"https://www.googleapis.com/auth/youtube.force-ssl"
"https://www.googleapis.com/auth/youtubepartner"]}
[auth parameters body]
{:pre [(util/has-keys? parameters #{:part})]}
(util/get-response
(http/put
(util/get-url
"https://www.googleapis.com/youtube/v3/"
"channels"
#{:part}
parameters)
(merge-with
merge
{:content-type :json,
:body (json/generate-string body),
:throw-exceptions false,
:query-params parameters,
:accept :json,
:as :json}
auth))))