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\BulkEditSitesRequest;
21use Google\Service\DisplayVideo\BulkEditSitesResponse;
22use Google\Service\DisplayVideo\DisplayvideoEmpty;
23use Google\Service\DisplayVideo\ListSitesResponse;
24use Google\Service\DisplayVideo\ReplaceSitesRequest;
25use Google\Service\DisplayVideo\ReplaceSitesResponse;
26use Google\Service\DisplayVideo\Site;
27
28/**
29 * The "sites" collection of methods.
30 * Typical usage is:
31 *  <code>
32 *   $displayvideoService = new Google\Service\DisplayVideo(...);
33 *   $sites = $displayvideoService->sites;
34 *  </code>
35 */
36class AdvertisersChannelsSites extends \Google\Service\Resource
37{
38  /**
39   * Bulk edits sites under a single channel. The operation will delete the sites
40   * provided in BulkEditSitesRequest.deleted_sites and then create the sites
41   * provided in BulkEditSitesRequest.created_sites. (sites.bulkEdit)
42   *
43   * @param string $advertiserId The ID of the advertiser that owns the parent
44   * channel.
45   * @param string $channelId Required. The ID of the parent channel to which the
46   * sites belong.
47   * @param BulkEditSitesRequest $postBody
48   * @param array $optParams Optional parameters.
49   * @return BulkEditSitesResponse
50   */
51  public function bulkEdit($advertiserId, $channelId, BulkEditSitesRequest $postBody, $optParams = [])
52  {
53    $params = ['advertiserId' => $advertiserId, 'channelId' => $channelId, 'postBody' => $postBody];
54    $params = array_merge($params, $optParams);
55    return $this->call('bulkEdit', [$params], BulkEditSitesResponse::class);
56  }
57  /**
58   * Creates a site in a channel. (sites.create)
59   *
60   * @param string $advertiserId The ID of the advertiser that owns the parent
61   * channel.
62   * @param string $channelId Required. The ID of the parent channel in which the
63   * site will be created.
64   * @param Site $postBody
65   * @param array $optParams Optional parameters.
66   *
67   * @opt_param string partnerId The ID of the partner that owns the parent
68   * channel.
69   * @return Site
70   */
71  public function create($advertiserId, $channelId, Site $postBody, $optParams = [])
72  {
73    $params = ['advertiserId' => $advertiserId, 'channelId' => $channelId, 'postBody' => $postBody];
74    $params = array_merge($params, $optParams);
75    return $this->call('create', [$params], Site::class);
76  }
77  /**
78   * Deletes a site from a channel. (sites.delete)
79   *
80   * @param string $advertiserId The ID of the advertiser that owns the parent
81   * channel.
82   * @param string $channelId Required. The ID of the parent channel to which the
83   * site belongs.
84   * @param string $urlOrAppId Required. The URL or app ID of the site to delete.
85   * @param array $optParams Optional parameters.
86   *
87   * @opt_param string partnerId The ID of the partner that owns the parent
88   * channel.
89   * @return DisplayvideoEmpty
90   */
91  public function delete($advertiserId, $channelId, $urlOrAppId, $optParams = [])
92  {
93    $params = ['advertiserId' => $advertiserId, 'channelId' => $channelId, 'urlOrAppId' => $urlOrAppId];
94    $params = array_merge($params, $optParams);
95    return $this->call('delete', [$params], DisplayvideoEmpty::class);
96  }
97  /**
98   * Lists sites in a channel. (sites.listAdvertisersChannelsSites)
99   *
100   * @param string $advertiserId The ID of the advertiser that owns the parent
101   * channel.
102   * @param string $channelId Required. The ID of the parent channel to which the
103   * requested sites belong.
104   * @param array $optParams Optional parameters.
105   *
106   * @opt_param string filter Allows filtering by site fields. Supported syntax: *
107   * Filter expressions for site currently can only contain at most one *
108   * restriction. * A restriction has the form of `{field} {operator} {value}`. *
109   * The operator must be `CONTAINS (:)`. * Supported fields: - `urlOrAppId`
110   * Examples: * All sites for which the URL or app ID contains "google":
111   * `urlOrAppId : "google"`
112   * @opt_param string orderBy Field by which to sort the list. Acceptable values
113   * are: * `urlOrAppId` (default) The default sorting order is ascending. To
114   * specify descending order for a field, a suffix " desc" should be added to the
115   * field name. Example: `urlOrAppId desc`.
116   * @opt_param int pageSize Requested page size. Must be between `1` and `10000`.
117   * If unspecified will default to `100`. Returns error code `INVALID_ARGUMENT`
118   * if an invalid value is specified.
119   * @opt_param string pageToken A token identifying a page of results the server
120   * should return. Typically, this is the value of next_page_token returned from
121   * the previous call to `ListSites` method. If not specified, the first page of
122   * results will be returned.
123   * @opt_param string partnerId The ID of the partner that owns the parent
124   * channel.
125   * @return ListSitesResponse
126   */
127  public function listAdvertisersChannelsSites($advertiserId, $channelId, $optParams = [])
128  {
129    $params = ['advertiserId' => $advertiserId, 'channelId' => $channelId];
130    $params = array_merge($params, $optParams);
131    return $this->call('list', [$params], ListSitesResponse::class);
132  }
133  /**
134   * Replaces all of the sites under a single channel. The operation will replace
135   * the sites under a channel with the sites provided in
136   * ReplaceSitesRequest.new_sites. (sites.replace)
137   *
138   * @param string $advertiserId The ID of the advertiser that owns the parent
139   * channel.
140   * @param string $channelId Required. The ID of the parent channel whose sites
141   * will be replaced.
142   * @param ReplaceSitesRequest $postBody
143   * @param array $optParams Optional parameters.
144   * @return ReplaceSitesResponse
145   */
146  public function replace($advertiserId, $channelId, ReplaceSitesRequest $postBody, $optParams = [])
147  {
148    $params = ['advertiserId' => $advertiserId, 'channelId' => $channelId, 'postBody' => $postBody];
149    $params = array_merge($params, $optParams);
150    return $this->call('replace', [$params], ReplaceSitesResponse::class);
151  }
152}
153
154// Adding a class alias for backwards compatibility with the previous class name.
155class_alias(AdvertisersChannelsSites::class, 'Google_Service_DisplayVideo_Resource_AdvertisersChannelsSites');
156