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\Subscription;
|
---|
21 | use Google\Service\YouTube\SubscriptionListResponse;
|
---|
22 |
|
---|
23 | /**
|
---|
24 | * The "subscriptions" collection of methods.
|
---|
25 | * Typical usage is:
|
---|
26 | * <code>
|
---|
27 | * $youtubeService = new Google\Service\YouTube(...);
|
---|
28 | * $subscriptions = $youtubeService->subscriptions;
|
---|
29 | * </code>
|
---|
30 | */
|
---|
31 | class Subscriptions extends \Google\Service\Resource
|
---|
32 | {
|
---|
33 | /**
|
---|
34 | * Deletes a resource. (subscriptions.delete)
|
---|
35 | *
|
---|
36 | * @param string $id
|
---|
37 | * @param array $optParams Optional parameters.
|
---|
38 | * @throws \Google\Service\Exception
|
---|
39 | */
|
---|
40 | public function delete($id, $optParams = [])
|
---|
41 | {
|
---|
42 | $params = ['id' => $id];
|
---|
43 | $params = array_merge($params, $optParams);
|
---|
44 | return $this->call('delete', [$params]);
|
---|
45 | }
|
---|
46 | /**
|
---|
47 | * Inserts a new resource into this collection. (subscriptions.insert)
|
---|
48 | *
|
---|
49 | * @param string|array $part The *part* parameter serves two purposes in this
|
---|
50 | * operation. It identifies the properties that the write operation will set as
|
---|
51 | * well as the properties that the API response will include.
|
---|
52 | * @param Subscription $postBody
|
---|
53 | * @param array $optParams Optional parameters.
|
---|
54 | * @return Subscription
|
---|
55 | * @throws \Google\Service\Exception
|
---|
56 | */
|
---|
57 | public function insert($part, Subscription $postBody, $optParams = [])
|
---|
58 | {
|
---|
59 | $params = ['part' => $part, 'postBody' => $postBody];
|
---|
60 | $params = array_merge($params, $optParams);
|
---|
61 | return $this->call('insert', [$params], Subscription::class);
|
---|
62 | }
|
---|
63 | /**
|
---|
64 | * Retrieves a list of resources, possibly filtered.
|
---|
65 | * (subscriptions.listSubscriptions)
|
---|
66 | *
|
---|
67 | * @param string|array $part The *part* parameter specifies a comma-separated
|
---|
68 | * list of one or more subscription resource properties that the API response
|
---|
69 | * will include. If the parameter identifies a property that contains child
|
---|
70 | * properties, the child properties will be included in the response. For
|
---|
71 | * example, in a subscription resource, the snippet property contains other
|
---|
72 | * properties, such as a display title for the subscription. If you set
|
---|
73 | * *part=snippet*, the API response will also contain all of those nested
|
---|
74 | * properties.
|
---|
75 | * @param array $optParams Optional parameters.
|
---|
76 | *
|
---|
77 | * @opt_param string channelId Return the subscriptions of the given channel
|
---|
78 | * owner.
|
---|
79 | * @opt_param string forChannelId Return the subscriptions to the subset of
|
---|
80 | * these channels that the authenticated user is subscribed to.
|
---|
81 | * @opt_param string id Return the subscriptions with the given IDs for Stubby
|
---|
82 | * or Apiary.
|
---|
83 | * @opt_param string maxResults The *maxResults* parameter specifies the maximum
|
---|
84 | * number of items that should be returned in the result set.
|
---|
85 | * @opt_param bool mine Flag for returning the subscriptions of the
|
---|
86 | * authenticated user.
|
---|
87 | * @opt_param bool myRecentSubscribers
|
---|
88 | * @opt_param bool mySubscribers Return the subscribers of the given channel
|
---|
89 | * owner.
|
---|
90 | * @opt_param string onBehalfOfContentOwner *Note:* This parameter is intended
|
---|
91 | * exclusively for YouTube content partners. The *onBehalfOfContentOwner*
|
---|
92 | * parameter indicates that the request's authorization credentials identify a
|
---|
93 | * YouTube CMS user who is acting on behalf of the content owner specified in
|
---|
94 | * the parameter value. This parameter is intended for YouTube content partners
|
---|
95 | * that own and manage many different YouTube channels. It allows content owners
|
---|
96 | * to authenticate once and get access to all their video and channel data,
|
---|
97 | * without having to provide authentication credentials for each individual
|
---|
98 | * channel. The CMS account that the user authenticates with must be linked to
|
---|
99 | * the specified YouTube content owner.
|
---|
100 | * @opt_param string onBehalfOfContentOwnerChannel This parameter can only be
|
---|
101 | * used in a properly authorized request. *Note:* This parameter is intended
|
---|
102 | * exclusively for YouTube content partners. The *onBehalfOfContentOwnerChannel*
|
---|
103 | * parameter specifies the YouTube channel ID of the channel to which a video is
|
---|
104 | * being added. This parameter is required when a request specifies a value for
|
---|
105 | * the onBehalfOfContentOwner parameter, and it can only be used in conjunction
|
---|
106 | * with that parameter. In addition, the request must be authorized using a CMS
|
---|
107 | * account that is linked to the content owner that the onBehalfOfContentOwner
|
---|
108 | * parameter specifies. Finally, the channel that the
|
---|
109 | * onBehalfOfContentOwnerChannel parameter value specifies must be linked to the
|
---|
110 | * content owner that the onBehalfOfContentOwner parameter specifies. This
|
---|
111 | * parameter is intended for YouTube content partners that own and manage many
|
---|
112 | * different YouTube channels. It allows content owners to authenticate once and
|
---|
113 | * perform actions on behalf of the channel specified in the parameter value,
|
---|
114 | * without having to provide authentication credentials for each separate
|
---|
115 | * channel.
|
---|
116 | * @opt_param string order The order of the returned subscriptions
|
---|
117 | * @opt_param string pageToken The *pageToken* parameter identifies a specific
|
---|
118 | * page in the result set that should be returned. In an API response, the
|
---|
119 | * nextPageToken and prevPageToken properties identify other pages that could be
|
---|
120 | * retrieved.
|
---|
121 | * @return SubscriptionListResponse
|
---|
122 | * @throws \Google\Service\Exception
|
---|
123 | */
|
---|
124 | public function listSubscriptions($part, $optParams = [])
|
---|
125 | {
|
---|
126 | $params = ['part' => $part];
|
---|
127 | $params = array_merge($params, $optParams);
|
---|
128 | return $this->call('list', [$params], SubscriptionListResponse::class);
|
---|
129 | }
|
---|
130 | }
|
---|
131 |
|
---|
132 | // Adding a class alias for backwards compatibility with the previous class name.
|
---|
133 | class_alias(Subscriptions::class, 'Google_Service_YouTube_Resource_Subscriptions');
|
---|