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\Channel;
21use Google\Service\YouTube\ChannelListResponse;
22
23/**
24 * The "channels" collection of methods.
25 * Typical usage is:
26 *  <code>
27 *   $youtubeService = new Google\Service\YouTube(...);
28 *   $channels = $youtubeService->channels;
29 *  </code>
30 */
31class Channels extends \Google\Service\Resource
32{
33  /**
34   * Retrieves a list of resources, possibly filtered. (channels.listChannels)
35   *
36   * @param string|array $part The *part* parameter specifies a comma-separated
37   * list of one or more channel resource properties that the API response will
38   * include. If the parameter identifies a property that contains child
39   * properties, the child properties will be included in the response. For
40   * example, in a channel resource, the contentDetails property contains other
41   * properties, such as the uploads properties. As such, if you set
42   * *part=contentDetails*, the API response will also contain all of those nested
43   * properties.
44   * @param array $optParams Optional parameters.
45   *
46   * @opt_param string categoryId Return the channels within the specified guide
47   * category ID.
48   * @opt_param string forUsername Return the channel associated with a YouTube
49   * username.
50   * @opt_param string hl Stands for "host language". Specifies the localization
51   * language of the metadata to be filled into snippet.localized. The field is
52   * filled with the default metadata if there is no localization in the specified
53   * language. The parameter value must be a language code included in the list
54   * returned by the i18nLanguages.list method (e.g. en_US, es_MX).
55   * @opt_param string id Return the channels with the specified IDs.
56   * @opt_param bool managedByMe Return the channels managed by the authenticated
57   * user.
58   * @opt_param string maxResults The *maxResults* parameter specifies the maximum
59   * number of items that should be returned in the result set.
60   * @opt_param bool mine Return the ids of channels owned by the authenticated
61   * user.
62   * @opt_param bool mySubscribers Return the channels subscribed to the
63   * authenticated user
64   * @opt_param string onBehalfOfContentOwner *Note:* This parameter is intended
65   * exclusively for YouTube content partners. The *onBehalfOfContentOwner*
66   * parameter indicates that the request's authorization credentials identify a
67   * YouTube CMS user who is acting on behalf of the content owner specified in
68   * the parameter value. This parameter is intended for YouTube content partners
69   * that own and manage many different YouTube channels. It allows content owners
70   * to authenticate once and get access to all their video and channel data,
71   * without having to provide authentication credentials for each individual
72   * channel. The CMS account that the user authenticates with must be linked to
73   * the specified YouTube content owner.
74   * @opt_param string pageToken The *pageToken* parameter identifies a specific
75   * page in the result set that should be returned. In an API response, the
76   * nextPageToken and prevPageToken properties identify other pages that could be
77   * retrieved.
78   * @return ChannelListResponse
79   */
80  public function listChannels($part, $optParams = [])
81  {
82    $params = ['part' => $part];
83    $params = array_merge($params, $optParams);
84    return $this->call('list', [$params], ChannelListResponse::class);
85  }
86  /**
87   * Updates an existing resource. (channels.update)
88   *
89   * @param string|array $part The *part* parameter serves two purposes in this
90   * operation. It identifies the properties that the write operation will set as
91   * well as the properties that the API response will include. The API currently
92   * only allows the parameter value to be set to either brandingSettings or
93   * invideoPromotion. (You cannot update both of those parts with a single
94   * request.) Note that this method overrides the existing values for all of the
95   * mutable properties that are contained in any parts that the parameter value
96   * specifies.
97   * @param Channel $postBody
98   * @param array $optParams Optional parameters.
99   *
100   * @opt_param string onBehalfOfContentOwner The *onBehalfOfContentOwner*
101   * parameter indicates that the authenticated user is acting on behalf of the
102   * content owner specified in the parameter value. This parameter is intended
103   * for YouTube content partners that own and manage many different YouTube
104   * channels. It allows content owners to authenticate once and get access to all
105   * their video and channel data, without having to provide authentication
106   * credentials for each individual channel. The actual CMS account that the user
107   * authenticates with needs to be linked to the specified YouTube content owner.
108   * @return Channel
109   */
110  public function update($part, Channel $postBody, $optParams = [])
111  {
112    $params = ['part' => $part, 'postBody' => $postBody];
113    $params = array_merge($params, $optParams);
114    return $this->call('update', [$params], Channel::class);
115  }
116}
117
118// Adding a class alias for backwards compatibility with the previous class name.
119class_alias(Channels::class, 'Google_Service_YouTube_Resource_Channels');
120