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\BulkListCampaignAssignedTargetingOptionsResponse; 21use Google\Service\DisplayVideo\Campaign; 22use Google\Service\DisplayVideo\DisplayvideoEmpty; 23use Google\Service\DisplayVideo\ListCampaignsResponse; 24 25/** 26 * The "campaigns" collection of methods. 27 * Typical usage is: 28 * <code> 29 * $displayvideoService = new Google\Service\DisplayVideo(...); 30 * $campaigns = $displayvideoService->campaigns; 31 * </code> 32 */ 33class AdvertisersCampaigns extends \Google\Service\Resource 34{ 35 /** 36 * Lists assigned targeting options of a campaign across targeting types. 37 * (campaigns.bulkListCampaignAssignedTargetingOptions) 38 * 39 * @param string $advertiserId Required. The ID of the advertiser the campaign 40 * belongs to. 41 * @param string $campaignId Required. The ID of the campaign to list assigned 42 * targeting options for. 43 * @param array $optParams Optional parameters. 44 * 45 * @opt_param string filter Allows filtering by assigned targeting option 46 * properties. Supported syntax: * Filter expressions are made up of one or more 47 * restrictions. * Restrictions can be combined by the logical operator `OR` on 48 * the same field. * A restriction has the form of `{field} {operator} {value}`. 49 * * The operator must be `EQUALS (=)`. * Supported fields: - `targetingType` - 50 * `inheritance` Examples: * AssignedTargetingOptions of targeting type 51 * TARGETING_TYPE_LANGUAGE or TARGETING_TYPE_GENDER 52 * `targetingType="TARGETING_TYPE_LANGUAGE" OR 53 * targetingType="TARGETING_TYPE_GENDER"` * AssignedTargetingOptions with 54 * inheritance status of NOT_INHERITED or INHERITED_FROM_PARTNER 55 * `inheritance="NOT_INHERITED" OR inheritance="INHERITED_FROM_PARTNER"` The 56 * length of this field should be no more than 500 characters. 57 * @opt_param string orderBy Field by which to sort the list. Acceptable values 58 * are: * `targetingType` (default) The default sorting order is ascending. To 59 * specify descending order for a field, a suffix "desc" should be added to the 60 * field name. Example: `targetingType desc`. 61 * @opt_param int pageSize Requested page size. The size must be an integer 62 * between `1` and `5000`. If unspecified, the default is `5000`. Returns error 63 * code `INVALID_ARGUMENT` if an invalid value is specified. 64 * @opt_param string pageToken A token that lets the client fetch the next page 65 * of results. Typically, this is the value of next_page_token returned from the 66 * previous call to `BulkListCampaignAssignedTargetingOptions` method. If not 67 * specified, the first page of results will be returned. 68 * @return BulkListCampaignAssignedTargetingOptionsResponse 69 */ 70 public function bulkListCampaignAssignedTargetingOptions($advertiserId, $campaignId, $optParams = []) 71 { 72 $params = ['advertiserId' => $advertiserId, 'campaignId' => $campaignId]; 73 $params = array_merge($params, $optParams); 74 return $this->call('bulkListCampaignAssignedTargetingOptions', [$params], BulkListCampaignAssignedTargetingOptionsResponse::class); 75 } 76 /** 77 * Creates a new campaign. Returns the newly created campaign if successful. 78 * (campaigns.create) 79 * 80 * @param string $advertiserId Output only. The unique ID of the advertiser the 81 * campaign belongs to. 82 * @param Campaign $postBody 83 * @param array $optParams Optional parameters. 84 * @return Campaign 85 */ 86 public function create($advertiserId, Campaign $postBody, $optParams = []) 87 { 88 $params = ['advertiserId' => $advertiserId, 'postBody' => $postBody]; 89 $params = array_merge($params, $optParams); 90 return $this->call('create', [$params], Campaign::class); 91 } 92 /** 93 * Permanently deletes a campaign. A deleted campaign cannot be recovered. The 94 * campaign should be archived first, i.e. set entity_status to 95 * `ENTITY_STATUS_ARCHIVED`, to be able to delete it. (campaigns.delete) 96 * 97 * @param string $advertiserId The ID of the advertiser this campaign belongs 98 * to. 99 * @param string $campaignId The ID of the campaign we need to delete. 100 * @param array $optParams Optional parameters. 101 * @return DisplayvideoEmpty 102 */ 103 public function delete($advertiserId, $campaignId, $optParams = []) 104 { 105 $params = ['advertiserId' => $advertiserId, 'campaignId' => $campaignId]; 106 $params = array_merge($params, $optParams); 107 return $this->call('delete', [$params], DisplayvideoEmpty::class); 108 } 109 /** 110 * Gets a campaign. (campaigns.get) 111 * 112 * @param string $advertiserId Required. The ID of the advertiser this campaign 113 * belongs to. 114 * @param string $campaignId Required. The ID of the campaign to fetch. 115 * @param array $optParams Optional parameters. 116 * @return Campaign 117 */ 118 public function get($advertiserId, $campaignId, $optParams = []) 119 { 120 $params = ['advertiserId' => $advertiserId, 'campaignId' => $campaignId]; 121 $params = array_merge($params, $optParams); 122 return $this->call('get', [$params], Campaign::class); 123 } 124 /** 125 * Lists campaigns in an advertiser. The order is defined by the order_by 126 * parameter. If a filter by entity_status is not specified, campaigns with 127 * `ENTITY_STATUS_ARCHIVED` will not be included in the results. 128 * (campaigns.listAdvertisersCampaigns) 129 * 130 * @param string $advertiserId The ID of the advertiser to list campaigns for. 131 * @param array $optParams Optional parameters. 132 * 133 * @opt_param string filter Allows filtering by campaign properties. Supported 134 * syntax: * Filter expressions are made up of one or more restrictions. * 135 * Restrictions can be combined by `AND` or `OR` logical operators. A sequence 136 * of restrictions implicitly uses `AND`. * A restriction has the form of 137 * `{field} {operator} {value}`. * The operator used on `updateTime` must be 138 * `GREATER THAN OR EQUAL TO (>=)` or `LESS THAN OR EQUAL TO (<=)`. * The 139 * operator must be `EQUALS (=)`. * Supported fields: - `campaignId` - 140 * `displayName` - `entityStatus` - `updateTime` (input in ISO 8601 format, or 141 * YYYY-MM-DDTHH:MM:SSZ) Examples: * All `ENTITY_STATUS_ACTIVE` or 142 * `ENTITY_STATUS_PAUSED` campaigns under an advertiser: 143 * `(entityStatus="ENTITY_STATUS_ACTIVE" OR 144 * entityStatus="ENTITY_STATUS_PAUSED")` * All campaigns with an update time 145 * less than or equal to `2020-11-04T18:54:47Z (format of ISO 8601)`: 146 * `updateTime<="2020-11-04T18:54:47Z"` * All campaigns with an update time 147 * greater than or equal to `2020-11-04T18:54:47Z (format of ISO 8601)`: 148 * `updateTime>="2020-11-04T18:54:47Z"` The length of this field should be no 149 * more than 500 characters. 150 * @opt_param string orderBy Field by which to sort the list. Acceptable values 151 * are: * `displayName` (default) * `entityStatus` * `updateTime` The default 152 * sorting order is ascending. To specify descending order for a field, a suffix 153 * "desc" should be added to the field name. Example: `displayName desc`. 154 * @opt_param int pageSize Requested page size. Must be between `1` and `100`. 155 * If unspecified will default to `100`. 156 * @opt_param string pageToken A token identifying a page of results the server 157 * should return. Typically, this is the value of next_page_token returned from 158 * the previous call to `ListCampaigns` method. If not specified, the first page 159 * of results will be returned. 160 * @return ListCampaignsResponse 161 */ 162 public function listAdvertisersCampaigns($advertiserId, $optParams = []) 163 { 164 $params = ['advertiserId' => $advertiserId]; 165 $params = array_merge($params, $optParams); 166 return $this->call('list', [$params], ListCampaignsResponse::class); 167 } 168 /** 169 * Updates an existing campaign. Returns the updated campaign if successful. 170 * (campaigns.patch) 171 * 172 * @param string $advertiserId Output only. The unique ID of the advertiser the 173 * campaign belongs to. 174 * @param string $campaignId Output only. The unique ID of the campaign. 175 * Assigned by the system. 176 * @param Campaign $postBody 177 * @param array $optParams Optional parameters. 178 * 179 * @opt_param string updateMask Required. The mask to control which fields to 180 * update. 181 * @return Campaign 182 */ 183 public function patch($advertiserId, $campaignId, Campaign $postBody, $optParams = []) 184 { 185 $params = ['advertiserId' => $advertiserId, 'campaignId' => $campaignId, 'postBody' => $postBody]; 186 $params = array_merge($params, $optParams); 187 return $this->call('patch', [$params], Campaign::class); 188 } 189} 190 191// Adding a class alias for backwards compatibility with the previous class name. 192class_alias(AdvertisersCampaigns::class, 'Google_Service_DisplayVideo_Resource_AdvertisersCampaigns'); 193