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 |
|
---|
18 | namespace Google\Service\DisplayVideo\Resource;
|
---|
19 |
|
---|
20 | use Google\Service\DisplayVideo\BulkEditAssignedTargetingOptionsRequest;
|
---|
21 | use Google\Service\DisplayVideo\BulkEditAssignedTargetingOptionsResponse;
|
---|
22 | use Google\Service\DisplayVideo\BulkListAssignedTargetingOptionsResponse;
|
---|
23 | use Google\Service\DisplayVideo\BulkUpdateLineItemsRequest;
|
---|
24 | use Google\Service\DisplayVideo\BulkUpdateLineItemsResponse;
|
---|
25 | use Google\Service\DisplayVideo\DisplayvideoEmpty;
|
---|
26 | use Google\Service\DisplayVideo\DuplicateLineItemRequest;
|
---|
27 | use Google\Service\DisplayVideo\DuplicateLineItemResponse;
|
---|
28 | use Google\Service\DisplayVideo\GenerateDefaultLineItemRequest;
|
---|
29 | use Google\Service\DisplayVideo\LineItem;
|
---|
30 | use Google\Service\DisplayVideo\ListLineItemsResponse;
|
---|
31 |
|
---|
32 | /**
|
---|
33 | * The "lineItems" collection of methods.
|
---|
34 | * Typical usage is:
|
---|
35 | * <code>
|
---|
36 | * $displayvideoService = new Google\Service\DisplayVideo(...);
|
---|
37 | * $lineItems = $displayvideoService->advertisers_lineItems;
|
---|
38 | * </code>
|
---|
39 | */
|
---|
40 | class AdvertisersLineItems extends \Google\Service\Resource
|
---|
41 | {
|
---|
42 | /**
|
---|
43 | * Bulk edits targeting options under multiple line items. The operation will
|
---|
44 | * delete the assigned targeting options provided in
|
---|
45 | * BulkEditAssignedTargetingOptionsRequest.delete_requests and then create the
|
---|
46 | * assigned targeting options provided in
|
---|
47 | * BulkEditAssignedTargetingOptionsRequest.create_requests. Requests to this
|
---|
48 | * endpoint cannot be made concurrently with the following requests updating the
|
---|
49 | * same line item: * lineItems.bulkUpdate * lineItems.patch *
|
---|
50 | * assignedTargetingOptions.create * assignedTargetingOptions.delete YouTube &
|
---|
51 | * Partners line items cannot be created or updated using the API.
|
---|
52 | * (lineItems.bulkEditAssignedTargetingOptions)
|
---|
53 | *
|
---|
54 | * @param string $advertiserId Required. The ID of the advertiser the line items
|
---|
55 | * belong to.
|
---|
56 | * @param BulkEditAssignedTargetingOptionsRequest $postBody
|
---|
57 | * @param array $optParams Optional parameters.
|
---|
58 | * @return BulkEditAssignedTargetingOptionsResponse
|
---|
59 | * @throws \Google\Service\Exception
|
---|
60 | */
|
---|
61 | public function bulkEditAssignedTargetingOptions($advertiserId, BulkEditAssignedTargetingOptionsRequest $postBody, $optParams = [])
|
---|
62 | {
|
---|
63 | $params = ['advertiserId' => $advertiserId, 'postBody' => $postBody];
|
---|
64 | $params = array_merge($params, $optParams);
|
---|
65 | return $this->call('bulkEditAssignedTargetingOptions', [$params], BulkEditAssignedTargetingOptionsResponse::class);
|
---|
66 | }
|
---|
67 | /**
|
---|
68 | * Lists assigned targeting options for multiple line items across targeting
|
---|
69 | * types. (lineItems.bulkListAssignedTargetingOptions)
|
---|
70 | *
|
---|
71 | * @param string $advertiserId Required. The ID of the advertiser the line items
|
---|
72 | * belongs to.
|
---|
73 | * @param array $optParams Optional parameters.
|
---|
74 | *
|
---|
75 | * @opt_param string filter Allows filtering by assigned targeting option
|
---|
76 | * fields. Supported syntax: * Filter expressions are made up of one or more
|
---|
77 | * restrictions. * Restrictions can be combined by the logical operator `OR` on
|
---|
78 | * the same field. * A restriction has the form of `{field} {operator} {value}`.
|
---|
79 | * * All fields must use the `EQUALS (=)` operator. Supported fields: *
|
---|
80 | * `targetingType` * `inheritance` Examples: * `AssignedTargetingOption`
|
---|
81 | * resources of targeting type `TARGETING_TYPE_PROXIMITY_LOCATION_LIST` or
|
---|
82 | * `TARGETING_TYPE_CHANNEL`:
|
---|
83 | * `targetingType="TARGETING_TYPE_PROXIMITY_LOCATION_LIST" OR
|
---|
84 | * targetingType="TARGETING_TYPE_CHANNEL"` * `AssignedTargetingOption` resources
|
---|
85 | * with inheritance status of `NOT_INHERITED` or `INHERITED_FROM_PARTNER`:
|
---|
86 | * `inheritance="NOT_INHERITED" OR inheritance="INHERITED_FROM_PARTNER"` The
|
---|
87 | * length of this field should be no more than 500 characters. Reference our
|
---|
88 | * [filter `LIST` requests](/display-video/api/guides/how-tos/filters) guide for
|
---|
89 | * more information.
|
---|
90 | * @opt_param string lineItemIds Required. The IDs of the line items to list
|
---|
91 | * assigned targeting options for.
|
---|
92 | * @opt_param string orderBy Field by which to sort the list. Acceptable values
|
---|
93 | * are: * `lineItemId` (default) * `assignedTargetingOption.targetingType` The
|
---|
94 | * default sorting order is ascending. To specify descending order for a field,
|
---|
95 | * a suffix "desc" should be added to the field name. Example: `targetingType
|
---|
96 | * desc`.
|
---|
97 | * @opt_param int pageSize Requested page size. The size must be an integer
|
---|
98 | * between `1` and `5000`. If unspecified, the default is `5000`. Returns error
|
---|
99 | * code `INVALID_ARGUMENT` if an invalid value is specified.
|
---|
100 | * @opt_param string pageToken A token that lets the client fetch the next page
|
---|
101 | * of results. Typically, this is the value of next_page_token returned from the
|
---|
102 | * previous call to the `BulkListAssignedTargetingOptions` method. If not
|
---|
103 | * specified, the first page of results will be returned.
|
---|
104 | * @return BulkListAssignedTargetingOptionsResponse
|
---|
105 | * @throws \Google\Service\Exception
|
---|
106 | */
|
---|
107 | public function bulkListAssignedTargetingOptions($advertiserId, $optParams = [])
|
---|
108 | {
|
---|
109 | $params = ['advertiserId' => $advertiserId];
|
---|
110 | $params = array_merge($params, $optParams);
|
---|
111 | return $this->call('bulkListAssignedTargetingOptions', [$params], BulkListAssignedTargetingOptionsResponse::class);
|
---|
112 | }
|
---|
113 | /**
|
---|
114 | * Updates multiple line items. Requests to this endpoint cannot be made
|
---|
115 | * concurrently with the following requests updating the same line item: *
|
---|
116 | * BulkEditAssignedTargetingOptions * UpdateLineItem *
|
---|
117 | * assignedTargetingOptions.create * assignedTargetingOptions.delete YouTube &
|
---|
118 | * Partners line items cannot be created or updated using the API.
|
---|
119 | * (lineItems.bulkUpdate)
|
---|
120 | *
|
---|
121 | * @param string $advertiserId Required. The ID of the advertiser this line item
|
---|
122 | * belongs to.
|
---|
123 | * @param BulkUpdateLineItemsRequest $postBody
|
---|
124 | * @param array $optParams Optional parameters.
|
---|
125 | * @return BulkUpdateLineItemsResponse
|
---|
126 | * @throws \Google\Service\Exception
|
---|
127 | */
|
---|
128 | public function bulkUpdate($advertiserId, BulkUpdateLineItemsRequest $postBody, $optParams = [])
|
---|
129 | {
|
---|
130 | $params = ['advertiserId' => $advertiserId, 'postBody' => $postBody];
|
---|
131 | $params = array_merge($params, $optParams);
|
---|
132 | return $this->call('bulkUpdate', [$params], BulkUpdateLineItemsResponse::class);
|
---|
133 | }
|
---|
134 | /**
|
---|
135 | * Creates a new line item. Returns the newly created line item if successful.
|
---|
136 | * YouTube & Partners line items cannot be created or updated using the API.
|
---|
137 | * (lineItems.create)
|
---|
138 | *
|
---|
139 | * @param string $advertiserId Output only. The unique ID of the advertiser the
|
---|
140 | * line item belongs to.
|
---|
141 | * @param LineItem $postBody
|
---|
142 | * @param array $optParams Optional parameters.
|
---|
143 | * @return LineItem
|
---|
144 | * @throws \Google\Service\Exception
|
---|
145 | */
|
---|
146 | public function create($advertiserId, LineItem $postBody, $optParams = [])
|
---|
147 | {
|
---|
148 | $params = ['advertiserId' => $advertiserId, 'postBody' => $postBody];
|
---|
149 | $params = array_merge($params, $optParams);
|
---|
150 | return $this->call('create', [$params], LineItem::class);
|
---|
151 | }
|
---|
152 | /**
|
---|
153 | * Deletes a line item. Returns error code `NOT_FOUND` if the line item does not
|
---|
154 | * exist. The line item should be archived first, i.e. set entity_status to
|
---|
155 | * `ENTITY_STATUS_ARCHIVED`, to be able to delete it. YouTube & Partners line
|
---|
156 | * items cannot be created or updated using the API. (lineItems.delete)
|
---|
157 | *
|
---|
158 | * @param string $advertiserId The ID of the advertiser this line item belongs
|
---|
159 | * to.
|
---|
160 | * @param string $lineItemId The ID of the line item to delete.
|
---|
161 | * @param array $optParams Optional parameters.
|
---|
162 | * @return DisplayvideoEmpty
|
---|
163 | * @throws \Google\Service\Exception
|
---|
164 | */
|
---|
165 | public function delete($advertiserId, $lineItemId, $optParams = [])
|
---|
166 | {
|
---|
167 | $params = ['advertiserId' => $advertiserId, 'lineItemId' => $lineItemId];
|
---|
168 | $params = array_merge($params, $optParams);
|
---|
169 | return $this->call('delete', [$params], DisplayvideoEmpty::class);
|
---|
170 | }
|
---|
171 | /**
|
---|
172 | * Duplicates a line item. Returns the ID of the created line item if
|
---|
173 | * successful. YouTube & Partners line items cannot be created or updated using
|
---|
174 | * the API. **This method regularly experiences high latency.** We recommend
|
---|
175 | * [increasing your default timeout](/display-video/api/guides/best-
|
---|
176 | * practices/timeouts#client_library_timeout) to avoid errors.
|
---|
177 | * (lineItems.duplicate)
|
---|
178 | *
|
---|
179 | * @param string $advertiserId Required. The ID of the advertiser this line item
|
---|
180 | * belongs to.
|
---|
181 | * @param string $lineItemId Required. The ID of the line item to duplicate.
|
---|
182 | * @param DuplicateLineItemRequest $postBody
|
---|
183 | * @param array $optParams Optional parameters.
|
---|
184 | * @return DuplicateLineItemResponse
|
---|
185 | * @throws \Google\Service\Exception
|
---|
186 | */
|
---|
187 | public function duplicate($advertiserId, $lineItemId, DuplicateLineItemRequest $postBody, $optParams = [])
|
---|
188 | {
|
---|
189 | $params = ['advertiserId' => $advertiserId, 'lineItemId' => $lineItemId, 'postBody' => $postBody];
|
---|
190 | $params = array_merge($params, $optParams);
|
---|
191 | return $this->call('duplicate', [$params], DuplicateLineItemResponse::class);
|
---|
192 | }
|
---|
193 | /**
|
---|
194 | * Creates a new line item with settings (including targeting) inherited from
|
---|
195 | * the insertion order and an `ENTITY_STATUS_DRAFT` entity_status. Returns the
|
---|
196 | * newly created line item if successful. There are default values based on the
|
---|
197 | * three fields: * The insertion order's insertion_order_type * The insertion
|
---|
198 | * order's automation_type * The given line_item_type YouTube & Partners line
|
---|
199 | * items cannot be created or updated using the API. (lineItems.generateDefault)
|
---|
200 | *
|
---|
201 | * @param string $advertiserId Required. The ID of the advertiser this line item
|
---|
202 | * belongs to.
|
---|
203 | * @param GenerateDefaultLineItemRequest $postBody
|
---|
204 | * @param array $optParams Optional parameters.
|
---|
205 | * @return LineItem
|
---|
206 | * @throws \Google\Service\Exception
|
---|
207 | */
|
---|
208 | public function generateDefault($advertiserId, GenerateDefaultLineItemRequest $postBody, $optParams = [])
|
---|
209 | {
|
---|
210 | $params = ['advertiserId' => $advertiserId, 'postBody' => $postBody];
|
---|
211 | $params = array_merge($params, $optParams);
|
---|
212 | return $this->call('generateDefault', [$params], LineItem::class);
|
---|
213 | }
|
---|
214 | /**
|
---|
215 | * Gets a line item. (lineItems.get)
|
---|
216 | *
|
---|
217 | * @param string $advertiserId Required. The ID of the advertiser this line item
|
---|
218 | * belongs to.
|
---|
219 | * @param string $lineItemId Required. The ID of the line item to fetch.
|
---|
220 | * @param array $optParams Optional parameters.
|
---|
221 | * @return LineItem
|
---|
222 | * @throws \Google\Service\Exception
|
---|
223 | */
|
---|
224 | public function get($advertiserId, $lineItemId, $optParams = [])
|
---|
225 | {
|
---|
226 | $params = ['advertiserId' => $advertiserId, 'lineItemId' => $lineItemId];
|
---|
227 | $params = array_merge($params, $optParams);
|
---|
228 | return $this->call('get', [$params], LineItem::class);
|
---|
229 | }
|
---|
230 | /**
|
---|
231 | * Lists line items in an advertiser. The order is defined by the order_by
|
---|
232 | * parameter. If a filter by entity_status is not specified, line items with
|
---|
233 | * `ENTITY_STATUS_ARCHIVED` will not be included in the results.
|
---|
234 | * (lineItems.listAdvertisersLineItems)
|
---|
235 | *
|
---|
236 | * @param string $advertiserId Required. The ID of the advertiser to list line
|
---|
237 | * items for.
|
---|
238 | * @param array $optParams Optional parameters.
|
---|
239 | *
|
---|
240 | * @opt_param string filter Allows filtering by line item fields. Supported
|
---|
241 | * syntax: * Filter expressions are made up of one or more restrictions. *
|
---|
242 | * Restrictions can be combined by `AND` or `OR` logical operators. A sequence
|
---|
243 | * of restrictions implicitly uses `AND`. * A restriction has the form of
|
---|
244 | * `{field} {operator} {value}`. * The `updateTime` field must use the `GREATER
|
---|
245 | * THAN OR EQUAL TO (>=)` or `LESS THAN OR EQUAL TO (<=)` operators. * All other
|
---|
246 | * fields must use the `EQUALS (=)` operator. Supported fields: * `campaignId` *
|
---|
247 | * `displayName` * `entityStatus` * `insertionOrderId` * `lineItemId` *
|
---|
248 | * `lineItemType` * `updateTime` (input in ISO 8601 format, or `YYYY-MM-
|
---|
249 | * DDTHH:MM:SSZ`) Examples: * All line items under an insertion order:
|
---|
250 | * `insertionOrderId="1234"` * All `ENTITY_STATUS_ACTIVE` or
|
---|
251 | * `ENTITY_STATUS_PAUSED` and `LINE_ITEM_TYPE_DISPLAY_DEFAULT` line items under
|
---|
252 | * an advertiser: `(entityStatus="ENTITY_STATUS_ACTIVE" OR
|
---|
253 | * entityStatus="ENTITY_STATUS_PAUSED") AND
|
---|
254 | * lineItemType="LINE_ITEM_TYPE_DISPLAY_DEFAULT"` * All line items with an
|
---|
255 | * update time less than or equal to 2020-11-04T18:54:47Z (format of ISO 8601):
|
---|
256 | * `updateTime<="2020-11-04T18:54:47Z"` * All line items with an update time
|
---|
257 | * greater than or equal to 2020-11-04T18:54:47Z (format of ISO 8601):
|
---|
258 | * `updateTime>="2020-11-04T18:54:47Z"` The length of this field should be no
|
---|
259 | * more than 500 characters. Reference our [filter `LIST` requests](/display-
|
---|
260 | * video/api/guides/how-tos/filters) guide for more information.
|
---|
261 | * @opt_param string orderBy Field by which to sort the list. Acceptable values
|
---|
262 | * are: * `displayName` (default) * `entityStatus` * `updateTime` The default
|
---|
263 | * sorting order is ascending. To specify descending order for a field, a suffix
|
---|
264 | * "desc" should be added to the field name. Example: `displayName desc`.
|
---|
265 | * @opt_param int pageSize Requested page size. Must be between `1` and `200`.
|
---|
266 | * If unspecified will default to `100`. Returns error code `INVALID_ARGUMENT`
|
---|
267 | * if an invalid value is specified.
|
---|
268 | * @opt_param string pageToken A token identifying a page of results the server
|
---|
269 | * should return. Typically, this is the value of next_page_token returned from
|
---|
270 | * the previous call to `ListLineItems` method. If not specified, the first page
|
---|
271 | * of results will be returned.
|
---|
272 | * @return ListLineItemsResponse
|
---|
273 | * @throws \Google\Service\Exception
|
---|
274 | */
|
---|
275 | public function listAdvertisersLineItems($advertiserId, $optParams = [])
|
---|
276 | {
|
---|
277 | $params = ['advertiserId' => $advertiserId];
|
---|
278 | $params = array_merge($params, $optParams);
|
---|
279 | return $this->call('list', [$params], ListLineItemsResponse::class);
|
---|
280 | }
|
---|
281 | /**
|
---|
282 | * Updates an existing line item. Returns the updated line item if successful.
|
---|
283 | * Requests to this endpoint cannot be made concurrently with the following
|
---|
284 | * requests updating the same line item: * BulkEditAssignedTargetingOptions *
|
---|
285 | * BulkUpdateLineItems * assignedTargetingOptions.create *
|
---|
286 | * assignedTargetingOptions.delete YouTube & Partners line items cannot be
|
---|
287 | * created or updated using the API. **This method regularly experiences high
|
---|
288 | * latency.** We recommend [increasing your default timeout](/display-
|
---|
289 | * video/api/guides/best-practices/timeouts#client_library_timeout) to avoid
|
---|
290 | * errors. (lineItems.patch)
|
---|
291 | *
|
---|
292 | * @param string $advertiserId Output only. The unique ID of the advertiser the
|
---|
293 | * line item belongs to.
|
---|
294 | * @param string $lineItemId Output only. The unique ID of the line item.
|
---|
295 | * Assigned by the system.
|
---|
296 | * @param LineItem $postBody
|
---|
297 | * @param array $optParams Optional parameters.
|
---|
298 | *
|
---|
299 | * @opt_param string updateMask Required. The mask to control which fields to
|
---|
300 | * update.
|
---|
301 | * @return LineItem
|
---|
302 | * @throws \Google\Service\Exception
|
---|
303 | */
|
---|
304 | public function patch($advertiserId, $lineItemId, LineItem $postBody, $optParams = [])
|
---|
305 | {
|
---|
306 | $params = ['advertiserId' => $advertiserId, 'lineItemId' => $lineItemId, 'postBody' => $postBody];
|
---|
307 | $params = array_merge($params, $optParams);
|
---|
308 | return $this->call('patch', [$params], LineItem::class);
|
---|
309 | }
|
---|
310 | }
|
---|
311 |
|
---|
312 | // Adding a class alias for backwards compatibility with the previous class name.
|
---|
313 | class_alias(AdvertisersLineItems::class, 'Google_Service_DisplayVideo_Resource_AdvertisersLineItems');
|
---|