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\DisplayVideo\Resource;
19
20use Google\Service\DisplayVideo\Creative;
21use Google\Service\DisplayVideo\DisplayvideoEmpty;
22use Google\Service\DisplayVideo\ListCreativesResponse;
23
24/**
25 * The "creatives" collection of methods.
26 * Typical usage is:
27 *  <code>
28 *   $displayvideoService = new Google\Service\DisplayVideo(...);
29 *   $creatives = $displayvideoService->creatives;
30 *  </code>
31 */
32class AdvertisersCreatives extends \Google\Service\Resource
33{
34  /**
35   * Creates a new creative. Returns the newly created creative if successful.
36   * (creatives.create)
37   *
38   * @param string $advertiserId Output only. The unique ID of the advertiser the
39   * creative belongs to.
40   * @param Creative $postBody
41   * @param array $optParams Optional parameters.
42   * @return Creative
43   */
44  public function create($advertiserId, Creative $postBody, $optParams = [])
45  {
46    $params = ['advertiserId' => $advertiserId, 'postBody' => $postBody];
47    $params = array_merge($params, $optParams);
48    return $this->call('create', [$params], Creative::class);
49  }
50  /**
51   * Deletes a creative. Returns error code `NOT_FOUND` if the creative does not
52   * exist. The creative should be archived first, i.e. set entity_status to
53   * `ENTITY_STATUS_ARCHIVED`, before it can be deleted. (creatives.delete)
54   *
55   * @param string $advertiserId The ID of the advertiser this creative belongs
56   * to.
57   * @param string $creativeId The ID of the creative to be deleted.
58   * @param array $optParams Optional parameters.
59   * @return DisplayvideoEmpty
60   */
61  public function delete($advertiserId, $creativeId, $optParams = [])
62  {
63    $params = ['advertiserId' => $advertiserId, 'creativeId' => $creativeId];
64    $params = array_merge($params, $optParams);
65    return $this->call('delete', [$params], DisplayvideoEmpty::class);
66  }
67  /**
68   * Gets a creative. (creatives.get)
69   *
70   * @param string $advertiserId Required. The ID of the advertiser this creative
71   * belongs to.
72   * @param string $creativeId Required. The ID of the creative to fetch.
73   * @param array $optParams Optional parameters.
74   * @return Creative
75   */
76  public function get($advertiserId, $creativeId, $optParams = [])
77  {
78    $params = ['advertiserId' => $advertiserId, 'creativeId' => $creativeId];
79    $params = array_merge($params, $optParams);
80    return $this->call('get', [$params], Creative::class);
81  }
82  /**
83   * Lists creatives in an advertiser. The order is defined by the order_by
84   * parameter. If a filter by entity_status is not specified, creatives with
85   * `ENTITY_STATUS_ARCHIVED` will not be included in the results.
86   * (creatives.listAdvertisersCreatives)
87   *
88   * @param string $advertiserId Required. The ID of the advertiser to list
89   * creatives for.
90   * @param array $optParams Optional parameters.
91   *
92   * @opt_param string filter Allows filtering by creative properties. Supported
93   * syntax: * Filter expressions are made up of one or more restrictions. *
94   * Restriction for the same field must be combined by `OR`. * Restriction for
95   * different fields must be combined by `AND`. * Between `(` and `)` there can
96   * only be restrictions combined by `OR` for the same field. * A restriction has
97   * the form of `{field} {operator} {value}`. * The operator must be `EQUALS (=)`
98   * for the following fields: - `entityStatus` - `creativeType`. - `dimensions` -
99   * `minDuration` - `maxDuration` - `approvalStatus` - `exchangeReviewStatus` -
100   * `dynamic` - `creativeId` * The operator must be `HAS (:)` for the following
101   * fields: - `lineItemIds` * For `entityStatus`, `minDuration`, `maxDuration`,
102   * and `dynamic` there may be at most one restriction. * For `dimensions`, the
103   * value is in the form of `"{width}x{height}"`. * For `exchangeReviewStatus`,
104   * the value is in the form of `{exchange}-{reviewStatus}`. * For `minDuration`
105   * and `maxDuration`, the value is in the form of `"{duration}s"`. Only seconds
106   * are supported with millisecond granularity. * There may be multiple
107   * `lineItemIds` restrictions in order to search against multiple possible line
108   * item IDs. * There may be multiple `creativeId` restrictions in order to
109   * search against multiple possible creative IDs. Examples: * All native
110   * creatives: `creativeType="CREATIVE_TYPE_NATIVE"` * All active creatives with
111   * 300x400 or 50x100 dimensions: `entityStatus="ENTITY_STATUS_ACTIVE" AND
112   * (dimensions="300x400" OR dimensions="50x100")` * All dynamic creatives that
113   * are approved by AdX or AppNexus, with a minimum duration of 5 seconds and
114   * 200ms. `dynamic="true" AND minDuration="5.2s" AND (exchangeReviewStatus
115   * ="EXCHANGE_GOOGLE_AD_MANAGER-REVIEW_STATUS_APPROVED" OR exchangeReviewStatus
116   * ="EXCHANGE_APPNEXUS-REVIEW_STATUS_APPROVED")` * All video creatives that are
117   * associated with line item ID 1 or 2: `creativeType="CREATIVE_TYPE_VIDEO" AND
118   * (lineItemIds:1 OR lineItemIds:2)` * Find creatives by multiple creative IDs:
119   * `creativeId=1 OR creativeId=2` The length of this field should be no more
120   * than 500 characters.
121   * @opt_param string orderBy Field by which to sort the list. Acceptable values
122   * are: * `creativeId` (default) * `createTime` * `mediaDuration` * `dimensions`
123   * (sorts by width first, then by height) The default sorting order is
124   * ascending. To specify descending order for a field, a suffix "desc" should be
125   * added to the field name. Example: `createTime desc`.
126   * @opt_param int pageSize Requested page size. Must be between `1` and `100`.
127   * If unspecified will default to `100`. Returns error code `INVALID_ARGUMENT`
128   * if an invalid value is specified.
129   * @opt_param string pageToken A token identifying a page of results the server
130   * should return. Typically, this is the value of next_page_token returned from
131   * the previous call to `ListCreatives` method. If not specified, the first page
132   * of results will be returned.
133   * @return ListCreativesResponse
134   */
135  public function listAdvertisersCreatives($advertiserId, $optParams = [])
136  {
137    $params = ['advertiserId' => $advertiserId];
138    $params = array_merge($params, $optParams);
139    return $this->call('list', [$params], ListCreativesResponse::class);
140  }
141  /**
142   * Updates an existing creative. Returns the updated creative if successful.
143   * (creatives.patch)
144   *
145   * @param string $advertiserId Output only. The unique ID of the advertiser the
146   * creative belongs to.
147   * @param string $creativeId Output only. The unique ID of the creative.
148   * Assigned by the system.
149   * @param Creative $postBody
150   * @param array $optParams Optional parameters.
151   *
152   * @opt_param string updateMask Required. The mask to control which fields to
153   * update.
154   * @return Creative
155   */
156  public function patch($advertiserId, $creativeId, Creative $postBody, $optParams = [])
157  {
158    $params = ['advertiserId' => $advertiserId, 'creativeId' => $creativeId, 'postBody' => $postBody];
159    $params = array_merge($params, $optParams);
160    return $this->call('patch', [$params], Creative::class);
161  }
162}
163
164// Adding a class alias for backwards compatibility with the previous class name.
165class_alias(AdvertisersCreatives::class, 'Google_Service_DisplayVideo_Resource_AdvertisersCreatives');
166