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\BulkEditLineItemAssignedTargetingOptionsRequest; 21use Google\Service\DisplayVideo\BulkEditLineItemAssignedTargetingOptionsResponse; 22use Google\Service\DisplayVideo\BulkListLineItemAssignedTargetingOptionsResponse; 23use Google\Service\DisplayVideo\DisplayvideoEmpty; 24use Google\Service\DisplayVideo\GenerateDefaultLineItemRequest; 25use Google\Service\DisplayVideo\LineItem; 26use Google\Service\DisplayVideo\ListLineItemsResponse; 27 28/** 29 * The "lineItems" collection of methods. 30 * Typical usage is: 31 * <code> 32 * $displayvideoService = new Google\Service\DisplayVideo(...); 33 * $lineItems = $displayvideoService->lineItems; 34 * </code> 35 */ 36class AdvertisersLineItems extends \Google\Service\Resource 37{ 38 /** 39 * Bulk edits targeting options under a single line item. The operation will 40 * delete the assigned targeting options provided in 41 * BulkEditLineItemAssignedTargetingOptionsRequest.delete_requests and then 42 * create the assigned targeting options provided in 43 * BulkEditLineItemAssignedTargetingOptionsRequest.create_requests. Requests to 44 * this endpoint cannot be made concurrently with the following requests 45 * updating the same line item: * BulkEditLineItemAssignedTargetingOptions * 46 * UpdateLineItem * CreateLineItemAssignedTargetingOption * 47 * DeleteLineItemAssignedTargetingOption 48 * (lineItems.bulkEditLineItemAssignedTargetingOptions) 49 * 50 * @param string $advertiserId Required. The ID of the advertiser the line item 51 * belongs to. 52 * @param string $lineItemId Required. The ID of the line item the assigned 53 * targeting option will belong to. 54 * @param BulkEditLineItemAssignedTargetingOptionsRequest $postBody 55 * @param array $optParams Optional parameters. 56 * @return BulkEditLineItemAssignedTargetingOptionsResponse 57 */ 58 public function bulkEditLineItemAssignedTargetingOptions($advertiserId, $lineItemId, BulkEditLineItemAssignedTargetingOptionsRequest $postBody, $optParams = []) 59 { 60 $params = ['advertiserId' => $advertiserId, 'lineItemId' => $lineItemId, 'postBody' => $postBody]; 61 $params = array_merge($params, $optParams); 62 return $this->call('bulkEditLineItemAssignedTargetingOptions', [$params], BulkEditLineItemAssignedTargetingOptionsResponse::class); 63 } 64 /** 65 * Lists assigned targeting options of a line item across targeting types. 66 * (lineItems.bulkListLineItemAssignedTargetingOptions) 67 * 68 * @param string $advertiserId Required. The ID of the advertiser the line item 69 * belongs to. 70 * @param string $lineItemId Required. The ID of the line item to list assigned 71 * targeting options for. 72 * @param array $optParams Optional parameters. 73 * 74 * @opt_param string filter Allows filtering by assigned targeting option 75 * properties. Supported syntax: * Filter expressions are made up of one or more 76 * restrictions. * Restrictions can be combined by the logical operator `OR` on 77 * the same field. * A restriction has the form of `{field} {operator} {value}`. 78 * * The operator must be `EQUALS (=)`. * Supported fields: - `targetingType` - 79 * `inheritance` Examples: * AssignedTargetingOptions of targeting type 80 * TARGETING_TYPE_PROXIMITY_LOCATION_LIST or TARGETING_TYPE_CHANNEL 81 * `targetingType="TARGETING_TYPE_PROXIMITY_LOCATION_LIST" OR 82 * targetingType="TARGETING_TYPE_CHANNEL"` * AssignedTargetingOptions with 83 * inheritance status of NOT_INHERITED or INHERITED_FROM_PARTNER 84 * `inheritance="NOT_INHERITED" OR inheritance="INHERITED_FROM_PARTNER"` The 85 * length of this field should be no more than 500 characters. 86 * @opt_param string orderBy Field by which to sort the list. Acceptable values 87 * are: * `targetingType` (default) The default sorting order is ascending. To 88 * specify descending order for a field, a suffix "desc" should be added to the 89 * field name. Example: `targetingType desc`. 90 * @opt_param int pageSize Requested page size. The size must be an integer 91 * between `1` and `5000`. If unspecified, the default is '5000'. Returns error 92 * code `INVALID_ARGUMENT` if an invalid value is specified. 93 * @opt_param string pageToken A token that lets the client fetch the next page 94 * of results. Typically, this is the value of next_page_token returned from the 95 * previous call to `BulkListLineItemAssignedTargetingOptions` method. If not 96 * specified, the first page of results will be returned. 97 * @return BulkListLineItemAssignedTargetingOptionsResponse 98 */ 99 public function bulkListLineItemAssignedTargetingOptions($advertiserId, $lineItemId, $optParams = []) 100 { 101 $params = ['advertiserId' => $advertiserId, 'lineItemId' => $lineItemId]; 102 $params = array_merge($params, $optParams); 103 return $this->call('bulkListLineItemAssignedTargetingOptions', [$params], BulkListLineItemAssignedTargetingOptionsResponse::class); 104 } 105 /** 106 * Creates a new line item. Returns the newly created line item if successful. 107 * (lineItems.create) 108 * 109 * @param string $advertiserId Output only. The unique ID of the advertiser the 110 * line item belongs to. 111 * @param LineItem $postBody 112 * @param array $optParams Optional parameters. 113 * @return LineItem 114 */ 115 public function create($advertiserId, LineItem $postBody, $optParams = []) 116 { 117 $params = ['advertiserId' => $advertiserId, 'postBody' => $postBody]; 118 $params = array_merge($params, $optParams); 119 return $this->call('create', [$params], LineItem::class); 120 } 121 /** 122 * Deletes a line item. Returns error code `NOT_FOUND` if the line item does not 123 * exist. The line item should be archived first, i.e. set entity_status to 124 * `ENTITY_STATUS_ARCHIVED`, to be able to delete it. (lineItems.delete) 125 * 126 * @param string $advertiserId The ID of the advertiser this line item belongs 127 * to. 128 * @param string $lineItemId The ID of the line item we need to fetch. 129 * @param array $optParams Optional parameters. 130 * @return DisplayvideoEmpty 131 */ 132 public function delete($advertiserId, $lineItemId, $optParams = []) 133 { 134 $params = ['advertiserId' => $advertiserId, 'lineItemId' => $lineItemId]; 135 $params = array_merge($params, $optParams); 136 return $this->call('delete', [$params], DisplayvideoEmpty::class); 137 } 138 /** 139 * Creates a new line item with settings (including targeting) inherited from 140 * the insertion order and an `ENTITY_STATUS_DRAFT` entity_status. Returns the 141 * newly created line item if successful. There are default values based on the 142 * three fields: * The insertion order's insertion_order_type * The insertion 143 * order's automation_type * The given line_item_type 144 * (lineItems.generateDefault) 145 * 146 * @param string $advertiserId Required. The ID of the advertiser this line item 147 * belongs to. 148 * @param GenerateDefaultLineItemRequest $postBody 149 * @param array $optParams Optional parameters. 150 * @return LineItem 151 */ 152 public function generateDefault($advertiserId, GenerateDefaultLineItemRequest $postBody, $optParams = []) 153 { 154 $params = ['advertiserId' => $advertiserId, 'postBody' => $postBody]; 155 $params = array_merge($params, $optParams); 156 return $this->call('generateDefault', [$params], LineItem::class); 157 } 158 /** 159 * Gets a line item. (lineItems.get) 160 * 161 * @param string $advertiserId Required. The ID of the advertiser this line item 162 * belongs to. 163 * @param string $lineItemId Required. The ID of the line item to fetch. 164 * @param array $optParams Optional parameters. 165 * @return LineItem 166 */ 167 public function get($advertiserId, $lineItemId, $optParams = []) 168 { 169 $params = ['advertiserId' => $advertiserId, 'lineItemId' => $lineItemId]; 170 $params = array_merge($params, $optParams); 171 return $this->call('get', [$params], LineItem::class); 172 } 173 /** 174 * Lists line items in an advertiser. The order is defined by the order_by 175 * parameter. If a filter by entity_status is not specified, line items with 176 * `ENTITY_STATUS_ARCHIVED` will not be included in the results. 177 * (lineItems.listAdvertisersLineItems) 178 * 179 * @param string $advertiserId Required. The ID of the advertiser to list line 180 * items for. 181 * @param array $optParams Optional parameters. 182 * 183 * @opt_param string filter Allows filtering by line item properties. Supported 184 * syntax: * Filter expressions are made up of one or more restrictions. * 185 * Restrictions can be combined by `AND` or `OR` logical operators. A sequence 186 * of restrictions implicitly uses `AND`. * A restriction has the form of 187 * `{field} {operator} {value}`. * The operator used on 188 * `flight.dateRange.endDate` must be LESS THAN (<). * The operator used on 189 * `updateTime` must be `GREATER THAN OR EQUAL TO (>=)` or `LESS THAN OR EQUAL 190 * TO (<=)`. * The operator used on `warningMessages` must be `HAS (:)`. * The 191 * operators used on all other fields must be `EQUALS (=)`. * Supported 192 * properties: - `campaignId` - `displayName` - `insertionOrderId` - 193 * `entityStatus` - `lineItemId` - `lineItemType` - `flight.dateRange.endDate` 194 * (input formatted as YYYY-MM-DD) - `warningMessages` - `flight.triggerId` - 195 * `updateTime` (input in ISO 8601 format, or YYYY-MM-DDTHH:MM:SSZ) - 196 * `targetedChannelId` - `targetedNegativeKeywordListId` Examples: * All line 197 * items under an insertion order: `insertionOrderId="1234"` * All 198 * `ENTITY_STATUS_ACTIVE` or `ENTITY_STATUS_PAUSED` and 199 * `LINE_ITEM_TYPE_DISPLAY_DEFAULT` line items under an advertiser: 200 * `(entityStatus="ENTITY_STATUS_ACTIVE" OR entityStatus="ENTITY_STATUS_PAUSED") 201 * AND lineItemType="LINE_ITEM_TYPE_DISPLAY_DEFAULT"` * All line items whose 202 * flight dates end before March 28, 2019: 203 * `flight.dateRange.endDate<"2019-03-28"` * All line items that have 204 * `NO_VALID_CREATIVE` in `warningMessages`: 205 * `warningMessages:"NO_VALID_CREATIVE"` * All line items with an update time 206 * less than or equal to `2020-11-04T18:54:47Z (format of ISO 8601)`: 207 * `updateTime<="2020-11-04T18:54:47Z"` * All line items with an update time 208 * greater than or equal to `2020-11-04T18:54:47Z (format of ISO 8601)`: 209 * `updateTime>="2020-11-04T18:54:47Z"` * All line items that are using both the 210 * specified channel and specified negative keyword list in their targeting: 211 * `targetedNegativeKeywordListId=789 AND targetedChannelId=12345` The length of 212 * this field should be no more than 500 characters. 213 * @opt_param string orderBy Field by which to sort the list. Acceptable values 214 * are: * `displayName` (default) * `entityStatus` * `flight.dateRange.endDate` 215 * * `updateTime` The default sorting order is ascending. To specify descending 216 * order for a field, a suffix "desc" should be added to the field name. 217 * Example: `displayName desc`. 218 * @opt_param int pageSize Requested page size. Must be between `1` and `100`. 219 * If unspecified will default to `100`. Returns error code `INVALID_ARGUMENT` 220 * if an invalid value is specified. 221 * @opt_param string pageToken A token identifying a page of results the server 222 * should return. Typically, this is the value of next_page_token returned from 223 * the previous call to `ListLineItems` method. If not specified, the first page 224 * of results will be returned. 225 * @return ListLineItemsResponse 226 */ 227 public function listAdvertisersLineItems($advertiserId, $optParams = []) 228 { 229 $params = ['advertiserId' => $advertiserId]; 230 $params = array_merge($params, $optParams); 231 return $this->call('list', [$params], ListLineItemsResponse::class); 232 } 233 /** 234 * Updates an existing line item. Returns the updated line item if successful. 235 * Requests to this endpoint cannot be made concurrently with the following 236 * requests updating the same line item: * 237 * BulkEditLineItemAssignedTargetingOptions * UpdateLineItem * 238 * CreateLineItemAssignedTargetingOption * DeleteLineItemAssignedTargetingOption 239 * (lineItems.patch) 240 * 241 * @param string $advertiserId Output only. The unique ID of the advertiser the 242 * line item belongs to. 243 * @param string $lineItemId Output only. The unique ID of the line item. 244 * Assigned by the system. 245 * @param LineItem $postBody 246 * @param array $optParams Optional parameters. 247 * 248 * @opt_param string updateMask Required. The mask to control which fields to 249 * update. 250 * @return LineItem 251 */ 252 public function patch($advertiserId, $lineItemId, LineItem $postBody, $optParams = []) 253 { 254 $params = ['advertiserId' => $advertiserId, 'lineItemId' => $lineItemId, 'postBody' => $postBody]; 255 $params = array_merge($params, $optParams); 256 return $this->call('patch', [$params], LineItem::class); 257 } 258} 259 260// Adding a class alias for backwards compatibility with the previous class name. 261class_alias(AdvertisersLineItems::class, 'Google_Service_DisplayVideo_Resource_AdvertisersLineItems'); 262