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\AdExchangeBuyerII\Resource;
19
20use Google\Service\AdExchangeBuyerII\Adexchangebuyer2Empty;
21use Google\Service\AdExchangeBuyerII\Creative;
22use Google\Service\AdExchangeBuyerII\ListCreativesResponse;
23use Google\Service\AdExchangeBuyerII\StopWatchingCreativeRequest;
24use Google\Service\AdExchangeBuyerII\WatchCreativeRequest;
25
26/**
27 * The "creatives" collection of methods.
28 * Typical usage is:
29 *  <code>
30 *   $adexchangebuyer2Service = new Google\Service\AdExchangeBuyerII(...);
31 *   $creatives = $adexchangebuyer2Service->creatives;
32 *  </code>
33 */
34class AccountsCreatives extends \Google\Service\Resource
35{
36  /**
37   * Creates a creative. (creatives.create)
38   *
39   * @param string $accountId The account that this creative belongs to. Can be
40   * used to filter the response of the creatives.list method.
41   * @param Creative $postBody
42   * @param array $optParams Optional parameters.
43   *
44   * @opt_param string duplicateIdMode Indicates if multiple creatives can share
45   * an ID or not. Default is NO_DUPLICATES (one ID per creative).
46   * @return Creative
47   */
48  public function create($accountId, Creative $postBody, $optParams = [])
49  {
50    $params = ['accountId' => $accountId, 'postBody' => $postBody];
51    $params = array_merge($params, $optParams);
52    return $this->call('create', [$params], Creative::class);
53  }
54  /**
55   * Gets a creative. (creatives.get)
56   *
57   * @param string $accountId The account the creative belongs to.
58   * @param string $creativeId The ID of the creative to retrieve.
59   * @param array $optParams Optional parameters.
60   * @return Creative
61   */
62  public function get($accountId, $creativeId, $optParams = [])
63  {
64    $params = ['accountId' => $accountId, 'creativeId' => $creativeId];
65    $params = array_merge($params, $optParams);
66    return $this->call('get', [$params], Creative::class);
67  }
68  /**
69   * Lists creatives. (creatives.listAccountsCreatives)
70   *
71   * @param string $accountId The account to list the creatives from. Specify "-"
72   * to list all creatives the current user has access to.
73   * @param array $optParams Optional parameters.
74   *
75   * @opt_param int pageSize Requested page size. The server may return fewer
76   * creatives than requested (due to timeout constraint) even if more are
77   * available via another call. If unspecified, server will pick an appropriate
78   * default. Acceptable values are 1 to 1000, inclusive.
79   * @opt_param string pageToken A token identifying a page of results the server
80   * should return. Typically, this is the value of
81   * ListCreativesResponse.next_page_token returned from the previous call to
82   * 'ListCreatives' method.
83   * @opt_param string query An optional query string to filter creatives. If no
84   * filter is specified, all active creatives will be returned. Supported queries
85   * are: - accountId=*account_id_string* - creativeId=*creative_id_string* -
86   * dealsStatus: {approved, conditionally_approved, disapproved, not_checked} -
87   * openAuctionStatus: {approved, conditionally_approved, disapproved,
88   * not_checked} - attribute: {a numeric attribute from the list of attributes} -
89   * disapprovalReason: {a reason from DisapprovalReason} Example:
90   * 'accountId=12345 AND (dealsStatus:disapproved AND
91   * disapprovalReason:unacceptable_content) OR attribute:47'
92   * @return ListCreativesResponse
93   */
94  public function listAccountsCreatives($accountId, $optParams = [])
95  {
96    $params = ['accountId' => $accountId];
97    $params = array_merge($params, $optParams);
98    return $this->call('list', [$params], ListCreativesResponse::class);
99  }
100  /**
101   * Stops watching a creative. Will stop push notifications being sent to the
102   * topics when the creative changes status. (creatives.stopWatching)
103   *
104   * @param string $accountId The account of the creative to stop notifications
105   * for.
106   * @param string $creativeId The creative ID of the creative to stop
107   * notifications for. Specify "-" to specify stopping account level
108   * notifications.
109   * @param StopWatchingCreativeRequest $postBody
110   * @param array $optParams Optional parameters.
111   * @return Adexchangebuyer2Empty
112   */
113  public function stopWatching($accountId, $creativeId, StopWatchingCreativeRequest $postBody, $optParams = [])
114  {
115    $params = ['accountId' => $accountId, 'creativeId' => $creativeId, 'postBody' => $postBody];
116    $params = array_merge($params, $optParams);
117    return $this->call('stopWatching', [$params], Adexchangebuyer2Empty::class);
118  }
119  /**
120   * Updates a creative. (creatives.update)
121   *
122   * @param string $accountId The account that this creative belongs to. Can be
123   * used to filter the response of the creatives.list method.
124   * @param string $creativeId The buyer-defined creative ID of this creative. Can
125   * be used to filter the response of the creatives.list method.
126   * @param Creative $postBody
127   * @param array $optParams Optional parameters.
128   * @return Creative
129   */
130  public function update($accountId, $creativeId, Creative $postBody, $optParams = [])
131  {
132    $params = ['accountId' => $accountId, 'creativeId' => $creativeId, 'postBody' => $postBody];
133    $params = array_merge($params, $optParams);
134    return $this->call('update', [$params], Creative::class);
135  }
136  /**
137   * Watches a creative. Will result in push notifications being sent to the topic
138   * when the creative changes status. (creatives.watch)
139   *
140   * @param string $accountId The account of the creative to watch.
141   * @param string $creativeId The creative ID to watch for status changes.
142   * Specify "-" to watch all creatives under the above account. If both creative-
143   * level and account-level notifications are sent, only a single notification
144   * will be sent to the creative-level notification topic.
145   * @param WatchCreativeRequest $postBody
146   * @param array $optParams Optional parameters.
147   * @return Adexchangebuyer2Empty
148   */
149  public function watch($accountId, $creativeId, WatchCreativeRequest $postBody, $optParams = [])
150  {
151    $params = ['accountId' => $accountId, 'creativeId' => $creativeId, 'postBody' => $postBody];
152    $params = array_merge($params, $optParams);
153    return $this->call('watch', [$params], Adexchangebuyer2Empty::class);
154  }
155}
156
157// Adding a class alias for backwards compatibility with the previous class name.
158class_alias(AccountsCreatives::class, 'Google_Service_AdExchangeBuyerII_Resource_AccountsCreatives');
159