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\Ad;
21use Google\Service\Dfareporting\AdsListResponse;
22
23/**
24 * The "ads" collection of methods.
25 * Typical usage is:
26 *  <code>
27 *   $dfareportingService = new Google\Service\Dfareporting(...);
28 *   $ads = $dfareportingService->ads;
29 *  </code>
30 */
31class Ads extends \Google\Service\Resource
32{
33  /**
34   * Gets one ad by ID. (ads.get)
35   *
36   * @param string $profileId User profile ID associated with this request.
37   * @param string $id Ad ID.
38   * @param array $optParams Optional parameters.
39   * @return Ad
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], Ad::class);
46  }
47  /**
48   * Inserts a new ad. (ads.insert)
49   *
50   * @param string $profileId User profile ID associated with this request.
51   * @param Ad $postBody
52   * @param array $optParams Optional parameters.
53   * @return Ad
54   */
55  public function insert($profileId, Ad $postBody, $optParams = [])
56  {
57    $params = ['profileId' => $profileId, 'postBody' => $postBody];
58    $params = array_merge($params, $optParams);
59    return $this->call('insert', [$params], Ad::class);
60  }
61  /**
62   * Retrieves a list of ads, possibly filtered. This method supports paging.
63   * (ads.listAds)
64   *
65   * @param string $profileId User profile ID associated with this request.
66   * @param array $optParams Optional parameters.
67   *
68   * @opt_param bool active Select only active ads.
69   * @opt_param string advertiserId Select only ads with this advertiser ID.
70   * @opt_param bool archived Select only archived ads.
71   * @opt_param string audienceSegmentIds Select only ads with these audience
72   * segment IDs.
73   * @opt_param string campaignIds Select only ads with these campaign IDs.
74   * @opt_param string compatibility Select default ads with the specified
75   * compatibility. Applicable when type is AD_SERVING_DEFAULT_AD. DISPLAY and
76   * DISPLAY_INTERSTITIAL refer to rendering either on desktop or on mobile
77   * devices for regular or interstitial ads, respectively. APP and
78   * APP_INTERSTITIAL are for rendering in mobile apps. IN_STREAM_VIDEO refers to
79   * rendering an in-stream video ads developed with the VAST standard.
80   * @opt_param string creativeIds Select only ads with these creative IDs
81   * assigned.
82   * @opt_param string creativeOptimizationConfigurationIds Select only ads with
83   * these creative optimization configuration IDs.
84   * @opt_param bool dynamicClickTracker Select only dynamic click trackers.
85   * Applicable when type is AD_SERVING_CLICK_TRACKER. If true, select dynamic
86   * click trackers. If false, select static click trackers. Leave unset to select
87   * both.
88   * @opt_param string ids Select only ads with these IDs.
89   * @opt_param string landingPageIds Select only ads with these landing page IDs.
90   * @opt_param int maxResults Maximum number of results to return.
91   * @opt_param string overriddenEventTagId Select only ads with this event tag
92   * override ID.
93   * @opt_param string pageToken Value of the nextPageToken from the previous
94   * result page.
95   * @opt_param string placementIds Select only ads with these placement IDs
96   * assigned.
97   * @opt_param string remarketingListIds Select only ads whose list targeting
98   * expression use these remarketing list IDs.
99   * @opt_param string searchString Allows searching for objects by name or ID.
100   * Wildcards (*) are allowed. For example, "ad*2015" will return objects with
101   * names like "ad June 2015", "ad April 2015", or simply "ad 2015". Most of the
102   * searches also add wildcards implicitly at the start and the end of the search
103   * string. For example, a search string of "ad" will match objects with name "my
104   * ad", "ad 2015", or simply "ad".
105   * @opt_param string sizeIds Select only ads with these size IDs.
106   * @opt_param string sortField Field by which to sort the list.
107   * @opt_param string sortOrder Order of sorted results.
108   * @opt_param bool sslCompliant Select only ads that are SSL-compliant.
109   * @opt_param bool sslRequired Select only ads that require SSL.
110   * @opt_param string type Select only ads with these types.
111   * @return AdsListResponse
112   */
113  public function listAds($profileId, $optParams = [])
114  {
115    $params = ['profileId' => $profileId];
116    $params = array_merge($params, $optParams);
117    return $this->call('list', [$params], AdsListResponse::class);
118  }
119  /**
120   * Updates an existing ad. This method supports patch semantics. (ads.patch)
121   *
122   * @param string $profileId User profile ID associated with this request.
123   * @param string $id Ad ID.
124   * @param Ad $postBody
125   * @param array $optParams Optional parameters.
126   * @return Ad
127   */
128  public function patch($profileId, $id, Ad $postBody, $optParams = [])
129  {
130    $params = ['profileId' => $profileId, 'id' => $id, 'postBody' => $postBody];
131    $params = array_merge($params, $optParams);
132    return $this->call('patch', [$params], Ad::class);
133  }
134  /**
135   * Updates an existing ad. (ads.update)
136   *
137   * @param string $profileId User profile ID associated with this request.
138   * @param Ad $postBody
139   * @param array $optParams Optional parameters.
140   * @return Ad
141   */
142  public function update($profileId, Ad $postBody, $optParams = [])
143  {
144    $params = ['profileId' => $profileId, 'postBody' => $postBody];
145    $params = array_merge($params, $optParams);
146    return $this->call('update', [$params], Ad::class);
147  }
148}
149
150// Adding a class alias for backwards compatibility with the previous class name.
151class_alias(Ads::class, 'Google_Service_Dfareporting_Resource_Ads');
152