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\BulkListInsertionOrderAssignedTargetingOptionsResponse;
21use Google\Service\DisplayVideo\DisplayvideoEmpty;
22use Google\Service\DisplayVideo\InsertionOrder;
23use Google\Service\DisplayVideo\ListInsertionOrdersResponse;
24
25/**
26 * The "insertionOrders" collection of methods.
27 * Typical usage is:
28 *  <code>
29 *   $displayvideoService = new Google\Service\DisplayVideo(...);
30 *   $insertionOrders = $displayvideoService->insertionOrders;
31 *  </code>
32 */
33class AdvertisersInsertionOrders extends \Google\Service\Resource
34{
35  /**
36   * Lists assigned targeting options of an insertion order across targeting
37   * types. (insertionOrders.bulkListInsertionOrderAssignedTargetingOptions)
38   *
39   * @param string $advertiserId Required. The ID of the advertiser the insertion
40   * order belongs to.
41   * @param string $insertionOrderId Required. The ID of the insertion order to
42   * list assigned targeting options for.
43   * @param array $optParams Optional parameters.
44   *
45   * @opt_param string filter Allows filtering by assigned targeting option
46   * properties. Supported syntax: * Filter expressions are made up of one or more
47   * restrictions. * Restrictions can be combined by the logical operator `OR` on
48   * the same field. * A restriction has the form of `{field} {operator} {value}`.
49   * * The operator must be `EQUALS (=)`. * Supported fields: - `targetingType` -
50   * `inheritance` Examples: * AssignedTargetingOptions of targeting type
51   * TARGETING_TYPE_PROXIMITY_LOCATION_LIST or TARGETING_TYPE_CHANNEL
52   * `targetingType="TARGETING_TYPE_PROXIMITY_LOCATION_LIST" OR
53   * targetingType="TARGETING_TYPE_CHANNEL"` * AssignedTargetingOptions with
54   * inheritance status of NOT_INHERITED or INHERITED_FROM_PARTNER
55   * `inheritance="NOT_INHERITED" OR inheritance="INHERITED_FROM_PARTNER"` The
56   * length of this field should be no more than 500 characters.
57   * @opt_param string orderBy Field by which to sort the list. Acceptable values
58   * are: * `targetingType` (default) The default sorting order is ascending. To
59   * specify descending order for a field, a suffix "desc" should be added to the
60   * field name. Example: `targetingType desc`.
61   * @opt_param int pageSize Requested page size. The size must be an integer
62   * between `1` and `5000`. If unspecified, the default is `5000`. Returns error
63   * code `INVALID_ARGUMENT` if an invalid value is specified.
64   * @opt_param string pageToken A token that lets the client fetch the next page
65   * of results. Typically, this is the value of next_page_token returned from the
66   * previous call to `BulkListInsertionOrderAssignedTargetingOptions` method. If
67   * not specified, the first page of results will be returned.
68   * @return BulkListInsertionOrderAssignedTargetingOptionsResponse
69   */
70  public function bulkListInsertionOrderAssignedTargetingOptions($advertiserId, $insertionOrderId, $optParams = [])
71  {
72    $params = ['advertiserId' => $advertiserId, 'insertionOrderId' => $insertionOrderId];
73    $params = array_merge($params, $optParams);
74    return $this->call('bulkListInsertionOrderAssignedTargetingOptions', [$params], BulkListInsertionOrderAssignedTargetingOptionsResponse::class);
75  }
76  /**
77   * Creates a new insertion order. Returns the newly created insertion order if
78   * successful. (insertionOrders.create)
79   *
80   * @param string $advertiserId Output only. The unique ID of the advertiser the
81   * insertion order belongs to.
82   * @param InsertionOrder $postBody
83   * @param array $optParams Optional parameters.
84   * @return InsertionOrder
85   */
86  public function create($advertiserId, InsertionOrder $postBody, $optParams = [])
87  {
88    $params = ['advertiserId' => $advertiserId, 'postBody' => $postBody];
89    $params = array_merge($params, $optParams);
90    return $this->call('create', [$params], InsertionOrder::class);
91  }
92  /**
93   * Deletes an insertion order. Returns error code `NOT_FOUND` if the insertion
94   * order does not exist. The insertion order should be archived first, i.e. set
95   * entity_status to `ENTITY_STATUS_ARCHIVED`, to be able to delete it.
96   * (insertionOrders.delete)
97   *
98   * @param string $advertiserId The ID of the advertiser this insertion order
99   * belongs to.
100   * @param string $insertionOrderId The ID of the insertion order we need to
101   * delete.
102   * @param array $optParams Optional parameters.
103   * @return DisplayvideoEmpty
104   */
105  public function delete($advertiserId, $insertionOrderId, $optParams = [])
106  {
107    $params = ['advertiserId' => $advertiserId, 'insertionOrderId' => $insertionOrderId];
108    $params = array_merge($params, $optParams);
109    return $this->call('delete', [$params], DisplayvideoEmpty::class);
110  }
111  /**
112   * Gets an insertion order. Returns error code `NOT_FOUND` if the insertion
113   * order does not exist. (insertionOrders.get)
114   *
115   * @param string $advertiserId Required. The ID of the advertiser this insertion
116   * order belongs to.
117   * @param string $insertionOrderId Required. The ID of the insertion order to
118   * fetch.
119   * @param array $optParams Optional parameters.
120   * @return InsertionOrder
121   */
122  public function get($advertiserId, $insertionOrderId, $optParams = [])
123  {
124    $params = ['advertiserId' => $advertiserId, 'insertionOrderId' => $insertionOrderId];
125    $params = array_merge($params, $optParams);
126    return $this->call('get', [$params], InsertionOrder::class);
127  }
128  /**
129   * Lists insertion orders in an advertiser. The order is defined by the order_by
130   * parameter. If a filter by entity_status is not specified, insertion orders
131   * with `ENTITY_STATUS_ARCHIVED` will not be included in the results.
132   * (insertionOrders.listAdvertisersInsertionOrders)
133   *
134   * @param string $advertiserId Required. The ID of the advertiser to list
135   * insertion orders for.
136   * @param array $optParams Optional parameters.
137   *
138   * @opt_param string filter Allows filtering by insertion order properties.
139   * Supported syntax: * Filter expressions are made up of one or more
140   * restrictions. * Restrictions can be combined by `AND` or `OR` logical
141   * operators. A sequence of restrictions implicitly uses `AND`. * A restriction
142   * has the form of `{field} {operator} {value}`. * The operator used on
143   * `budget.budget_segments.date_range.end_date` must be LESS THAN (<). * The
144   * operator used on `updateTime` must be `GREATER THAN OR EQUAL TO (>=)` or
145   * `LESS THAN OR EQUAL TO (<=)`. * The operators used on all other fields must
146   * be `EQUALS (=)`. * Supported fields: - `campaignId` - `displayName` -
147   * `entityStatus` - `budget.budget_segments.date_range.end_date` (input as YYYY-
148   * MM-DD) - `updateTime` (input in ISO 8601 format, or YYYY-MM-DDTHH:MM:SSZ)
149   * Examples: * All insertion orders under a campaign: `campaignId="1234"` * All
150   * `ENTITY_STATUS_ACTIVE` or `ENTITY_STATUS_PAUSED` insertion orders under an
151   * advertiser: `(entityStatus="ENTITY_STATUS_ACTIVE" OR
152   * entityStatus="ENTITY_STATUS_PAUSED")` * All insertion orders whose budget
153   * segments' dates end before March 28, 2019:
154   * `budget.budget_segments.date_range.end_date<"2019-03-28"` * All insertion
155   * orders with an update time less than or equal to `2020-11-04T18:54:47Z
156   * (format of ISO 8601)`: `updateTime<="2020-11-04T18:54:47Z"` * All insertion
157   * orders with an update time greater than or equal to `2020-11-04T18:54:47Z
158   * (format of ISO 8601)`: `updateTime>="2020-11-04T18:54:47Z"` The length of
159   * this field should be no more than 500 characters.
160   * @opt_param string orderBy Field by which to sort the list. Acceptable values
161   * are: * "displayName" (default) * "entityStatus" * "updateTime" The default
162   * sorting order is ascending. To specify descending order for a field, a suffix
163   * "desc" should be added to the field name. Example: `displayName desc`.
164   * @opt_param int pageSize Requested page size. Must be between `1` and `100`.
165   * If unspecified will default to `100`. Returns error code `INVALID_ARGUMENT`
166   * if an invalid value is specified.
167   * @opt_param string pageToken A token identifying a page of results the server
168   * should return. Typically, this is the value of next_page_token returned from
169   * the previous call to `ListInsertionOrders` method. If not specified, the
170   * first page of results will be returned.
171   * @return ListInsertionOrdersResponse
172   */
173  public function listAdvertisersInsertionOrders($advertiserId, $optParams = [])
174  {
175    $params = ['advertiserId' => $advertiserId];
176    $params = array_merge($params, $optParams);
177    return $this->call('list', [$params], ListInsertionOrdersResponse::class);
178  }
179  /**
180   * Updates an existing insertion order. Returns the updated insertion order if
181   * successful. (insertionOrders.patch)
182   *
183   * @param string $advertiserId Output only. The unique ID of the advertiser the
184   * insertion order belongs to.
185   * @param string $insertionOrderId Output only. The unique ID of the insertion
186   * order. Assigned by the system.
187   * @param InsertionOrder $postBody
188   * @param array $optParams Optional parameters.
189   *
190   * @opt_param string updateMask Required. The mask to control which fields to
191   * update.
192   * @return InsertionOrder
193   */
194  public function patch($advertiserId, $insertionOrderId, InsertionOrder $postBody, $optParams = [])
195  {
196    $params = ['advertiserId' => $advertiserId, 'insertionOrderId' => $insertionOrderId, 'postBody' => $postBody];
197    $params = array_merge($params, $optParams);
198    return $this->call('patch', [$params], InsertionOrder::class);
199  }
200}
201
202// Adding a class alias for backwards compatibility with the previous class name.
203class_alias(AdvertisersInsertionOrders::class, 'Google_Service_DisplayVideo_Resource_AdvertisersInsertionOrders');
204