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\RealTimeBidding\Resource;
19
20use Google\Service\RealTimeBidding\Creative;
21use Google\Service\RealTimeBidding\ListCreativesResponse;
22
23/**
24 * The "creatives" collection of methods.
25 * Typical usage is:
26 *  <code>
27 *   $realtimebiddingService = new Google\Service\RealTimeBidding(...);
28 *   $creatives = $realtimebiddingService->creatives;
29 *  </code>
30 */
31class BuyersCreatives extends \Google\Service\Resource
32{
33  /**
34   * Creates a creative. (creatives.create)
35   *
36   * @param string $parent Required. The name of the parent buyer that the new
37   * creative belongs to that must follow the pattern `buyers/{buyerAccountId}`,
38   * where `{buyerAccountId}` represents the account ID of the buyer who owns a
39   * creative. For a bidder accessing creatives on behalf of a child seat buyer,
40   * `{buyerAccountId}` should represent the account ID of the child seat buyer.
41   * @param Creative $postBody
42   * @param array $optParams Optional parameters.
43   * @return Creative
44   */
45  public function create($parent, Creative $postBody, $optParams = [])
46  {
47    $params = ['parent' => $parent, 'postBody' => $postBody];
48    $params = array_merge($params, $optParams);
49    return $this->call('create', [$params], Creative::class);
50  }
51  /**
52   * Gets a creative. (creatives.get)
53   *
54   * @param string $name Required. Name of the creative to retrieve. See
55   * creative.name.
56   * @param array $optParams Optional parameters.
57   *
58   * @opt_param string view Controls the amount of information included in the
59   * response. By default only creativeServingDecision is included. To retrieve
60   * the entire creative resource (including the declared fields and the creative
61   * content) specify the view as "FULL".
62   * @return Creative
63   */
64  public function get($name, $optParams = [])
65  {
66    $params = ['name' => $name];
67    $params = array_merge($params, $optParams);
68    return $this->call('get', [$params], Creative::class);
69  }
70  /**
71   * Lists creatives. (creatives.listBuyersCreatives)
72   *
73   * @param string $parent Required. Name of the parent buyer that owns the
74   * creatives. The pattern for this resource is either `buyers/{buyerAccountId}`
75   * or `bidders/{bidderAccountId}`. For `buyers/{buyerAccountId}`, the
76   * `buyerAccountId` can be one of the following: 1. The ID of the buyer that is
77   * accessing their own creatives. 2. The ID of the child seat buyer under a
78   * bidder account. So for listing creatives pertaining to the child seat buyer
79   * (`456`) under bidder account (`123`), you would use the pattern:
80   * `buyers/456`. 3. The ID of the bidder itself. So for listing creatives
81   * pertaining to bidder (`123`), you would use `buyers/123`. If you want to
82   * access all creatives pertaining to both the bidder and all of its child seat
83   * accounts, you would use `bidders/{bidderAccountId}`, e.g., for all creatives
84   * pertaining to bidder (`123`), use `bidders/123`.
85   * @param array $optParams Optional parameters.
86   *
87   * @opt_param string filter Query string to filter creatives. If no filter is
88   * specified, all active creatives will be returned. Example: 'accountId=12345
89   * AND (dealsStatus:DISAPPROVED AND disapprovalReason:UNACCEPTABLE_CONTENT) OR
90   * declaredAttributes:IS_COOKIE_TARGETED'
91   * @opt_param int pageSize Requested page size. The server may return fewer
92   * creatives than requested (due to timeout constraint) even if more are
93   * available via another call. If unspecified, server will pick an appropriate
94   * default. Acceptable values are 1 to 1000, inclusive.
95   * @opt_param string pageToken A token identifying a page of results the server
96   * should return. Typically, this is the value of
97   * ListCreativesResponse.nextPageToken returned from the previous call to the
98   * 'ListCreatives' method. Page tokens for continued pages are valid for up to
99   * five hours, counting from the call to 'ListCreatives' for the first page.
100   * @opt_param string view Controls the amount of information included in the
101   * response. By default only creativeServingDecision is included. To retrieve
102   * the entire creative resource (including the declared fields and the creative
103   * content) specify the view as "FULL".
104   * @return ListCreativesResponse
105   */
106  public function listBuyersCreatives($parent, $optParams = [])
107  {
108    $params = ['parent' => $parent];
109    $params = array_merge($params, $optParams);
110    return $this->call('list', [$params], ListCreativesResponse::class);
111  }
112  /**
113   * Updates a creative. (creatives.patch)
114   *
115   * @param string $name Output only. Name of the creative. Follows the pattern
116   * `buyers/{buyer}/creatives/{creative}`, where `{buyer}` represents the account
117   * ID of the buyer who owns the creative, and `{creative}` is the buyer-specific
118   * creative ID that references this creative in the bid response.
119   * @param Creative $postBody
120   * @param array $optParams Optional parameters.
121   *
122   * @opt_param string updateMask Field mask to use for partial in-place updates.
123   * @return Creative
124   */
125  public function patch($name, Creative $postBody, $optParams = [])
126  {
127    $params = ['name' => $name, 'postBody' => $postBody];
128    $params = array_merge($params, $optParams);
129    return $this->call('patch', [$params], Creative::class);
130  }
131}
132
133// Adding a class alias for backwards compatibility with the previous class name.
134class_alias(BuyersCreatives::class, 'Google_Service_RealTimeBidding_Resource_BuyersCreatives');
135