1 | <?php
|
---|
2 | /*
|
---|
3 | * Copyright 2014 Google Inc.
|
---|
4 | *
|
---|
5 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
---|
6 | * use this file except in compliance with the License. You may obtain a copy of
|
---|
7 | * the License at
|
---|
8 | *
|
---|
9 | * http://www.apache.org/licenses/LICENSE-2.0
|
---|
10 | *
|
---|
11 | * Unless required by applicable law or agreed to in writing, software
|
---|
12 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
---|
13 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
---|
14 | * License for the specific language governing permissions and limitations under
|
---|
15 | * the License.
|
---|
16 | */
|
---|
17 |
|
---|
18 | namespace Google\Service\YouTube\Resource;
|
---|
19 |
|
---|
20 | use Google\Service\YouTube\Video;
|
---|
21 | use Google\Service\YouTube\VideoAbuseReport;
|
---|
22 | use Google\Service\YouTube\VideoGetRatingResponse;
|
---|
23 | use Google\Service\YouTube\VideoListResponse;
|
---|
24 |
|
---|
25 | /**
|
---|
26 | * The "videos" collection of methods.
|
---|
27 | * Typical usage is:
|
---|
28 | * <code>
|
---|
29 | * $youtubeService = new Google\Service\YouTube(...);
|
---|
30 | * $videos = $youtubeService->videos;
|
---|
31 | * </code>
|
---|
32 | */
|
---|
33 | class Videos extends \Google\Service\Resource
|
---|
34 | {
|
---|
35 | /**
|
---|
36 | * Deletes a resource. (videos.delete)
|
---|
37 | *
|
---|
38 | * @param string $id
|
---|
39 | * @param array $optParams Optional parameters.
|
---|
40 | *
|
---|
41 | * @opt_param string onBehalfOfContentOwner *Note:* This parameter is intended
|
---|
42 | * exclusively for YouTube content partners. The *onBehalfOfContentOwner*
|
---|
43 | * parameter indicates that the request's authorization credentials identify a
|
---|
44 | * YouTube CMS user who is acting on behalf of the content owner specified in
|
---|
45 | * the parameter value. This parameter is intended for YouTube content partners
|
---|
46 | * that own and manage many different YouTube channels. It allows content owners
|
---|
47 | * to authenticate once and get access to all their video and channel data,
|
---|
48 | * without having to provide authentication credentials for each individual
|
---|
49 | * channel. The actual CMS account that the user authenticates with must be
|
---|
50 | * linked to the specified YouTube content owner.
|
---|
51 | * @throws \Google\Service\Exception
|
---|
52 | */
|
---|
53 | public function delete($id, $optParams = [])
|
---|
54 | {
|
---|
55 | $params = ['id' => $id];
|
---|
56 | $params = array_merge($params, $optParams);
|
---|
57 | return $this->call('delete', [$params]);
|
---|
58 | }
|
---|
59 | /**
|
---|
60 | * Retrieves the ratings that the authorized user gave to a list of specified
|
---|
61 | * videos. (videos.getRating)
|
---|
62 | *
|
---|
63 | * @param string|array $id
|
---|
64 | * @param array $optParams Optional parameters.
|
---|
65 | *
|
---|
66 | * @opt_param string onBehalfOfContentOwner *Note:* This parameter is intended
|
---|
67 | * exclusively for YouTube content partners. The *onBehalfOfContentOwner*
|
---|
68 | * parameter indicates that the request's authorization credentials identify a
|
---|
69 | * YouTube CMS user who is acting on behalf of the content owner specified in
|
---|
70 | * the parameter value. This parameter is intended for YouTube content partners
|
---|
71 | * that own and manage many different YouTube channels. It allows content owners
|
---|
72 | * to authenticate once and get access to all their video and channel data,
|
---|
73 | * without having to provide authentication credentials for each individual
|
---|
74 | * channel. The CMS account that the user authenticates with must be linked to
|
---|
75 | * the specified YouTube content owner.
|
---|
76 | * @return VideoGetRatingResponse
|
---|
77 | * @throws \Google\Service\Exception
|
---|
78 | */
|
---|
79 | public function getRating($id, $optParams = [])
|
---|
80 | {
|
---|
81 | $params = ['id' => $id];
|
---|
82 | $params = array_merge($params, $optParams);
|
---|
83 | return $this->call('getRating', [$params], VideoGetRatingResponse::class);
|
---|
84 | }
|
---|
85 | /**
|
---|
86 | * Inserts a new resource into this collection. (videos.insert)
|
---|
87 | *
|
---|
88 | * @param string|array $part The *part* parameter serves two purposes in this
|
---|
89 | * operation. It identifies the properties that the write operation will set as
|
---|
90 | * well as the properties that the API response will include. Note that not all
|
---|
91 | * parts contain properties that can be set when inserting or updating a video.
|
---|
92 | * For example, the statistics object encapsulates statistics that YouTube
|
---|
93 | * calculates for a video and does not contain values that you can set or
|
---|
94 | * modify. If the parameter value specifies a part that does not contain mutable
|
---|
95 | * values, that part will still be included in the API response.
|
---|
96 | * @param Video $postBody
|
---|
97 | * @param array $optParams Optional parameters.
|
---|
98 | *
|
---|
99 | * @opt_param bool autoLevels Should auto-levels be applied to the upload.
|
---|
100 | * @opt_param bool notifySubscribers Notify the channel subscribers about the
|
---|
101 | * new video. As default, the notification is enabled.
|
---|
102 | * @opt_param string onBehalfOfContentOwner *Note:* This parameter is intended
|
---|
103 | * exclusively for YouTube content partners. The *onBehalfOfContentOwner*
|
---|
104 | * parameter indicates that the request's authorization credentials identify a
|
---|
105 | * YouTube CMS user who is acting on behalf of the content owner specified in
|
---|
106 | * the parameter value. This parameter is intended for YouTube content partners
|
---|
107 | * that own and manage many different YouTube channels. It allows content owners
|
---|
108 | * to authenticate once and get access to all their video and channel data,
|
---|
109 | * without having to provide authentication credentials for each individual
|
---|
110 | * channel. The CMS account that the user authenticates with must be linked to
|
---|
111 | * the specified YouTube content owner.
|
---|
112 | * @opt_param string onBehalfOfContentOwnerChannel This parameter can only be
|
---|
113 | * used in a properly authorized request. *Note:* This parameter is intended
|
---|
114 | * exclusively for YouTube content partners. The *onBehalfOfContentOwnerChannel*
|
---|
115 | * parameter specifies the YouTube channel ID of the channel to which a video is
|
---|
116 | * being added. This parameter is required when a request specifies a value for
|
---|
117 | * the onBehalfOfContentOwner parameter, and it can only be used in conjunction
|
---|
118 | * with that parameter. In addition, the request must be authorized using a CMS
|
---|
119 | * account that is linked to the content owner that the onBehalfOfContentOwner
|
---|
120 | * parameter specifies. Finally, the channel that the
|
---|
121 | * onBehalfOfContentOwnerChannel parameter value specifies must be linked to the
|
---|
122 | * content owner that the onBehalfOfContentOwner parameter specifies. This
|
---|
123 | * parameter is intended for YouTube content partners that own and manage many
|
---|
124 | * different YouTube channels. It allows content owners to authenticate once and
|
---|
125 | * perform actions on behalf of the channel specified in the parameter value,
|
---|
126 | * without having to provide authentication credentials for each separate
|
---|
127 | * channel.
|
---|
128 | * @opt_param bool stabilize Should stabilize be applied to the upload.
|
---|
129 | * @return Video
|
---|
130 | * @throws \Google\Service\Exception
|
---|
131 | */
|
---|
132 | public function insert($part, Video $postBody, $optParams = [])
|
---|
133 | {
|
---|
134 | $params = ['part' => $part, 'postBody' => $postBody];
|
---|
135 | $params = array_merge($params, $optParams);
|
---|
136 | return $this->call('insert', [$params], Video::class);
|
---|
137 | }
|
---|
138 | /**
|
---|
139 | * Retrieves a list of resources, possibly filtered. (videos.listVideos)
|
---|
140 | *
|
---|
141 | * @param string|array $part The *part* parameter specifies a comma-separated
|
---|
142 | * list of one or more video resource properties that the API response will
|
---|
143 | * include. If the parameter identifies a property that contains child
|
---|
144 | * properties, the child properties will be included in the response. For
|
---|
145 | * example, in a video resource, the snippet property contains the channelId,
|
---|
146 | * title, description, tags, and categoryId properties. As such, if you set
|
---|
147 | * *part=snippet*, the API response will contain all of those properties.
|
---|
148 | * @param array $optParams Optional parameters.
|
---|
149 | *
|
---|
150 | * @opt_param string chart Return the videos that are in the specified chart.
|
---|
151 | * @opt_param string hl Stands for "host language". Specifies the localization
|
---|
152 | * language of the metadata to be filled into snippet.localized. The field is
|
---|
153 | * filled with the default metadata if there is no localization in the specified
|
---|
154 | * language. The parameter value must be a language code included in the list
|
---|
155 | * returned by the i18nLanguages.list method (e.g. en_US, es_MX).
|
---|
156 | * @opt_param string id Return videos with the given ids.
|
---|
157 | * @opt_param string locale
|
---|
158 | * @opt_param int maxHeight
|
---|
159 | * @opt_param string maxResults The *maxResults* parameter specifies the maximum
|
---|
160 | * number of items that should be returned in the result set. *Note:* This
|
---|
161 | * parameter is supported for use in conjunction with the myRating and chart
|
---|
162 | * parameters, but it is not supported for use in conjunction with the id
|
---|
163 | * parameter.
|
---|
164 | * @opt_param int maxWidth Return the player with maximum height specified in
|
---|
165 | * @opt_param string myRating Return videos liked/disliked by the authenticated
|
---|
166 | * user. Does not support RateType.RATED_TYPE_NONE.
|
---|
167 | * @opt_param string onBehalfOfContentOwner *Note:* This parameter is intended
|
---|
168 | * exclusively for YouTube content partners. The *onBehalfOfContentOwner*
|
---|
169 | * parameter indicates that the request's authorization credentials identify a
|
---|
170 | * YouTube CMS user who is acting on behalf of the content owner specified in
|
---|
171 | * the parameter value. This parameter is intended for YouTube content partners
|
---|
172 | * that own and manage many different YouTube channels. It allows content owners
|
---|
173 | * to authenticate once and get access to all their video and channel data,
|
---|
174 | * without having to provide authentication credentials for each individual
|
---|
175 | * channel. The CMS account that the user authenticates with must be linked to
|
---|
176 | * the specified YouTube content owner.
|
---|
177 | * @opt_param string pageToken The *pageToken* parameter identifies a specific
|
---|
178 | * page in the result set that should be returned. In an API response, the
|
---|
179 | * nextPageToken and prevPageToken properties identify other pages that could be
|
---|
180 | * retrieved. *Note:* This parameter is supported for use in conjunction with
|
---|
181 | * the myRating and chart parameters, but it is not supported for use in
|
---|
182 | * conjunction with the id parameter.
|
---|
183 | * @opt_param string regionCode Use a chart that is specific to the specified
|
---|
184 | * region
|
---|
185 | * @opt_param string videoCategoryId Use chart that is specific to the specified
|
---|
186 | * video category
|
---|
187 | * @return VideoListResponse
|
---|
188 | * @throws \Google\Service\Exception
|
---|
189 | */
|
---|
190 | public function listVideos($part, $optParams = [])
|
---|
191 | {
|
---|
192 | $params = ['part' => $part];
|
---|
193 | $params = array_merge($params, $optParams);
|
---|
194 | return $this->call('list', [$params], VideoListResponse::class);
|
---|
195 | }
|
---|
196 | /**
|
---|
197 | * Adds a like or dislike rating to a video or removes a rating from a video.
|
---|
198 | * (videos.rate)
|
---|
199 | *
|
---|
200 | * @param string $id
|
---|
201 | * @param string $rating
|
---|
202 | * @param array $optParams Optional parameters.
|
---|
203 | * @throws \Google\Service\Exception
|
---|
204 | */
|
---|
205 | public function rate($id, $rating, $optParams = [])
|
---|
206 | {
|
---|
207 | $params = ['id' => $id, 'rating' => $rating];
|
---|
208 | $params = array_merge($params, $optParams);
|
---|
209 | return $this->call('rate', [$params]);
|
---|
210 | }
|
---|
211 | /**
|
---|
212 | * Report abuse for a video. (videos.reportAbuse)
|
---|
213 | *
|
---|
214 | * @param VideoAbuseReport $postBody
|
---|
215 | * @param array $optParams Optional parameters.
|
---|
216 | *
|
---|
217 | * @opt_param string onBehalfOfContentOwner *Note:* This parameter is intended
|
---|
218 | * exclusively for YouTube content partners. The *onBehalfOfContentOwner*
|
---|
219 | * parameter indicates that the request's authorization credentials identify a
|
---|
220 | * YouTube CMS user who is acting on behalf of the content owner specified in
|
---|
221 | * the parameter value. This parameter is intended for YouTube content partners
|
---|
222 | * that own and manage many different YouTube channels. It allows content owners
|
---|
223 | * to authenticate once and get access to all their video and channel data,
|
---|
224 | * without having to provide authentication credentials for each individual
|
---|
225 | * channel. The CMS account that the user authenticates with must be linked to
|
---|
226 | * the specified YouTube content owner.
|
---|
227 | * @throws \Google\Service\Exception
|
---|
228 | */
|
---|
229 | public function reportAbuse(VideoAbuseReport $postBody, $optParams = [])
|
---|
230 | {
|
---|
231 | $params = ['postBody' => $postBody];
|
---|
232 | $params = array_merge($params, $optParams);
|
---|
233 | return $this->call('reportAbuse', [$params]);
|
---|
234 | }
|
---|
235 | /**
|
---|
236 | * Updates an existing resource. (videos.update)
|
---|
237 | *
|
---|
238 | * @param string|array $part The *part* parameter serves two purposes in this
|
---|
239 | * operation. It identifies the properties that the write operation will set as
|
---|
240 | * well as the properties that the API response will include. Note that this
|
---|
241 | * method will override the existing values for all of the mutable properties
|
---|
242 | * that are contained in any parts that the parameter value specifies. For
|
---|
243 | * example, a video's privacy setting is contained in the status part. As such,
|
---|
244 | * if your request is updating a private video, and the request's part parameter
|
---|
245 | * value includes the status part, the video's privacy setting will be updated
|
---|
246 | * to whatever value the request body specifies. If the request body does not
|
---|
247 | * specify a value, the existing privacy setting will be removed and the video
|
---|
248 | * will revert to the default privacy setting. In addition, not all parts
|
---|
249 | * contain properties that can be set when inserting or updating a video. For
|
---|
250 | * example, the statistics object encapsulates statistics that YouTube
|
---|
251 | * calculates for a video and does not contain values that you can set or
|
---|
252 | * modify. If the parameter value specifies a part that does not contain mutable
|
---|
253 | * values, that part will still be included in the API response.
|
---|
254 | * @param Video $postBody
|
---|
255 | * @param array $optParams Optional parameters.
|
---|
256 | *
|
---|
257 | * @opt_param string onBehalfOfContentOwner *Note:* This parameter is intended
|
---|
258 | * exclusively for YouTube content partners. The *onBehalfOfContentOwner*
|
---|
259 | * parameter indicates that the request's authorization credentials identify a
|
---|
260 | * YouTube CMS user who is acting on behalf of the content owner specified in
|
---|
261 | * the parameter value. This parameter is intended for YouTube content partners
|
---|
262 | * that own and manage many different YouTube channels. It allows content owners
|
---|
263 | * to authenticate once and get access to all their video and channel data,
|
---|
264 | * without having to provide authentication credentials for each individual
|
---|
265 | * channel. The actual CMS account that the user authenticates with must be
|
---|
266 | * linked to the specified YouTube content owner.
|
---|
267 | * @return Video
|
---|
268 | * @throws \Google\Service\Exception
|
---|
269 | */
|
---|
270 | public function update($part, Video $postBody, $optParams = [])
|
---|
271 | {
|
---|
272 | $params = ['part' => $part, 'postBody' => $postBody];
|
---|
273 | $params = array_merge($params, $optParams);
|
---|
274 | return $this->call('update', [$params], Video::class);
|
---|
275 | }
|
---|
276 | }
|
---|
277 |
|
---|
278 | // Adding a class alias for backwards compatibility with the previous class name.
|
---|
279 | class_alias(Videos::class, 'Google_Service_YouTube_Resource_Videos');
|
---|