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\AdExchangeBuyer\Resource;
19
20use Google\Service\AdExchangeBuyer\Creative;
21use Google\Service\AdExchangeBuyer\CreativeDealIds;
22use Google\Service\AdExchangeBuyer\CreativesList;
23
24/**
25 * The "creatives" collection of methods.
26 * Typical usage is:
27 *  <code>
28 *   $adexchangebuyerService = new Google\Service\AdExchangeBuyer(...);
29 *   $creatives = $adexchangebuyerService->creatives;
30 *  </code>
31 */
32class Creatives extends \Google\Service\Resource
33{
34  /**
35   * Add a deal id association for the creative. (creatives.addDeal)
36   *
37   * @param int $accountId The id for the account that will serve this creative.
38   * @param string $buyerCreativeId The buyer-specific id for this creative.
39   * @param string $dealId The id of the deal id to associate with this creative.
40   * @param array $optParams Optional parameters.
41   */
42  public function addDeal($accountId, $buyerCreativeId, $dealId, $optParams = [])
43  {
44    $params = ['accountId' => $accountId, 'buyerCreativeId' => $buyerCreativeId, 'dealId' => $dealId];
45    $params = array_merge($params, $optParams);
46    return $this->call('addDeal', [$params]);
47  }
48  /**
49   * Gets the status for a single creative. A creative will be available 30-40
50   * minutes after submission. (creatives.get)
51   *
52   * @param int $accountId The id for the account that will serve this creative.
53   * @param string $buyerCreativeId The buyer-specific id for this creative.
54   * @param array $optParams Optional parameters.
55   * @return Creative
56   */
57  public function get($accountId, $buyerCreativeId, $optParams = [])
58  {
59    $params = ['accountId' => $accountId, 'buyerCreativeId' => $buyerCreativeId];
60    $params = array_merge($params, $optParams);
61    return $this->call('get', [$params], Creative::class);
62  }
63  /**
64   * Submit a new creative. (creatives.insert)
65   *
66   * @param Creative $postBody
67   * @param array $optParams Optional parameters.
68   * @return Creative
69   */
70  public function insert(Creative $postBody, $optParams = [])
71  {
72    $params = ['postBody' => $postBody];
73    $params = array_merge($params, $optParams);
74    return $this->call('insert', [$params], Creative::class);
75  }
76  /**
77   * Retrieves a list of the authenticated user's active creatives. A creative
78   * will be available 30-40 minutes after submission. (creatives.listCreatives)
79   *
80   * @param array $optParams Optional parameters.
81   *
82   * @opt_param int accountId When specified, only creatives for the given account
83   * ids are returned.
84   * @opt_param string buyerCreativeId When specified, only creatives for the
85   * given buyer creative ids are returned.
86   * @opt_param string dealsStatusFilter When specified, only creatives having the
87   * given deals status are returned.
88   * @opt_param string maxResults Maximum number of entries returned on one result
89   * page. If not set, the default is 100. Optional.
90   * @opt_param string openAuctionStatusFilter When specified, only creatives
91   * having the given open auction status are returned.
92   * @opt_param string pageToken A continuation token, used to page through ad
93   * clients. To retrieve the next page, set this parameter to the value of
94   * "nextPageToken" from the previous response. Optional.
95   * @return CreativesList
96   */
97  public function listCreatives($optParams = [])
98  {
99    $params = [];
100    $params = array_merge($params, $optParams);
101    return $this->call('list', [$params], CreativesList::class);
102  }
103  /**
104   * Lists the external deal ids associated with the creative.
105   * (creatives.listDeals)
106   *
107   * @param int $accountId The id for the account that will serve this creative.
108   * @param string $buyerCreativeId The buyer-specific id for this creative.
109   * @param array $optParams Optional parameters.
110   * @return CreativeDealIds
111   */
112  public function listDeals($accountId, $buyerCreativeId, $optParams = [])
113  {
114    $params = ['accountId' => $accountId, 'buyerCreativeId' => $buyerCreativeId];
115    $params = array_merge($params, $optParams);
116    return $this->call('listDeals', [$params], CreativeDealIds::class);
117  }
118  /**
119   * Remove a deal id associated with the creative. (creatives.removeDeal)
120   *
121   * @param int $accountId The id for the account that will serve this creative.
122   * @param string $buyerCreativeId The buyer-specific id for this creative.
123   * @param string $dealId The id of the deal id to disassociate with this
124   * creative.
125   * @param array $optParams Optional parameters.
126   */
127  public function removeDeal($accountId, $buyerCreativeId, $dealId, $optParams = [])
128  {
129    $params = ['accountId' => $accountId, 'buyerCreativeId' => $buyerCreativeId, 'dealId' => $dealId];
130    $params = array_merge($params, $optParams);
131    return $this->call('removeDeal', [$params]);
132  }
133}
134
135// Adding a class alias for backwards compatibility with the previous class name.
136class_alias(Creatives::class, 'Google_Service_AdExchangeBuyer_Resource_Creatives');
137