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