[e3d4e0a] | 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 | namespace Google\Service\DisplayVideo\Resource;
|
---|
| 19 |
|
---|
| 20 | use Google\Service\DisplayVideo\Creative;
|
---|
| 21 | use Google\Service\DisplayVideo\DisplayvideoEmpty;
|
---|
| 22 | use 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->advertisers_creatives;
|
---|
| 30 | * </code>
|
---|
| 31 | */
|
---|
| 32 | class AdvertisersCreatives extends \Google\Service\Resource
|
---|
| 33 | {
|
---|
| 34 | /**
|
---|
| 35 | * Creates a new creative. Returns the newly created creative if successful. A
|
---|
| 36 | * ["Standard" user role](//support.google.com/displayvideo/answer/2723011) or
|
---|
| 37 | * greater for the parent advertiser or partner is required to make this
|
---|
| 38 | * request. (creatives.create)
|
---|
| 39 | *
|
---|
| 40 | * @param string $advertiserId Output only. The unique ID of the advertiser the
|
---|
| 41 | * creative belongs to.
|
---|
| 42 | * @param Creative $postBody
|
---|
| 43 | * @param array $optParams Optional parameters.
|
---|
| 44 | * @return Creative
|
---|
| 45 | * @throws \Google\Service\Exception
|
---|
| 46 | */
|
---|
| 47 | public function create($advertiserId, Creative $postBody, $optParams = [])
|
---|
| 48 | {
|
---|
| 49 | $params = ['advertiserId' => $advertiserId, 'postBody' => $postBody];
|
---|
| 50 | $params = array_merge($params, $optParams);
|
---|
| 51 | return $this->call('create', [$params], Creative::class);
|
---|
| 52 | }
|
---|
| 53 | /**
|
---|
| 54 | * Deletes a creative. Returns error code `NOT_FOUND` if the creative does not
|
---|
| 55 | * exist. The creative should be archived first, i.e. set entity_status to
|
---|
| 56 | * `ENTITY_STATUS_ARCHIVED`, before it can be deleted. A ["Standard" user
|
---|
| 57 | * role](//support.google.com/displayvideo/answer/2723011) or greater for the
|
---|
| 58 | * parent advertiser or partner is required to make this request.
|
---|
| 59 | * (creatives.delete)
|
---|
| 60 | *
|
---|
| 61 | * @param string $advertiserId The ID of the advertiser this creative belongs
|
---|
| 62 | * to.
|
---|
| 63 | * @param string $creativeId The ID of the creative to be deleted.
|
---|
| 64 | * @param array $optParams Optional parameters.
|
---|
| 65 | * @return DisplayvideoEmpty
|
---|
| 66 | * @throws \Google\Service\Exception
|
---|
| 67 | */
|
---|
| 68 | public function delete($advertiserId, $creativeId, $optParams = [])
|
---|
| 69 | {
|
---|
| 70 | $params = ['advertiserId' => $advertiserId, 'creativeId' => $creativeId];
|
---|
| 71 | $params = array_merge($params, $optParams);
|
---|
| 72 | return $this->call('delete', [$params], DisplayvideoEmpty::class);
|
---|
| 73 | }
|
---|
| 74 | /**
|
---|
| 75 | * Gets a creative. (creatives.get)
|
---|
| 76 | *
|
---|
| 77 | * @param string $advertiserId Required. The ID of the advertiser this creative
|
---|
| 78 | * belongs to.
|
---|
| 79 | * @param string $creativeId Required. The ID of the creative to fetch.
|
---|
| 80 | * @param array $optParams Optional parameters.
|
---|
| 81 | * @return Creative
|
---|
| 82 | * @throws \Google\Service\Exception
|
---|
| 83 | */
|
---|
| 84 | public function get($advertiserId, $creativeId, $optParams = [])
|
---|
| 85 | {
|
---|
| 86 | $params = ['advertiserId' => $advertiserId, 'creativeId' => $creativeId];
|
---|
| 87 | $params = array_merge($params, $optParams);
|
---|
| 88 | return $this->call('get', [$params], Creative::class);
|
---|
| 89 | }
|
---|
| 90 | /**
|
---|
| 91 | * Lists creatives in an advertiser. The order is defined by the order_by
|
---|
| 92 | * parameter. If a filter by entity_status is not specified, creatives with
|
---|
| 93 | * `ENTITY_STATUS_ARCHIVED` will not be included in the results.
|
---|
| 94 | * (creatives.listAdvertisersCreatives)
|
---|
| 95 | *
|
---|
| 96 | * @param string $advertiserId Required. The ID of the advertiser to list
|
---|
| 97 | * creatives for.
|
---|
| 98 | * @param array $optParams Optional parameters.
|
---|
| 99 | *
|
---|
| 100 | * @opt_param string filter Allows filtering by creative fields. Supported
|
---|
| 101 | * syntax: * Filter expressions are made up of one or more restrictions. *
|
---|
| 102 | * Restrictions can be combined by `AND` or `OR` logical operators. A sequence
|
---|
| 103 | * of restrictions implicitly uses `AND`. * A restriction has the form of
|
---|
| 104 | * `{field} {operator} {value}`. * The `lineItemIds` field must use the `HAS
|
---|
| 105 | * (:)` operator. * The `updateTime` field must use the `GREATER THAN OR EQUAL
|
---|
| 106 | * TO (>=)` or `LESS THAN OR EQUAL TO (<=)` operators. * All other fields must
|
---|
| 107 | * use the `EQUALS (=)` operator. * For `entityStatus`, `minDuration`,
|
---|
| 108 | * `maxDuration`, `updateTime`, and `dynamic` fields, there may be at most one
|
---|
| 109 | * restriction. Supported Fields: * `approvalStatus` * `creativeId` *
|
---|
| 110 | * `creativeType` * `dimensions` (input in the form of `{width}x{height}`) *
|
---|
| 111 | * `dynamic` * `entityStatus` * `exchangeReviewStatus` (input in the form of
|
---|
| 112 | * `{exchange}-{reviewStatus}`) * `lineItemIds` * `maxDuration` (input in the
|
---|
| 113 | * form of `{duration}s`. Only seconds are supported) * `minDuration` (input in
|
---|
| 114 | * the form of `{duration}s`. Only seconds are supported) * `updateTime` (input
|
---|
| 115 | * in ISO 8601 format, or `YYYY-MM-DDTHH:MM:SSZ`) Notes: * For `updateTime`, a
|
---|
| 116 | * creative resource's field value reflects the last time that a creative has
|
---|
| 117 | * been updated, which includes updates made by the system (e.g. creative review
|
---|
| 118 | * updates). Examples: * All native creatives:
|
---|
| 119 | * `creativeType="CREATIVE_TYPE_NATIVE"` * All active creatives with 300x400 or
|
---|
| 120 | * 50x100 dimensions: `entityStatus="ENTITY_STATUS_ACTIVE" AND
|
---|
| 121 | * (dimensions="300x400" OR dimensions="50x100")` * All dynamic creatives that
|
---|
| 122 | * are approved by AdX or AppNexus, with a minimum duration of 5 seconds and
|
---|
| 123 | * 200ms: `dynamic="true" AND minDuration="5.2s" AND
|
---|
| 124 | * (exchangeReviewStatus="EXCHANGE_GOOGLE_AD_MANAGER-REVIEW_STATUS_APPROVED" OR
|
---|
| 125 | * exchangeReviewStatus="EXCHANGE_APPNEXUS-REVIEW_STATUS_APPROVED")` * All video
|
---|
| 126 | * creatives that are associated with line item ID 1 or 2:
|
---|
| 127 | * `creativeType="CREATIVE_TYPE_VIDEO" AND (lineItemIds:1 OR lineItemIds:2)` *
|
---|
| 128 | * Find creatives by multiple creative IDs: `creativeId=1 OR creativeId=2` * All
|
---|
| 129 | * creatives with an update time greater than or equal to 2020-11-04T18:54:47Z
|
---|
| 130 | * (format of ISO 8601): `updateTime>="2020-11-04T18:54:47Z"` The length of this
|
---|
| 131 | * field should be no more than 500 characters. Reference our [filter `LIST`
|
---|
| 132 | * requests](/display-video/api/guides/how-tos/filters) guide for more
|
---|
| 133 | * information.
|
---|
| 134 | * @opt_param string orderBy Field by which to sort the list. Acceptable values
|
---|
| 135 | * are: * `creativeId` (default) * `createTime` * `mediaDuration` * `dimensions`
|
---|
| 136 | * (sorts by width first, then by height) The default sorting order is
|
---|
| 137 | * ascending. To specify descending order for a field, a suffix "desc" should be
|
---|
| 138 | * added to the field name. Example: `createTime desc`.
|
---|
| 139 | * @opt_param int pageSize Requested page size. Must be between `1` and `200`.
|
---|
| 140 | * If unspecified will default to `100`. Returns error code `INVALID_ARGUMENT`
|
---|
| 141 | * if an invalid value is specified.
|
---|
| 142 | * @opt_param string pageToken A token identifying a page of results the server
|
---|
| 143 | * should return. Typically, this is the value of next_page_token returned from
|
---|
| 144 | * the previous call to `ListCreatives` method. If not specified, the first page
|
---|
| 145 | * of results will be returned.
|
---|
| 146 | * @return ListCreativesResponse
|
---|
| 147 | * @throws \Google\Service\Exception
|
---|
| 148 | */
|
---|
| 149 | public function listAdvertisersCreatives($advertiserId, $optParams = [])
|
---|
| 150 | {
|
---|
| 151 | $params = ['advertiserId' => $advertiserId];
|
---|
| 152 | $params = array_merge($params, $optParams);
|
---|
| 153 | return $this->call('list', [$params], ListCreativesResponse::class);
|
---|
| 154 | }
|
---|
| 155 | /**
|
---|
| 156 | * Updates an existing creative. Returns the updated creative if successful. A
|
---|
| 157 | * ["Standard" user role](//support.google.com/displayvideo/answer/2723011) or
|
---|
| 158 | * greater for the parent advertiser or partner is required to make this
|
---|
| 159 | * request. (creatives.patch)
|
---|
| 160 | *
|
---|
| 161 | * @param string $advertiserId Output only. The unique ID of the advertiser the
|
---|
| 162 | * creative belongs to.
|
---|
| 163 | * @param string $creativeId Output only. The unique ID of the creative.
|
---|
| 164 | * Assigned by the system.
|
---|
| 165 | * @param Creative $postBody
|
---|
| 166 | * @param array $optParams Optional parameters.
|
---|
| 167 | *
|
---|
| 168 | * @opt_param string updateMask Required. The mask to control which fields to
|
---|
| 169 | * update.
|
---|
| 170 | * @return Creative
|
---|
| 171 | * @throws \Google\Service\Exception
|
---|
| 172 | */
|
---|
| 173 | public function patch($advertiserId, $creativeId, Creative $postBody, $optParams = [])
|
---|
| 174 | {
|
---|
| 175 | $params = ['advertiserId' => $advertiserId, 'creativeId' => $creativeId, 'postBody' => $postBody];
|
---|
| 176 | $params = array_merge($params, $optParams);
|
---|
| 177 | return $this->call('patch', [$params], Creative::class);
|
---|
| 178 | }
|
---|
| 179 | }
|
---|
| 180 |
|
---|
| 181 | // Adding a class alias for backwards compatibility with the previous class name.
|
---|
| 182 | class_alias(AdvertisersCreatives::class, 'Google_Service_DisplayVideo_Resource_AdvertisersCreatives');
|
---|