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\DisplayVideo\Resource; 19 20 use Google\Service\DisplayVideo\Channel; 21 use Google\Service\DisplayVideo\ListChannelsResponse; 22 23 /** 24 * The "channels" collection of methods. 25 * Typical usage is: 26 * <code> 27 * $displayvideoService = new Google\Service\DisplayVideo(...); 28 * $channels = $displayvideoService->channels; 29 * </code> 30 */ 31 class PartnersChannels extends \Google\Service\Resource 32 { 33 /** 34 * Creates a new channel. Returns the newly created channel if successful. 35 * (channels.create) 36 * 37 * @param string $partnerId The ID of the partner that owns the created channel. 38 * @param Channel $postBody 39 * @param array $optParams Optional parameters. 40 * 41 * @opt_param string advertiserId The ID of the advertiser that owns the created 42 * channel. 43 * @return Channel 44 */ 45 public function create($partnerId, Channel $postBody, $optParams = []) 46 { 47 $params = ['partnerId' => $partnerId, 'postBody' => $postBody]; 48 $params = array_merge($params, $optParams); 49 return $this->call('create', [$params], Channel::class); 50 } 51 /** 52 * Gets a channel for a partner or advertiser. (channels.get) 53 * 54 * @param string $partnerId The ID of the partner that owns the fetched channel. 55 * @param string $channelId Required. The ID of the channel to fetch. 56 * @param array $optParams Optional parameters. 57 * 58 * @opt_param string advertiserId The ID of the advertiser that owns the fetched 59 * channel. 60 * @return Channel 61 */ 62 public function get($partnerId, $channelId, $optParams = []) 63 { 64 $params = ['partnerId' => $partnerId, 'channelId' => $channelId]; 65 $params = array_merge($params, $optParams); 66 return $this->call('get', [$params], Channel::class); 67 } 68 /** 69 * Lists channels for a partner or advertiser. (channels.listPartnersChannels) 70 * 71 * @param string $partnerId The ID of the partner that owns the channels. 72 * @param array $optParams Optional parameters. 73 * 74 * @opt_param string advertiserId The ID of the advertiser that owns the 75 * channels. 76 * @opt_param string filter Allows filtering by channel fields. Supported 77 * syntax: * Filter expressions for channel currently can only contain at most 78 * one * restriction. * A restriction has the form of `{field} {operator} 79 * {value}`. * The operator must be `CONTAINS (:)`. * Supported fields: - 80 * `displayName` Examples: * All channels for which the display name contains 81 * "google": `displayName : "google"`. The length of this field should be no 82 * more than 500 characters. 83 * @opt_param string orderBy Field by which to sort the list. Acceptable values 84 * are: * `displayName` (default) * `channelId` The default sorting order is 85 * ascending. To specify descending order for a field, a suffix " desc" should 86 * be added to the field name. Example: `displayName desc`. 87 * @opt_param int pageSize Requested page size. Must be between `1` and `100`. 88 * If unspecified will default to `100`. Returns error code `INVALID_ARGUMENT` 89 * if an invalid value is specified. 90 * @opt_param string pageToken A token identifying a page of results the server 91 * should return. Typically, this is the value of next_page_token returned from 92 * the previous call to `ListChannels` method. If not specified, the first page 93 * of results will be returned. 94 * @return ListChannelsResponse 95 */ 96 public function listPartnersChannels($partnerId, $optParams = []) 97 { 98 $params = ['partnerId' => $partnerId]; 99 $params = array_merge($params, $optParams); 100 return $this->call('list', [$params], ListChannelsResponse::class); 101 } 102 /** 103 * Updates a channel. Returns the updated channel if successful. 104 * (channels.patch) 105 * 106 * @param string $partnerId The ID of the partner that owns the created channel. 107 * @param string $channelId Output only. The unique ID of the channel. Assigned 108 * by the system. 109 * @param Channel $postBody 110 * @param array $optParams Optional parameters. 111 * 112 * @opt_param string advertiserId The ID of the advertiser that owns the created 113 * channel. 114 * @opt_param string updateMask Required. The mask to control which fields to 115 * update. 116 * @return Channel 117 */ 118 public function patch($partnerId, $channelId, Channel $postBody, $optParams = []) 119 { 120 $params = ['partnerId' => $partnerId, 'channelId' => $channelId, 'postBody' => $postBody]; 121 $params = array_merge($params, $optParams); 122 return $this->call('patch', [$params], Channel::class); 123 } 124 } 125 126 // Adding a class alias for backwards compatibility with the previous class name. 127 class_alias(PartnersChannels::class, 'Google_Service_DisplayVideo_Resource_PartnersChannels'); 128