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\Advertiser;
21use Google\Service\DisplayVideo\AuditAdvertiserResponse;
22use Google\Service\DisplayVideo\BulkEditAdvertiserAssignedTargetingOptionsRequest;
23use Google\Service\DisplayVideo\BulkEditAdvertiserAssignedTargetingOptionsResponse;
24use Google\Service\DisplayVideo\BulkListAdvertiserAssignedTargetingOptionsResponse;
25use Google\Service\DisplayVideo\DisplayvideoEmpty;
26use Google\Service\DisplayVideo\ListAdvertisersResponse;
27
28/**
29 * The "advertisers" collection of methods.
30 * Typical usage is:
31 *  <code>
32 *   $displayvideoService = new Google\Service\DisplayVideo(...);
33 *   $advertisers = $displayvideoService->advertisers;
34 *  </code>
35 */
36class Advertisers extends \Google\Service\Resource
37{
38  /**
39   * Audits an advertiser. Returns the counts of used entities per resource type
40   * under the advertiser provided. Used entities count towards their respective
41   * resource limit. See https://support.google.com/displayvideo/answer/6071450.
42   * (advertisers.audit)
43   *
44   * @param string $advertiserId Required. The ID of the advertiser to audit.
45   * @param array $optParams Optional parameters.
46   *
47   * @opt_param string readMask Optional. The specific fields to return. If no
48   * mask is specified, all fields in the response proto will be filled. Valid
49   * values are: * usedLineItemsCount * usedInsertionOrdersCount *
50   * usedCampaignsCount * channelsCount * negativelyTargetedChannelsCount *
51   * negativeKeywordListsCount * adGroupCriteriaCount * campaignCriteriaCount
52   * @return AuditAdvertiserResponse
53   */
54  public function audit($advertiserId, $optParams = [])
55  {
56    $params = ['advertiserId' => $advertiserId];
57    $params = array_merge($params, $optParams);
58    return $this->call('audit', [$params], AuditAdvertiserResponse::class);
59  }
60  /**
61   * Bulk edits targeting options under a single advertiser. The operation will
62   * delete the assigned targeting options provided in
63   * BulkEditAdvertiserAssignedTargetingOptionsRequest.delete_requests and then
64   * create the assigned targeting options provided in
65   * BulkEditAdvertiserAssignedTargetingOptionsRequest.create_requests .
66   * (advertisers.bulkEditAdvertiserAssignedTargetingOptions)
67   *
68   * @param string $advertiserId Required. The ID of the advertiser.
69   * @param BulkEditAdvertiserAssignedTargetingOptionsRequest $postBody
70   * @param array $optParams Optional parameters.
71   * @return BulkEditAdvertiserAssignedTargetingOptionsResponse
72   */
73  public function bulkEditAdvertiserAssignedTargetingOptions($advertiserId, BulkEditAdvertiserAssignedTargetingOptionsRequest $postBody, $optParams = [])
74  {
75    $params = ['advertiserId' => $advertiserId, 'postBody' => $postBody];
76    $params = array_merge($params, $optParams);
77    return $this->call('bulkEditAdvertiserAssignedTargetingOptions', [$params], BulkEditAdvertiserAssignedTargetingOptionsResponse::class);
78  }
79  /**
80   * Lists assigned targeting options of an advertiser across targeting types.
81   * (advertisers.bulkListAdvertiserAssignedTargetingOptions)
82   *
83   * @param string $advertiserId Required. The ID of the advertiser the line item
84   * belongs to.
85   * @param array $optParams Optional parameters.
86   *
87   * @opt_param string filter Allows filtering by assigned targeting option
88   * properties. Supported syntax: * Filter expressions are made up of one or more
89   * restrictions. * Restrictions can be combined by the logical operator `OR`.. *
90   * A restriction has the form of `{field} {operator} {value}`. * The operator
91   * must be `EQUALS (=)`. * Supported fields: - `targetingType` Examples: *
92   * targetingType with value TARGETING_TYPE_CHANNEL
93   * `targetingType="TARGETING_TYPE_CHANNEL"` The length of this field should be
94   * no more than 500 characters.
95   * @opt_param string orderBy Field by which to sort the list. Acceptable values
96   * are: * `targetingType` (default) The default sorting order is ascending. To
97   * specify descending order for a field, a suffix "desc" should be added to the
98   * field name. Example: `targetingType desc`.
99   * @opt_param int pageSize Requested page size. The size must be an integer
100   * between `1` and `5000`. If unspecified, the default is '5000'. Returns error
101   * code `INVALID_ARGUMENT` if an invalid value is specified.
102   * @opt_param string pageToken A token that lets the client fetch the next page
103   * of results. Typically, this is the value of next_page_token returned from the
104   * previous call to `BulkListAdvertiserAssignedTargetingOptions` method. If not
105   * specified, the first page of results will be returned.
106   * @return BulkListAdvertiserAssignedTargetingOptionsResponse
107   */
108  public function bulkListAdvertiserAssignedTargetingOptions($advertiserId, $optParams = [])
109  {
110    $params = ['advertiserId' => $advertiserId];
111    $params = array_merge($params, $optParams);
112    return $this->call('bulkListAdvertiserAssignedTargetingOptions', [$params], BulkListAdvertiserAssignedTargetingOptionsResponse::class);
113  }
114  /**
115   * Creates a new advertiser. Returns the newly created advertiser if successful.
116   * This method can take up to 180 seconds to complete. (advertisers.create)
117   *
118   * @param Advertiser $postBody
119   * @param array $optParams Optional parameters.
120   * @return Advertiser
121   */
122  public function create(Advertiser $postBody, $optParams = [])
123  {
124    $params = ['postBody' => $postBody];
125    $params = array_merge($params, $optParams);
126    return $this->call('create', [$params], Advertiser::class);
127  }
128  /**
129   * Deletes an advertiser. Deleting an advertiser will delete all of its child
130   * resources, for example, campaigns, insertion orders and line items. A deleted
131   * advertiser cannot be recovered. (advertisers.delete)
132   *
133   * @param string $advertiserId The ID of the advertiser we need to delete.
134   * @param array $optParams Optional parameters.
135   * @return DisplayvideoEmpty
136   */
137  public function delete($advertiserId, $optParams = [])
138  {
139    $params = ['advertiserId' => $advertiserId];
140    $params = array_merge($params, $optParams);
141    return $this->call('delete', [$params], DisplayvideoEmpty::class);
142  }
143  /**
144   * Gets an advertiser. (advertisers.get)
145   *
146   * @param string $advertiserId Required. The ID of the advertiser to fetch.
147   * @param array $optParams Optional parameters.
148   * @return Advertiser
149   */
150  public function get($advertiserId, $optParams = [])
151  {
152    $params = ['advertiserId' => $advertiserId];
153    $params = array_merge($params, $optParams);
154    return $this->call('get', [$params], Advertiser::class);
155  }
156  /**
157   * Lists advertisers that are accessible to the current user. The order is
158   * defined by the order_by parameter. A single partner_id is required. Cross-
159   * partner listing is not supported. (advertisers.listAdvertisers)
160   *
161   * @param array $optParams Optional parameters.
162   *
163   * @opt_param string filter Allows filtering by advertiser properties. Supported
164   * syntax: * Filter expressions are made up of one or more restrictions. *
165   * Restrictions can be combined by `AND` or `OR` logical operators. A sequence
166   * of restrictions implicitly uses `AND`. * A restriction has the form of
167   * `{field} {operator} {value}`. * The operator used on `updateTime` must be
168   * `GREATER THAN OR EQUAL TO (>=)` or `LESS THAN OR EQUAL TO (<=)`. * The
169   * operator must be `EQUALS (=)`. * Supported fields: - `advertiserId` -
170   * `displayName` - `entityStatus` - `updateTime` (input in ISO 8601 format, or
171   * YYYY-MM-DDTHH:MM:SSZ) Examples: * All active advertisers under a partner:
172   * `entityStatus="ENTITY_STATUS_ACTIVE"` * All advertisers with an update time
173   * less than or equal to `2020-11-04T18:54:47Z (format of ISO 8601)`:
174   * `updateTime<="2020-11-04T18:54:47Z"` * All advertisers with an update time
175   * greater than or equal to `2020-11-04T18:54:47Z (format of ISO 8601)`:
176   * `updateTime>="2020-11-04T18:54:47Z"` The length of this field should be no
177   * more than 500 characters.
178   * @opt_param string orderBy Field by which to sort the list. Acceptable values
179   * are: * `displayName` (default) * `entityStatus` * `updateTime` The default
180   * sorting order is ascending. To specify descending order for a field, a suffix
181   * "desc" should be added to the field name. For example, `displayName desc`.
182   * @opt_param int pageSize Requested page size. Must be between `1` and `100`.
183   * If unspecified will default to `100`.
184   * @opt_param string pageToken A token identifying a page of results the server
185   * should return. Typically, this is the value of next_page_token returned from
186   * the previous call to `ListAdvertisers` method. If not specified, the first
187   * page of results will be returned.
188   * @opt_param string partnerId Required. The ID of the partner that the fetched
189   * advertisers should all belong to. The system only supports listing
190   * advertisers for one partner at a time.
191   * @return ListAdvertisersResponse
192   */
193  public function listAdvertisers($optParams = [])
194  {
195    $params = [];
196    $params = array_merge($params, $optParams);
197    return $this->call('list', [$params], ListAdvertisersResponse::class);
198  }
199  /**
200   * Updates an existing advertiser. Returns the updated advertiser if successful.
201   * (advertisers.patch)
202   *
203   * @param string $advertiserId Output only. The unique ID of the advertiser.
204   * Assigned by the system.
205   * @param Advertiser $postBody
206   * @param array $optParams Optional parameters.
207   *
208   * @opt_param string updateMask Required. The mask to control which fields to
209   * update.
210   * @return Advertiser
211   */
212  public function patch($advertiserId, Advertiser $postBody, $optParams = [])
213  {
214    $params = ['advertiserId' => $advertiserId, 'postBody' => $postBody];
215    $params = array_merge($params, $optParams);
216    return $this->call('patch', [$params], Advertiser::class);
217  }
218}
219
220// Adding a class alias for backwards compatibility with the previous class name.
221class_alias(Advertisers::class, 'Google_Service_DisplayVideo_Resource_Advertisers');
222