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