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