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\Dfareporting\Resource;
19
20use Google\Service\Dfareporting\DynamicTargetingKey;
21use Google\Service\Dfareporting\DynamicTargetingKeysListResponse;
22
23/**
24 * The "dynamicTargetingKeys" collection of methods.
25 * Typical usage is:
26 *  <code>
27 *   $dfareportingService = new Google\Service\Dfareporting(...);
28 *   $dynamicTargetingKeys = $dfareportingService->dynamicTargetingKeys;
29 *  </code>
30 */
31class DynamicTargetingKeys extends \Google\Service\Resource
32{
33  /**
34   * Deletes an existing dynamic targeting key. (dynamicTargetingKeys.delete)
35   *
36   * @param string $profileId User profile ID associated with this request.
37   * @param string $objectId ID of the object of this dynamic targeting key. This
38   * is a required field.
39   * @param string $name Name of this dynamic targeting key. This is a required
40   * field. Must be less than 256 characters long and cannot contain commas. All
41   * characters are converted to lowercase.
42   * @param string $objectType Type of the object of this dynamic targeting key.
43   * This is a required field.
44   * @param array $optParams Optional parameters.
45   */
46  public function delete($profileId, $objectId, $name, $objectType, $optParams = [])
47  {
48    $params = ['profileId' => $profileId, 'objectId' => $objectId, 'name' => $name, 'objectType' => $objectType];
49    $params = array_merge($params, $optParams);
50    return $this->call('delete', [$params]);
51  }
52  /**
53   * Inserts a new dynamic targeting key. Keys must be created at the advertiser
54   * level before being assigned to the advertiser's ads, creatives, or
55   * placements. There is a maximum of 1000 keys per advertiser, out of which a
56   * maximum of 20 keys can be assigned per ad, creative, or placement.
57   * (dynamicTargetingKeys.insert)
58   *
59   * @param string $profileId User profile ID associated with this request.
60   * @param DynamicTargetingKey $postBody
61   * @param array $optParams Optional parameters.
62   * @return DynamicTargetingKey
63   */
64  public function insert($profileId, DynamicTargetingKey $postBody, $optParams = [])
65  {
66    $params = ['profileId' => $profileId, 'postBody' => $postBody];
67    $params = array_merge($params, $optParams);
68    return $this->call('insert', [$params], DynamicTargetingKey::class);
69  }
70  /**
71   * Retrieves a list of dynamic targeting keys.
72   * (dynamicTargetingKeys.listDynamicTargetingKeys)
73   *
74   * @param string $profileId User profile ID associated with this request.
75   * @param array $optParams Optional parameters.
76   *
77   * @opt_param string advertiserId Select only dynamic targeting keys whose
78   * object has this advertiser ID.
79   * @opt_param string names Select only dynamic targeting keys exactly matching
80   * these names.
81   * @opt_param string objectId Select only dynamic targeting keys with this
82   * object ID.
83   * @opt_param string objectType Select only dynamic targeting keys with this
84   * object type.
85   * @return DynamicTargetingKeysListResponse
86   */
87  public function listDynamicTargetingKeys($profileId, $optParams = [])
88  {
89    $params = ['profileId' => $profileId];
90    $params = array_merge($params, $optParams);
91    return $this->call('list', [$params], DynamicTargetingKeysListResponse::class);
92  }
93}
94
95// Adding a class alias for backwards compatibility with the previous class name.
96class_alias(DynamicTargetingKeys::class, 'Google_Service_Dfareporting_Resource_DynamicTargetingKeys');
97