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