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\Creative;
21use Google\Service\Dfareporting\CreativesListResponse;
22
23/**
24 * The "creatives" collection of methods.
25 * Typical usage is:
26 *  <code>
27 *   $dfareportingService = new Google\Service\Dfareporting(...);
28 *   $creatives = $dfareportingService->creatives;
29 *  </code>
30 */
31class Creatives extends \Google\Service\Resource
32{
33  /**
34   * Gets one creative by ID. (creatives.get)
35   *
36   * @param string $profileId User profile ID associated with this request.
37   * @param string $id Creative ID.
38   * @param array $optParams Optional parameters.
39   * @return Creative
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], Creative::class);
46  }
47  /**
48   * Inserts a new creative. (creatives.insert)
49   *
50   * @param string $profileId User profile ID associated with this request.
51   * @param Creative $postBody
52   * @param array $optParams Optional parameters.
53   * @return Creative
54   */
55  public function insert($profileId, Creative $postBody, $optParams = [])
56  {
57    $params = ['profileId' => $profileId, 'postBody' => $postBody];
58    $params = array_merge($params, $optParams);
59    return $this->call('insert', [$params], Creative::class);
60  }
61  /**
62   * Retrieves a list of creatives, possibly filtered. This method supports
63   * paging. (creatives.listCreatives)
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 creatives. Leave blank to select
69   * active and inactive creatives.
70   * @opt_param string advertiserId Select only creatives with this advertiser ID.
71   * @opt_param bool archived Select only archived creatives. Leave blank to
72   * select archived and unarchived creatives.
73   * @opt_param string campaignId Select only creatives with this campaign ID.
74   * @opt_param string companionCreativeIds Select only in-stream video creatives
75   * with these companion IDs.
76   * @opt_param string creativeFieldIds Select only creatives with these creative
77   * field IDs.
78   * @opt_param string ids Select only creatives with these IDs.
79   * @opt_param int maxResults Maximum number of results to return.
80   * @opt_param string pageToken Value of the nextPageToken from the previous
81   * result page.
82   * @opt_param string renderingIds Select only creatives with these rendering
83   * IDs.
84   * @opt_param string searchString Allows searching for objects by name or ID.
85   * Wildcards (*) are allowed. For example, "creative*2015" will return objects
86   * with names like "creative June 2015", "creative April 2015", or simply
87   * "creative 2015". Most of the searches also add wildcards implicitly at the
88   * start and the end of the search string. For example, a search string of
89   * "creative" will match objects with name "my creative", "creative 2015", or
90   * simply "creative".
91   * @opt_param string sizeIds Select only creatives with these size IDs.
92   * @opt_param string sortField Field by which to sort the list.
93   * @opt_param string sortOrder Order of sorted results.
94   * @opt_param string studioCreativeId Select only creatives corresponding to
95   * this Studio creative ID.
96   * @opt_param string types Select only creatives with these creative types.
97   * @return CreativesListResponse
98   */
99  public function listCreatives($profileId, $optParams = [])
100  {
101    $params = ['profileId' => $profileId];
102    $params = array_merge($params, $optParams);
103    return $this->call('list', [$params], CreativesListResponse::class);
104  }
105  /**
106   * Updates an existing creative. This method supports patch semantics.
107   * (creatives.patch)
108   *
109   * @param string $profileId User profile ID associated with this request.
110   * @param string $id Creative ID.
111   * @param Creative $postBody
112   * @param array $optParams Optional parameters.
113   * @return Creative
114   */
115  public function patch($profileId, $id, Creative $postBody, $optParams = [])
116  {
117    $params = ['profileId' => $profileId, 'id' => $id, 'postBody' => $postBody];
118    $params = array_merge($params, $optParams);
119    return $this->call('patch', [$params], Creative::class);
120  }
121  /**
122   * Updates an existing creative. (creatives.update)
123   *
124   * @param string $profileId User profile ID associated with this request.
125   * @param Creative $postBody
126   * @param array $optParams Optional parameters.
127   * @return Creative
128   */
129  public function update($profileId, Creative $postBody, $optParams = [])
130  {
131    $params = ['profileId' => $profileId, 'postBody' => $postBody];
132    $params = array_merge($params, $optParams);
133    return $this->call('update', [$params], Creative::class);
134  }
135}
136
137// Adding a class alias for backwards compatibility with the previous class name.
138class_alias(Creatives::class, 'Google_Service_Dfareporting_Resource_Creatives');
139