/library/Google/vendor/google/apiclient-services/src/Google/Service/YouTube/Resource/Captions.php

https://gitlab.com/vangtrangbac123/zinkaiuit.tk · PHP · 215 lines · 34 code · 1 blank · 180 comment · 0 complexity · b2b0028248b1ad88a8375e3226de1d11 MD5 · raw file

  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. * The "captions" collection of methods.
  19. * Typical usage is:
  20. * <code>
  21. * $youtubeService = new Google_Service_YouTube(...);
  22. * $captions = $youtubeService->captions;
  23. * </code>
  24. */
  25. class Google_Service_YouTube_Resource_Captions extends Google_Service_Resource
  26. {
  27. /**
  28. * Deletes a specified caption track. (captions.delete)
  29. *
  30. * @param string $id The id parameter identifies the caption track that is being
  31. * deleted. The value is a caption track ID as identified by the id property in
  32. * a caption resource.
  33. * @param array $optParams Optional parameters.
  34. *
  35. * @opt_param string onBehalfOf ID of the Google+ Page for the channel that the
  36. * request is be on behalf of
  37. * @opt_param string onBehalfOfContentOwner Note: This parameter is intended
  38. * exclusively for YouTube content partners.
  39. *
  40. * The onBehalfOfContentOwner parameter indicates that the request's
  41. * authorization credentials identify a YouTube CMS user who is acting on behalf
  42. * of the content owner specified in the parameter value. This parameter is
  43. * intended for YouTube content partners that own and manage many different
  44. * YouTube channels. It allows content owners to authenticate once and get
  45. * access to all their video and channel data, without having to provide
  46. * authentication credentials for each individual channel. The actual CMS
  47. * account that the user authenticates with must be linked to the specified
  48. * YouTube content owner.
  49. */
  50. public function delete($id, $optParams = array())
  51. {
  52. $params = array('id' => $id);
  53. $params = array_merge($params, $optParams);
  54. return $this->call('delete', array($params));
  55. }
  56. /**
  57. * Downloads a caption track. The caption track is returned in its original
  58. * format unless the request specifies a value for the tfmt parameter and in its
  59. * original language unless the request specifies a value for the tlang
  60. * parameter. (captions.download)
  61. *
  62. * @param string $id The id parameter identifies the caption track that is being
  63. * retrieved. The value is a caption track ID as identified by the id property
  64. * in a caption resource.
  65. * @param array $optParams Optional parameters.
  66. *
  67. * @opt_param string onBehalfOf ID of the Google+ Page for the channel that the
  68. * request is be on behalf of
  69. * @opt_param string onBehalfOfContentOwner Note: This parameter is intended
  70. * exclusively for YouTube content partners.
  71. *
  72. * The onBehalfOfContentOwner parameter indicates that the request's
  73. * authorization credentials identify a YouTube CMS user who is acting on behalf
  74. * of the content owner specified in the parameter value. This parameter is
  75. * intended for YouTube content partners that own and manage many different
  76. * YouTube channels. It allows content owners to authenticate once and get
  77. * access to all their video and channel data, without having to provide
  78. * authentication credentials for each individual channel. The actual CMS
  79. * account that the user authenticates with must be linked to the specified
  80. * YouTube content owner.
  81. * @opt_param string tfmt The tfmt parameter specifies that the caption track
  82. * should be returned in a specific format. If the parameter is not included in
  83. * the request, the track is returned in its original format.
  84. * @opt_param string tlang The tlang parameter specifies that the API response
  85. * should return a translation of the specified caption track. The parameter
  86. * value is an ISO 639-1 two-letter language code that identifies the desired
  87. * caption language. The translation is generated by using machine translation,
  88. * such as Google Translate.
  89. */
  90. public function download($id, $optParams = array())
  91. {
  92. $params = array('id' => $id);
  93. $params = array_merge($params, $optParams);
  94. return $this->call('download', array($params));
  95. }
  96. /**
  97. * Uploads a caption track. (captions.insert)
  98. *
  99. * @param string $part The part parameter specifies the caption resource parts
  100. * that the API response will include. Set the parameter value to snippet.
  101. * @param Google_Service_YouTube_Caption $postBody
  102. * @param array $optParams Optional parameters.
  103. *
  104. * @opt_param string onBehalfOf ID of the Google+ Page for the channel that the
  105. * request is be on behalf of
  106. * @opt_param string onBehalfOfContentOwner Note: This parameter is intended
  107. * exclusively for YouTube content partners.
  108. *
  109. * The onBehalfOfContentOwner parameter indicates that the request's
  110. * authorization credentials identify a YouTube CMS user who is acting on behalf
  111. * of the content owner specified in the parameter value. This parameter is
  112. * intended for YouTube content partners that own and manage many different
  113. * YouTube channels. It allows content owners to authenticate once and get
  114. * access to all their video and channel data, without having to provide
  115. * authentication credentials for each individual channel. The actual CMS
  116. * account that the user authenticates with must be linked to the specified
  117. * YouTube content owner.
  118. * @opt_param bool sync The sync parameter indicates whether YouTube should
  119. * automatically synchronize the caption file with the audio track of the video.
  120. * If you set the value to true, YouTube will disregard any time codes that are
  121. * in the uploaded caption file and generate new time codes for the captions.
  122. *
  123. * You should set the sync parameter to true if you are uploading a transcript,
  124. * which has no time codes, or if you suspect the time codes in your file are
  125. * incorrect and want YouTube to try to fix them.
  126. * @return Google_Service_YouTube_Caption
  127. */
  128. public function insert($part, Google_Service_YouTube_Caption $postBody, $optParams = array())
  129. {
  130. $params = array('part' => $part, 'postBody' => $postBody);
  131. $params = array_merge($params, $optParams);
  132. return $this->call('insert', array($params), "Google_Service_YouTube_Caption");
  133. }
  134. /**
  135. * Returns a list of caption tracks that are associated with a specified video.
  136. * Note that the API response does not contain the actual captions and that the
  137. * captions.download method provides the ability to retrieve a caption track.
  138. * (captions.listCaptions)
  139. *
  140. * @param string $part The part parameter specifies a comma-separated list of
  141. * one or more caption resource parts that the API response will include. The
  142. * part names that you can include in the parameter value are id and snippet.
  143. * @param string $videoId The videoId parameter specifies the YouTube video ID
  144. * of the video for which the API should return caption tracks.
  145. * @param array $optParams Optional parameters.
  146. *
  147. * @opt_param string id The id parameter specifies a comma-separated list of IDs
  148. * that identify the caption resources that should be retrieved. Each ID must
  149. * identify a caption track associated with the specified video.
  150. * @opt_param string onBehalfOf ID of the Google+ Page for the channel that the
  151. * request is on behalf of.
  152. * @opt_param string onBehalfOfContentOwner Note: This parameter is intended
  153. * exclusively for YouTube content partners.
  154. *
  155. * The onBehalfOfContentOwner parameter indicates that the request's
  156. * authorization credentials identify a YouTube CMS user who is acting on behalf
  157. * of the content owner specified in the parameter value. This parameter is
  158. * intended for YouTube content partners that own and manage many different
  159. * YouTube channels. It allows content owners to authenticate once and get
  160. * access to all their video and channel data, without having to provide
  161. * authentication credentials for each individual channel. The actual CMS
  162. * account that the user authenticates with must be linked to the specified
  163. * YouTube content owner.
  164. * @return Google_Service_YouTube_CaptionListResponse
  165. */
  166. public function listCaptions($part, $videoId, $optParams = array())
  167. {
  168. $params = array('part' => $part, 'videoId' => $videoId);
  169. $params = array_merge($params, $optParams);
  170. return $this->call('list', array($params), "Google_Service_YouTube_CaptionListResponse");
  171. }
  172. /**
  173. * Updates a caption track. When updating a caption track, you can change the
  174. * track's draft status, upload a new caption file for the track, or both.
  175. * (captions.update)
  176. *
  177. * @param string $part The part parameter serves two purposes in this operation.
  178. * It identifies the properties that the write operation will set as well as the
  179. * properties that the API response will include. Set the property value to
  180. * snippet if you are updating the track's draft status. Otherwise, set the
  181. * property value to id.
  182. * @param Google_Service_YouTube_Caption $postBody
  183. * @param array $optParams Optional parameters.
  184. *
  185. * @opt_param string onBehalfOf ID of the Google+ Page for the channel that the
  186. * request is be on behalf of
  187. * @opt_param string onBehalfOfContentOwner Note: This parameter is intended
  188. * exclusively for YouTube content partners.
  189. *
  190. * The onBehalfOfContentOwner parameter indicates that the request's
  191. * authorization credentials identify a YouTube CMS user who is acting on behalf
  192. * of the content owner specified in the parameter value. This parameter is
  193. * intended for YouTube content partners that own and manage many different
  194. * YouTube channels. It allows content owners to authenticate once and get
  195. * access to all their video and channel data, without having to provide
  196. * authentication credentials for each individual channel. The actual CMS
  197. * account that the user authenticates with must be linked to the specified
  198. * YouTube content owner.
  199. * @opt_param bool sync Note: The API server only processes the parameter value
  200. * if the request contains an updated caption file.
  201. *
  202. * The sync parameter indicates whether YouTube should automatically synchronize
  203. * the caption file with the audio track of the video. If you set the value to
  204. * true, YouTube will automatically synchronize the caption track with the audio
  205. * track.
  206. * @return Google_Service_YouTube_Caption
  207. */
  208. public function update($part, Google_Service_YouTube_Caption $postBody, $optParams = array())
  209. {
  210. $params = array('part' => $part, 'postBody' => $postBody);
  211. $params = array_merge($params, $optParams);
  212. return $this->call('update', array($params), "Google_Service_YouTube_Caption");
  213. }
  214. }