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