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