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\AssignedTargetingOption;
21use Google\Service\DisplayVideo\DisplayvideoEmpty;
22use Google\Service\DisplayVideo\ListLineItemAssignedTargetingOptionsResponse;
23
24/**
25 * The "assignedTargetingOptions" collection of methods.
26 * Typical usage is:
27 *  <code>
28 *   $displayvideoService = new Google\Service\DisplayVideo(...);
29 *   $assignedTargetingOptions = $displayvideoService->assignedTargetingOptions;
30 *  </code>
31 */
32class AdvertisersLineItemsTargetingTypesAssignedTargetingOptions extends \Google\Service\Resource
33{
34  /**
35   * Assigns a targeting option to a line item. Returns the assigned targeting
36   * option if successful. Requests to this endpoint cannot be made concurrently
37   * with the following requests updating the same line item: *
38   * BulkEditLineItemAssignedTargetingOptions * UpdateLineItem *
39   * CreateLineItemAssignedTargetingOption * DeleteLineItemAssignedTargetingOption
40   * (assignedTargetingOptions.create)
41   *
42   * @param string $advertiserId Required. The ID of the advertiser the line item
43   * belongs to.
44   * @param string $lineItemId Required. The ID of the line item the assigned
45   * targeting option will belong to.
46   * @param string $targetingType Required. Identifies the type of this assigned
47   * targeting option.
48   * @param AssignedTargetingOption $postBody
49   * @param array $optParams Optional parameters.
50   * @return AssignedTargetingOption
51   */
52  public function create($advertiserId, $lineItemId, $targetingType, AssignedTargetingOption $postBody, $optParams = [])
53  {
54    $params = ['advertiserId' => $advertiserId, 'lineItemId' => $lineItemId, 'targetingType' => $targetingType, 'postBody' => $postBody];
55    $params = array_merge($params, $optParams);
56    return $this->call('create', [$params], AssignedTargetingOption::class);
57  }
58  /**
59   * Deletes an assigned targeting option from a line item. Requests to this
60   * endpoint cannot be made concurrently with the following requests updating the
61   * same line item: * BulkEditLineItemAssignedTargetingOptions * UpdateLineItem *
62   * CreateLineItemAssignedTargetingOption * DeleteLineItemAssignedTargetingOption
63   * (assignedTargetingOptions.delete)
64   *
65   * @param string $advertiserId Required. The ID of the advertiser the line item
66   * belongs to.
67   * @param string $lineItemId Required. The ID of the line item the assigned
68   * targeting option belongs to.
69   * @param string $targetingType Required. Identifies the type of this assigned
70   * targeting option.
71   * @param string $assignedTargetingOptionId Required. The ID of the assigned
72   * targeting option to delete.
73   * @param array $optParams Optional parameters.
74   * @return DisplayvideoEmpty
75   */
76  public function delete($advertiserId, $lineItemId, $targetingType, $assignedTargetingOptionId, $optParams = [])
77  {
78    $params = ['advertiserId' => $advertiserId, 'lineItemId' => $lineItemId, 'targetingType' => $targetingType, 'assignedTargetingOptionId' => $assignedTargetingOptionId];
79    $params = array_merge($params, $optParams);
80    return $this->call('delete', [$params], DisplayvideoEmpty::class);
81  }
82  /**
83   * Gets a single targeting option assigned to a line item.
84   * (assignedTargetingOptions.get)
85   *
86   * @param string $advertiserId Required. The ID of the advertiser the line item
87   * belongs to.
88   * @param string $lineItemId Required. The ID of the line item the assigned
89   * targeting option belongs to.
90   * @param string $targetingType Required. Identifies the type of this assigned
91   * targeting option.
92   * @param string $assignedTargetingOptionId Required. An identifier unique to
93   * the targeting type in this line item that identifies the assigned targeting
94   * option being requested.
95   * @param array $optParams Optional parameters.
96   * @return AssignedTargetingOption
97   */
98  public function get($advertiserId, $lineItemId, $targetingType, $assignedTargetingOptionId, $optParams = [])
99  {
100    $params = ['advertiserId' => $advertiserId, 'lineItemId' => $lineItemId, 'targetingType' => $targetingType, 'assignedTargetingOptionId' => $assignedTargetingOptionId];
101    $params = array_merge($params, $optParams);
102    return $this->call('get', [$params], AssignedTargetingOption::class);
103  }
104  /**
105   * Lists the targeting options assigned to a line item. (assignedTargetingOption
106   * s.listAdvertisersLineItemsTargetingTypesAssignedTargetingOptions)
107   *
108   * @param string $advertiserId Required. The ID of the advertiser the line item
109   * belongs to.
110   * @param string $lineItemId Required. The ID of the line item to list assigned
111   * targeting options for.
112   * @param string $targetingType Required. Identifies the type of assigned
113   * targeting options to list.
114   * @param array $optParams Optional parameters.
115   *
116   * @opt_param string filter Allows filtering by assigned targeting option
117   * properties. Supported syntax: * Filter expressions are made up of one or more
118   * restrictions. * Restrictions can be combined by the logical operator `OR`. *
119   * A restriction has the form of `{field} {operator} {value}`. * The operator
120   * must be `EQUALS (=)`. * Supported fields: - `assignedTargetingOptionId` -
121   * `inheritance` Examples: * AssignedTargetingOptions with ID 1 or 2
122   * `assignedTargetingOptionId="1" OR assignedTargetingOptionId="2"` *
123   * AssignedTargetingOptions with inheritance status of NOT_INHERITED or
124   * INHERITED_FROM_PARTNER `inheritance="NOT_INHERITED" OR
125   * inheritance="INHERITED_FROM_PARTNER"` The length of this field should be no
126   * more than 500 characters.
127   * @opt_param string orderBy Field by which to sort the list. Acceptable values
128   * are: * `assignedTargetingOptionId` (default) The default sorting order is
129   * ascending. To specify descending order for a field, a suffix "desc" should be
130   * added to the field name. Example: `assignedTargetingOptionId desc`.
131   * @opt_param int pageSize Requested page size. Must be between `1` and `5000`.
132   * If unspecified will default to `100`. Returns error code `INVALID_ARGUMENT`
133   * if an invalid value is specified.
134   * @opt_param string pageToken A token identifying a page of results the server
135   * should return. Typically, this is the value of next_page_token returned from
136   * the previous call to `ListLineItemAssignedTargetingOptions` method. If not
137   * specified, the first page of results will be returned.
138   * @return ListLineItemAssignedTargetingOptionsResponse
139   */
140  public function listAdvertisersLineItemsTargetingTypesAssignedTargetingOptions($advertiserId, $lineItemId, $targetingType, $optParams = [])
141  {
142    $params = ['advertiserId' => $advertiserId, 'lineItemId' => $lineItemId, 'targetingType' => $targetingType];
143    $params = array_merge($params, $optParams);
144    return $this->call('list', [$params], ListLineItemAssignedTargetingOptionsResponse::class);
145  }
146}
147
148// Adding a class alias for backwards compatibility with the previous class name.
149class_alias(AdvertisersLineItemsTargetingTypesAssignedTargetingOptions::class, 'Google_Service_DisplayVideo_Resource_AdvertisersLineItemsTargetingTypesAssignedTargetingOptions');
150