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\Caption;
21use Google\Service\YouTube\CaptionListResponse;
22
23/**
24 * The "captions" collection of methods.
25 * Typical usage is:
26 *  <code>
27 *   $youtubeService = new Google\Service\YouTube(...);
28 *   $captions = $youtubeService->captions;
29 *  </code>
30 */
31class Captions extends \Google\Service\Resource
32{
33  /**
34   * Deletes a resource. (captions.delete)
35   *
36   * @param string $id
37   * @param array $optParams Optional parameters.
38   *
39   * @opt_param string onBehalfOf ID of the Google+ Page for the channel that the
40   * request is be on behalf of
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   * Downloads a caption track. (captions.download)
60   *
61   * @param string $id The ID of the caption track to download, required for One
62   * Platform.
63   * @param array $optParams Optional parameters.
64   *
65   * @opt_param string onBehalfOf ID of the Google+ Page for the channel that the
66   * request is be on behalf of
67   * @opt_param string onBehalfOfContentOwner *Note:* This parameter is intended
68   * exclusively for YouTube content partners. The *onBehalfOfContentOwner*
69   * parameter indicates that the request's authorization credentials identify a
70   * YouTube CMS user who is acting on behalf of the content owner specified in
71   * the parameter value. This parameter is intended for YouTube content partners
72   * that own and manage many different YouTube channels. It allows content owners
73   * to authenticate once and get access to all their video and channel data,
74   * without having to provide authentication credentials for each individual
75   * channel. The actual CMS account that the user authenticates with must be
76   * linked to the specified YouTube content owner.
77   * @opt_param string tfmt Convert the captions into this format. Supported
78   * options are sbv, srt, and vtt.
79   * @opt_param string tlang tlang is the language code; machine translate the
80   * captions into this language.
81   */
82  public function download($id, $optParams = [])
83  {
84    $params = ['id' => $id];
85    $params = array_merge($params, $optParams);
86    return $this->call('download', [$params]);
87  }
88  /**
89   * Inserts a new resource into this collection. (captions.insert)
90   *
91   * @param string|array $part The *part* parameter specifies the caption resource
92   * parts that the API response will include. Set the parameter value to snippet.
93   * @param Caption $postBody
94   * @param array $optParams Optional parameters.
95   *
96   * @opt_param string onBehalfOf ID of the Google+ Page for the channel that the
97   * request is be on behalf of
98   * @opt_param string onBehalfOfContentOwner *Note:* This parameter is intended
99   * exclusively for YouTube content partners. The *onBehalfOfContentOwner*
100   * parameter indicates that the request's authorization credentials identify a
101   * YouTube CMS user who is acting on behalf of the content owner specified in
102   * the parameter value. This parameter is intended for YouTube content partners
103   * that own and manage many different YouTube channels. It allows content owners
104   * to authenticate once and get access to all their video and channel data,
105   * without having to provide authentication credentials for each individual
106   * channel. The actual CMS account that the user authenticates with must be
107   * linked to the specified YouTube content owner.
108   * @opt_param bool sync Extra parameter to allow automatically syncing the
109   * uploaded caption/transcript with the audio.
110   * @return Caption
111   */
112  public function insert($part, Caption $postBody, $optParams = [])
113  {
114    $params = ['part' => $part, 'postBody' => $postBody];
115    $params = array_merge($params, $optParams);
116    return $this->call('insert', [$params], Caption::class);
117  }
118  /**
119   * Retrieves a list of resources, possibly filtered. (captions.listCaptions)
120   *
121   * @param string|array $part The *part* parameter specifies a comma-separated
122   * list of one or more caption resource parts that the API response will
123   * include. The part names that you can include in the parameter value are id
124   * and snippet.
125   * @param string $videoId Returns the captions for the specified video.
126   * @param array $optParams Optional parameters.
127   *
128   * @opt_param string id Returns the captions with the given IDs for Stubby or
129   * Apiary.
130   * @opt_param string onBehalfOf ID of the Google+ Page for the channel that the
131   * request is on behalf of.
132   * @opt_param string onBehalfOfContentOwner *Note:* This parameter is intended
133   * exclusively for YouTube content partners. The *onBehalfOfContentOwner*
134   * parameter indicates that the request's authorization credentials identify a
135   * YouTube CMS user who is acting on behalf of the content owner specified in
136   * the parameter value. This parameter is intended for YouTube content partners
137   * that own and manage many different YouTube channels. It allows content owners
138   * to authenticate once and get access to all their video and channel data,
139   * without having to provide authentication credentials for each individual
140   * channel. The actual CMS account that the user authenticates with must be
141   * linked to the specified YouTube content owner.
142   * @return CaptionListResponse
143   */
144  public function listCaptions($part, $videoId, $optParams = [])
145  {
146    $params = ['part' => $part, 'videoId' => $videoId];
147    $params = array_merge($params, $optParams);
148    return $this->call('list', [$params], CaptionListResponse::class);
149  }
150  /**
151   * Updates an existing resource. (captions.update)
152   *
153   * @param string|array $part The *part* parameter specifies a comma-separated
154   * list of one or more caption resource parts that the API response will
155   * include. The part names that you can include in the parameter value are id
156   * and snippet.
157   * @param Caption $postBody
158   * @param array $optParams Optional parameters.
159   *
160   * @opt_param string onBehalfOf ID of the Google+ Page for the channel that the
161   * request is on behalf of.
162   * @opt_param string onBehalfOfContentOwner *Note:* This parameter is intended
163   * exclusively for YouTube content partners. The *onBehalfOfContentOwner*
164   * parameter indicates that the request's authorization credentials identify a
165   * YouTube CMS user who is acting on behalf of the content owner specified in
166   * the parameter value. This parameter is intended for YouTube content partners
167   * that own and manage many different YouTube channels. It allows content owners
168   * to authenticate once and get access to all their video and channel data,
169   * without having to provide authentication credentials for each individual
170   * channel. The actual CMS account that the user authenticates with must be
171   * linked to the specified YouTube content owner.
172   * @opt_param bool sync Extra parameter to allow automatically syncing the
173   * uploaded caption/transcript with the audio.
174   * @return Caption
175   */
176  public function update($part, Caption $postBody, $optParams = [])
177  {
178    $params = ['part' => $part, 'postBody' => $postBody];
179    $params = array_merge($params, $optParams);
180    return $this->call('update', [$params], Caption::class);
181  }
182}
183
184// Adding a class alias for backwards compatibility with the previous class name.
185class_alias(Captions::class, 'Google_Service_YouTube_Resource_Captions');
186