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\TargetingTemplate;
21use Google\Service\Dfareporting\TargetingTemplatesListResponse;
22
23/**
24 * The "targetingTemplates" collection of methods.
25 * Typical usage is:
26 *  <code>
27 *   $dfareportingService = new Google\Service\Dfareporting(...);
28 *   $targetingTemplates = $dfareportingService->targetingTemplates;
29 *  </code>
30 */
31class TargetingTemplates extends \Google\Service\Resource
32{
33  /**
34   * Gets one targeting template by ID. (targetingTemplates.get)
35   *
36   * @param string $profileId User profile ID associated with this request.
37   * @param string $id Targeting template ID.
38   * @param array $optParams Optional parameters.
39   * @return TargetingTemplate
40   */
41  public function get($profileId, $id, $optParams = [])
42  {
43    $params = ['profileId' => $profileId, 'id' => $id];
44    $params = array_merge($params, $optParams);
45    return $this->call('get', [$params], TargetingTemplate::class);
46  }
47  /**
48   * Inserts a new targeting template. (targetingTemplates.insert)
49   *
50   * @param string $profileId User profile ID associated with this request.
51   * @param TargetingTemplate $postBody
52   * @param array $optParams Optional parameters.
53   * @return TargetingTemplate
54   */
55  public function insert($profileId, TargetingTemplate $postBody, $optParams = [])
56  {
57    $params = ['profileId' => $profileId, 'postBody' => $postBody];
58    $params = array_merge($params, $optParams);
59    return $this->call('insert', [$params], TargetingTemplate::class);
60  }
61  /**
62   * Retrieves a list of targeting templates, optionally filtered. This method
63   * supports paging. (targetingTemplates.listTargetingTemplates)
64   *
65   * @param string $profileId User profile ID associated with this request.
66   * @param array $optParams Optional parameters.
67   *
68   * @opt_param string advertiserId Select only targeting templates with this
69   * advertiser ID.
70   * @opt_param string ids Select only targeting templates with these IDs.
71   * @opt_param int maxResults Maximum number of results to return.
72   * @opt_param string pageToken Value of the nextPageToken from the previous
73   * result page.
74   * @opt_param string searchString Allows searching for objects by name or ID.
75   * Wildcards (*) are allowed. For example, "template*2015" will return objects
76   * with names like "template June 2015", "template April 2015", or simply
77   * "template 2015". Most of the searches also add wildcards implicitly at the
78   * start and the end of the search string. For example, a search string of
79   * "template" will match objects with name "my template", "template 2015", or
80   * simply "template".
81   * @opt_param string sortField Field by which to sort the list.
82   * @opt_param string sortOrder Order of sorted results.
83   * @return TargetingTemplatesListResponse
84   */
85  public function listTargetingTemplates($profileId, $optParams = [])
86  {
87    $params = ['profileId' => $profileId];
88    $params = array_merge($params, $optParams);
89    return $this->call('list', [$params], TargetingTemplatesListResponse::class);
90  }
91  /**
92   * Updates an existing targeting template. This method supports patch semantics.
93   * (targetingTemplates.patch)
94   *
95   * @param string $profileId User profile ID associated with this request.
96   * @param string $id TargetingTemplate ID.
97   * @param TargetingTemplate $postBody
98   * @param array $optParams Optional parameters.
99   * @return TargetingTemplate
100   */
101  public function patch($profileId, $id, TargetingTemplate $postBody, $optParams = [])
102  {
103    $params = ['profileId' => $profileId, 'id' => $id, 'postBody' => $postBody];
104    $params = array_merge($params, $optParams);
105    return $this->call('patch', [$params], TargetingTemplate::class);
106  }
107  /**
108   * Updates an existing targeting template. (targetingTemplates.update)
109   *
110   * @param string $profileId User profile ID associated with this request.
111   * @param TargetingTemplate $postBody
112   * @param array $optParams Optional parameters.
113   * @return TargetingTemplate
114   */
115  public function update($profileId, TargetingTemplate $postBody, $optParams = [])
116  {
117    $params = ['profileId' => $profileId, 'postBody' => $postBody];
118    $params = array_merge($params, $optParams);
119    return $this->call('update', [$params], TargetingTemplate::class);
120  }
121}
122
123// Adding a class alias for backwards compatibility with the previous class name.
124class_alias(TargetingTemplates::class, 'Google_Service_Dfareporting_Resource_TargetingTemplates');
125