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\Dfareporting\Resource; 19 20use Google\Service\Dfareporting\Campaign; 21use Google\Service\Dfareporting\CampaignsListResponse; 22 23/** 24 * The "campaigns" collection of methods. 25 * Typical usage is: 26 * <code> 27 * $dfareportingService = new Google\Service\Dfareporting(...); 28 * $campaigns = $dfareportingService->campaigns; 29 * </code> 30 */ 31class Campaigns extends \Google\Service\Resource 32{ 33 /** 34 * Gets one campaign by ID. (campaigns.get) 35 * 36 * @param string $profileId User profile ID associated with this request. 37 * @param string $id Campaign ID. 38 * @param array $optParams Optional parameters. 39 * @return Campaign 40 */ 41 public function get($profileId, $id, $optParams = []) 42 { 43 $params = ['profileId' => $profileId, 'id' => $id]; 44 $params = array_merge($params, $optParams); 45 return $this->call('get', [$params], Campaign::class); 46 } 47 /** 48 * Inserts a new campaign. (campaigns.insert) 49 * 50 * @param string $profileId User profile ID associated with this request. 51 * @param Campaign $postBody 52 * @param array $optParams Optional parameters. 53 * @return Campaign 54 */ 55 public function insert($profileId, Campaign $postBody, $optParams = []) 56 { 57 $params = ['profileId' => $profileId, 'postBody' => $postBody]; 58 $params = array_merge($params, $optParams); 59 return $this->call('insert', [$params], Campaign::class); 60 } 61 /** 62 * Retrieves a list of campaigns, possibly filtered. This method supports 63 * paging. (campaigns.listCampaigns) 64 * 65 * @param string $profileId User profile ID associated with this request. 66 * @param array $optParams Optional parameters. 67 * 68 * @opt_param string advertiserGroupIds Select only campaigns whose advertisers 69 * belong to these advertiser groups. 70 * @opt_param string advertiserIds Select only campaigns that belong to these 71 * advertisers. 72 * @opt_param bool archived Select only archived campaigns. Don't set this field 73 * to select both archived and non-archived campaigns. 74 * @opt_param bool atLeastOneOptimizationActivity Select only campaigns that 75 * have at least one optimization activity. 76 * @opt_param string excludedIds Exclude campaigns with these IDs. 77 * @opt_param string ids Select only campaigns with these IDs. 78 * @opt_param int maxResults Maximum number of results to return. 79 * @opt_param string overriddenEventTagId Select only campaigns that have 80 * overridden this event tag ID. 81 * @opt_param string pageToken Value of the nextPageToken from the previous 82 * result page. 83 * @opt_param string searchString Allows searching for campaigns by name or ID. 84 * Wildcards (*) are allowed. For example, "campaign*2015" will return campaigns 85 * with names like "campaign June 2015", "campaign April 2015", or simply 86 * "campaign 2015". Most of the searches also add wildcards implicitly at the 87 * start and the end of the search string. For example, a search string of 88 * "campaign" will match campaigns with name "my campaign", "campaign 2015", or 89 * simply "campaign". 90 * @opt_param string sortField Field by which to sort the list. 91 * @opt_param string sortOrder Order of sorted results. 92 * @opt_param string subaccountId Select only campaigns that belong to this 93 * subaccount. 94 * @return CampaignsListResponse 95 */ 96 public function listCampaigns($profileId, $optParams = []) 97 { 98 $params = ['profileId' => $profileId]; 99 $params = array_merge($params, $optParams); 100 return $this->call('list', [$params], CampaignsListResponse::class); 101 } 102 /** 103 * Updates an existing campaign. This method supports patch semantics. 104 * (campaigns.patch) 105 * 106 * @param string $profileId User profile ID associated with this request. 107 * @param string $id Campaign ID. 108 * @param Campaign $postBody 109 * @param array $optParams Optional parameters. 110 * @return Campaign 111 */ 112 public function patch($profileId, $id, Campaign $postBody, $optParams = []) 113 { 114 $params = ['profileId' => $profileId, 'id' => $id, 'postBody' => $postBody]; 115 $params = array_merge($params, $optParams); 116 return $this->call('patch', [$params], Campaign::class); 117 } 118 /** 119 * Updates an existing campaign. (campaigns.update) 120 * 121 * @param string $profileId User profile ID associated with this request. 122 * @param Campaign $postBody 123 * @param array $optParams Optional parameters. 124 * @return Campaign 125 */ 126 public function update($profileId, Campaign $postBody, $optParams = []) 127 { 128 $params = ['profileId' => $profileId, 'postBody' => $postBody]; 129 $params = array_merge($params, $optParams); 130 return $this->call('update', [$params], Campaign::class); 131 } 132} 133 134// Adding a class alias for backwards compatibility with the previous class name. 135class_alias(Campaigns::class, 'Google_Service_Dfareporting_Resource_Campaigns'); 136