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