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\Channel;
|
---|
21 | use 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 | */
|
---|
31 | class 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 forHandle Return the channel associated with a YouTube
|
---|
49 | * handle.
|
---|
50 | * @opt_param string forUsername Return the channel associated with a YouTube
|
---|
51 | * username.
|
---|
52 | * @opt_param string hl Stands for "host language". Specifies the localization
|
---|
53 | * language of the metadata to be filled into snippet.localized. The field is
|
---|
54 | * filled with the default metadata if there is no localization in the specified
|
---|
55 | * language. The parameter value must be a language code included in the list
|
---|
56 | * returned by the i18nLanguages.list method (e.g. en_US, es_MX).
|
---|
57 | * @opt_param string id Return the channels with the specified IDs.
|
---|
58 | * @opt_param bool managedByMe Return the channels managed by the authenticated
|
---|
59 | * user.
|
---|
60 | * @opt_param string maxResults The *maxResults* parameter specifies the maximum
|
---|
61 | * number of items that should be returned in the result set.
|
---|
62 | * @opt_param bool mine Return the ids of channels owned by the authenticated
|
---|
63 | * user.
|
---|
64 | * @opt_param bool mySubscribers Return the channels subscribed to the
|
---|
65 | * authenticated user
|
---|
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 | * @opt_param string pageToken The *pageToken* parameter identifies a specific
|
---|
77 | * page in the result set that should be returned. In an API response, the
|
---|
78 | * nextPageToken and prevPageToken properties identify other pages that could be
|
---|
79 | * retrieved.
|
---|
80 | * @return ChannelListResponse
|
---|
81 | * @throws \Google\Service\Exception
|
---|
82 | */
|
---|
83 | public function listChannels($part, $optParams = [])
|
---|
84 | {
|
---|
85 | $params = ['part' => $part];
|
---|
86 | $params = array_merge($params, $optParams);
|
---|
87 | return $this->call('list', [$params], ChannelListResponse::class);
|
---|
88 | }
|
---|
89 | /**
|
---|
90 | * Updates an existing resource. (channels.update)
|
---|
91 | *
|
---|
92 | * @param string|array $part The *part* parameter serves two purposes in this
|
---|
93 | * operation. It identifies the properties that the write operation will set as
|
---|
94 | * well as the properties that the API response will include. The API currently
|
---|
95 | * only allows the parameter value to be set to either brandingSettings or
|
---|
96 | * invideoPromotion. (You cannot update both of those parts with a single
|
---|
97 | * request.) Note that this method overrides the existing values for all of the
|
---|
98 | * mutable properties that are contained in any parts that the parameter value
|
---|
99 | * specifies.
|
---|
100 | * @param Channel $postBody
|
---|
101 | * @param array $optParams Optional parameters.
|
---|
102 | *
|
---|
103 | * @opt_param string onBehalfOfContentOwner The *onBehalfOfContentOwner*
|
---|
104 | * parameter indicates that the authenticated user is acting on behalf of the
|
---|
105 | * content owner specified in the parameter value. This parameter is intended
|
---|
106 | * for YouTube content partners that own and manage many different YouTube
|
---|
107 | * channels. It allows content owners to authenticate once and get access to all
|
---|
108 | * their video and channel data, without having to provide authentication
|
---|
109 | * credentials for each individual channel. The actual CMS account that the user
|
---|
110 | * authenticates with needs to be linked to the specified YouTube content owner.
|
---|
111 | * @return Channel
|
---|
112 | * @throws \Google\Service\Exception
|
---|
113 | */
|
---|
114 | public function update($part, Channel $postBody, $optParams = [])
|
---|
115 | {
|
---|
116 | $params = ['part' => $part, 'postBody' => $postBody];
|
---|
117 | $params = array_merge($params, $optParams);
|
---|
118 | return $this->call('update', [$params], Channel::class);
|
---|
119 | }
|
---|
120 | }
|
---|
121 |
|
---|
122 | // Adding a class alias for backwards compatibility with the previous class name.
|
---|
123 | class_alias(Channels::class, 'Google_Service_YouTube_Resource_Channels');
|
---|