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\AndroidPublisher\Resource;
|
---|
19 |
|
---|
20 | use Google\Service\AndroidPublisher\ActivateSubscriptionOfferRequest;
|
---|
21 | use Google\Service\AndroidPublisher\BatchGetSubscriptionOffersRequest;
|
---|
22 | use Google\Service\AndroidPublisher\BatchGetSubscriptionOffersResponse;
|
---|
23 | use Google\Service\AndroidPublisher\BatchUpdateSubscriptionOfferStatesRequest;
|
---|
24 | use Google\Service\AndroidPublisher\BatchUpdateSubscriptionOfferStatesResponse;
|
---|
25 | use Google\Service\AndroidPublisher\BatchUpdateSubscriptionOffersRequest;
|
---|
26 | use Google\Service\AndroidPublisher\BatchUpdateSubscriptionOffersResponse;
|
---|
27 | use Google\Service\AndroidPublisher\DeactivateSubscriptionOfferRequest;
|
---|
28 | use Google\Service\AndroidPublisher\ListSubscriptionOffersResponse;
|
---|
29 | use Google\Service\AndroidPublisher\SubscriptionOffer;
|
---|
30 |
|
---|
31 | /**
|
---|
32 | * The "offers" collection of methods.
|
---|
33 | * Typical usage is:
|
---|
34 | * <code>
|
---|
35 | * $androidpublisherService = new Google\Service\AndroidPublisher(...);
|
---|
36 | * $offers = $androidpublisherService->monetization_subscriptions_basePlans_offers;
|
---|
37 | * </code>
|
---|
38 | */
|
---|
39 | class MonetizationSubscriptionsBasePlansOffers extends \Google\Service\Resource
|
---|
40 | {
|
---|
41 | /**
|
---|
42 | * Activates a subscription offer. Once activated, subscription offers will be
|
---|
43 | * available to new subscribers. (offers.activate)
|
---|
44 | *
|
---|
45 | * @param string $packageName Required. The parent app (package name) of the
|
---|
46 | * offer to activate.
|
---|
47 | * @param string $productId Required. The parent subscription (ID) of the offer
|
---|
48 | * to activate.
|
---|
49 | * @param string $basePlanId Required. The parent base plan (ID) of the offer to
|
---|
50 | * activate.
|
---|
51 | * @param string $offerId Required. The unique offer ID of the offer to
|
---|
52 | * activate.
|
---|
53 | * @param ActivateSubscriptionOfferRequest $postBody
|
---|
54 | * @param array $optParams Optional parameters.
|
---|
55 | * @return SubscriptionOffer
|
---|
56 | * @throws \Google\Service\Exception
|
---|
57 | */
|
---|
58 | public function activate($packageName, $productId, $basePlanId, $offerId, ActivateSubscriptionOfferRequest $postBody, $optParams = [])
|
---|
59 | {
|
---|
60 | $params = ['packageName' => $packageName, 'productId' => $productId, 'basePlanId' => $basePlanId, 'offerId' => $offerId, 'postBody' => $postBody];
|
---|
61 | $params = array_merge($params, $optParams);
|
---|
62 | return $this->call('activate', [$params], SubscriptionOffer::class);
|
---|
63 | }
|
---|
64 | /**
|
---|
65 | * Reads one or more subscription offers. (offers.batchGet)
|
---|
66 | *
|
---|
67 | * @param string $packageName Required. The parent app (package name) for which
|
---|
68 | * the subscriptions should be created or updated. Must be equal to the
|
---|
69 | * package_name field on all the requests.
|
---|
70 | * @param string $productId Required. The product ID of the parent subscription,
|
---|
71 | * if all updated offers belong to the same subscription. If this request spans
|
---|
72 | * multiple subscriptions, set this field to "-". Must be set.
|
---|
73 | * @param string $basePlanId Required. The parent base plan (ID) for which the
|
---|
74 | * offers should be read. May be specified as '-' to read offers from multiple
|
---|
75 | * base plans.
|
---|
76 | * @param BatchGetSubscriptionOffersRequest $postBody
|
---|
77 | * @param array $optParams Optional parameters.
|
---|
78 | * @return BatchGetSubscriptionOffersResponse
|
---|
79 | * @throws \Google\Service\Exception
|
---|
80 | */
|
---|
81 | public function batchGet($packageName, $productId, $basePlanId, BatchGetSubscriptionOffersRequest $postBody, $optParams = [])
|
---|
82 | {
|
---|
83 | $params = ['packageName' => $packageName, 'productId' => $productId, 'basePlanId' => $basePlanId, 'postBody' => $postBody];
|
---|
84 | $params = array_merge($params, $optParams);
|
---|
85 | return $this->call('batchGet', [$params], BatchGetSubscriptionOffersResponse::class);
|
---|
86 | }
|
---|
87 | /**
|
---|
88 | * Updates a batch of subscription offers. Set the latencyTolerance field on
|
---|
89 | * nested requests to PRODUCT_UPDATE_LATENCY_TOLERANCE_LATENCY_TOLERANT to
|
---|
90 | * achieve maximum update throughput. (offers.batchUpdate)
|
---|
91 | *
|
---|
92 | * @param string $packageName Required. The parent app (package name) of the
|
---|
93 | * updated subscription offers. Must be equal to the package_name field on all
|
---|
94 | * the updated SubscriptionOffer resources.
|
---|
95 | * @param string $productId Required. The product ID of the parent subscription,
|
---|
96 | * if all updated offers belong to the same subscription. If this request spans
|
---|
97 | * multiple subscriptions, set this field to "-". Must be set.
|
---|
98 | * @param string $basePlanId Required. The parent base plan (ID) for which the
|
---|
99 | * offers should be updated. May be specified as '-' to update offers from
|
---|
100 | * multiple base plans.
|
---|
101 | * @param BatchUpdateSubscriptionOffersRequest $postBody
|
---|
102 | * @param array $optParams Optional parameters.
|
---|
103 | * @return BatchUpdateSubscriptionOffersResponse
|
---|
104 | * @throws \Google\Service\Exception
|
---|
105 | */
|
---|
106 | public function batchUpdate($packageName, $productId, $basePlanId, BatchUpdateSubscriptionOffersRequest $postBody, $optParams = [])
|
---|
107 | {
|
---|
108 | $params = ['packageName' => $packageName, 'productId' => $productId, 'basePlanId' => $basePlanId, 'postBody' => $postBody];
|
---|
109 | $params = array_merge($params, $optParams);
|
---|
110 | return $this->call('batchUpdate', [$params], BatchUpdateSubscriptionOffersResponse::class);
|
---|
111 | }
|
---|
112 | /**
|
---|
113 | * Updates a batch of subscription offer states. Set the latencyTolerance field
|
---|
114 | * on nested requests to PRODUCT_UPDATE_LATENCY_TOLERANCE_LATENCY_TOLERANT to
|
---|
115 | * achieve maximum update throughput. (offers.batchUpdateStates)
|
---|
116 | *
|
---|
117 | * @param string $packageName Required. The parent app (package name) of the
|
---|
118 | * updated subscription offers. Must be equal to the package_name field on all
|
---|
119 | * the updated SubscriptionOffer resources.
|
---|
120 | * @param string $productId Required. The product ID of the parent subscription,
|
---|
121 | * if all updated offers belong to the same subscription. If this request spans
|
---|
122 | * multiple subscriptions, set this field to "-". Must be set.
|
---|
123 | * @param string $basePlanId Required. The parent base plan (ID) for which the
|
---|
124 | * offers should be updated. May be specified as '-' to update offers from
|
---|
125 | * multiple base plans.
|
---|
126 | * @param BatchUpdateSubscriptionOfferStatesRequest $postBody
|
---|
127 | * @param array $optParams Optional parameters.
|
---|
128 | * @return BatchUpdateSubscriptionOfferStatesResponse
|
---|
129 | * @throws \Google\Service\Exception
|
---|
130 | */
|
---|
131 | public function batchUpdateStates($packageName, $productId, $basePlanId, BatchUpdateSubscriptionOfferStatesRequest $postBody, $optParams = [])
|
---|
132 | {
|
---|
133 | $params = ['packageName' => $packageName, 'productId' => $productId, 'basePlanId' => $basePlanId, 'postBody' => $postBody];
|
---|
134 | $params = array_merge($params, $optParams);
|
---|
135 | return $this->call('batchUpdateStates', [$params], BatchUpdateSubscriptionOfferStatesResponse::class);
|
---|
136 | }
|
---|
137 | /**
|
---|
138 | * Creates a new subscription offer. Only auto-renewing base plans can have
|
---|
139 | * subscription offers. The offer state will be DRAFT until it is activated.
|
---|
140 | * (offers.create)
|
---|
141 | *
|
---|
142 | * @param string $packageName Required. The parent app (package name) for which
|
---|
143 | * the offer should be created. Must be equal to the package_name field on the
|
---|
144 | * Subscription resource.
|
---|
145 | * @param string $productId Required. The parent subscription (ID) for which the
|
---|
146 | * offer should be created. Must be equal to the product_id field on the
|
---|
147 | * SubscriptionOffer resource.
|
---|
148 | * @param string $basePlanId Required. The parent base plan (ID) for which the
|
---|
149 | * offer should be created. Must be equal to the base_plan_id field on the
|
---|
150 | * SubscriptionOffer resource.
|
---|
151 | * @param SubscriptionOffer $postBody
|
---|
152 | * @param array $optParams Optional parameters.
|
---|
153 | *
|
---|
154 | * @opt_param string offerId Required. The ID to use for the offer. For the
|
---|
155 | * requirements on this format, see the documentation of the offer_id field on
|
---|
156 | * the SubscriptionOffer resource.
|
---|
157 | * @opt_param string regionsVersion.version Required. A string representing the
|
---|
158 | * version of available regions being used for the specified resource. Regional
|
---|
159 | * prices for the resource have to be specified according to the information
|
---|
160 | * published in [this article](https://support.google.com/googleplay/android-
|
---|
161 | * developer/answer/10532353). Each time the supported locations substantially
|
---|
162 | * change, the version will be incremented. Using this field will ensure that
|
---|
163 | * creating and updating the resource with an older region's version and set of
|
---|
164 | * regional prices and currencies will succeed even though a new version is
|
---|
165 | * available. The latest version is 2022/02.
|
---|
166 | * @return SubscriptionOffer
|
---|
167 | * @throws \Google\Service\Exception
|
---|
168 | */
|
---|
169 | public function create($packageName, $productId, $basePlanId, SubscriptionOffer $postBody, $optParams = [])
|
---|
170 | {
|
---|
171 | $params = ['packageName' => $packageName, 'productId' => $productId, 'basePlanId' => $basePlanId, 'postBody' => $postBody];
|
---|
172 | $params = array_merge($params, $optParams);
|
---|
173 | return $this->call('create', [$params], SubscriptionOffer::class);
|
---|
174 | }
|
---|
175 | /**
|
---|
176 | * Deactivates a subscription offer. Once deactivated, existing subscribers will
|
---|
177 | * maintain their subscription, but the offer will become unavailable to new
|
---|
178 | * subscribers. (offers.deactivate)
|
---|
179 | *
|
---|
180 | * @param string $packageName Required. The parent app (package name) of the
|
---|
181 | * offer to deactivate.
|
---|
182 | * @param string $productId Required. The parent subscription (ID) of the offer
|
---|
183 | * to deactivate.
|
---|
184 | * @param string $basePlanId Required. The parent base plan (ID) of the offer to
|
---|
185 | * deactivate.
|
---|
186 | * @param string $offerId Required. The unique offer ID of the offer to
|
---|
187 | * deactivate.
|
---|
188 | * @param DeactivateSubscriptionOfferRequest $postBody
|
---|
189 | * @param array $optParams Optional parameters.
|
---|
190 | * @return SubscriptionOffer
|
---|
191 | * @throws \Google\Service\Exception
|
---|
192 | */
|
---|
193 | public function deactivate($packageName, $productId, $basePlanId, $offerId, DeactivateSubscriptionOfferRequest $postBody, $optParams = [])
|
---|
194 | {
|
---|
195 | $params = ['packageName' => $packageName, 'productId' => $productId, 'basePlanId' => $basePlanId, 'offerId' => $offerId, 'postBody' => $postBody];
|
---|
196 | $params = array_merge($params, $optParams);
|
---|
197 | return $this->call('deactivate', [$params], SubscriptionOffer::class);
|
---|
198 | }
|
---|
199 | /**
|
---|
200 | * Deletes a subscription offer. Can only be done for draft offers. This action
|
---|
201 | * is irreversible. (offers.delete)
|
---|
202 | *
|
---|
203 | * @param string $packageName Required. The parent app (package name) of the
|
---|
204 | * offer to delete.
|
---|
205 | * @param string $productId Required. The parent subscription (ID) of the offer
|
---|
206 | * to delete.
|
---|
207 | * @param string $basePlanId Required. The parent base plan (ID) of the offer to
|
---|
208 | * delete.
|
---|
209 | * @param string $offerId Required. The unique offer ID of the offer to delete.
|
---|
210 | * @param array $optParams Optional parameters.
|
---|
211 | * @throws \Google\Service\Exception
|
---|
212 | */
|
---|
213 | public function delete($packageName, $productId, $basePlanId, $offerId, $optParams = [])
|
---|
214 | {
|
---|
215 | $params = ['packageName' => $packageName, 'productId' => $productId, 'basePlanId' => $basePlanId, 'offerId' => $offerId];
|
---|
216 | $params = array_merge($params, $optParams);
|
---|
217 | return $this->call('delete', [$params]);
|
---|
218 | }
|
---|
219 | /**
|
---|
220 | * Reads a single offer (offers.get)
|
---|
221 | *
|
---|
222 | * @param string $packageName Required. The parent app (package name) of the
|
---|
223 | * offer to get.
|
---|
224 | * @param string $productId Required. The parent subscription (ID) of the offer
|
---|
225 | * to get.
|
---|
226 | * @param string $basePlanId Required. The parent base plan (ID) of the offer to
|
---|
227 | * get.
|
---|
228 | * @param string $offerId Required. The unique offer ID of the offer to get.
|
---|
229 | * @param array $optParams Optional parameters.
|
---|
230 | * @return SubscriptionOffer
|
---|
231 | * @throws \Google\Service\Exception
|
---|
232 | */
|
---|
233 | public function get($packageName, $productId, $basePlanId, $offerId, $optParams = [])
|
---|
234 | {
|
---|
235 | $params = ['packageName' => $packageName, 'productId' => $productId, 'basePlanId' => $basePlanId, 'offerId' => $offerId];
|
---|
236 | $params = array_merge($params, $optParams);
|
---|
237 | return $this->call('get', [$params], SubscriptionOffer::class);
|
---|
238 | }
|
---|
239 | /**
|
---|
240 | * Lists all offers under a given subscription.
|
---|
241 | * (offers.listMonetizationSubscriptionsBasePlansOffers)
|
---|
242 | *
|
---|
243 | * @param string $packageName Required. The parent app (package name) for which
|
---|
244 | * the subscriptions should be read.
|
---|
245 | * @param string $productId Required. The parent subscription (ID) for which the
|
---|
246 | * offers should be read. May be specified as '-' to read all offers under an
|
---|
247 | * app.
|
---|
248 | * @param string $basePlanId Required. The parent base plan (ID) for which the
|
---|
249 | * offers should be read. May be specified as '-' to read all offers under a
|
---|
250 | * subscription or an app. Must be specified as '-' if product_id is specified
|
---|
251 | * as '-'.
|
---|
252 | * @param array $optParams Optional parameters.
|
---|
253 | *
|
---|
254 | * @opt_param int pageSize The maximum number of subscriptions to return. The
|
---|
255 | * service may return fewer than this value. If unspecified, at most 50
|
---|
256 | * subscriptions will be returned. The maximum value is 1000; values above 1000
|
---|
257 | * will be coerced to 1000.
|
---|
258 | * @opt_param string pageToken A page token, received from a previous
|
---|
259 | * `ListSubscriptionsOffers` call. Provide this to retrieve the subsequent page.
|
---|
260 | * When paginating, all other parameters provided to `ListSubscriptionOffers`
|
---|
261 | * must match the call that provided the page token.
|
---|
262 | * @return ListSubscriptionOffersResponse
|
---|
263 | * @throws \Google\Service\Exception
|
---|
264 | */
|
---|
265 | public function listMonetizationSubscriptionsBasePlansOffers($packageName, $productId, $basePlanId, $optParams = [])
|
---|
266 | {
|
---|
267 | $params = ['packageName' => $packageName, 'productId' => $productId, 'basePlanId' => $basePlanId];
|
---|
268 | $params = array_merge($params, $optParams);
|
---|
269 | return $this->call('list', [$params], ListSubscriptionOffersResponse::class);
|
---|
270 | }
|
---|
271 | /**
|
---|
272 | * Updates an existing subscription offer. (offers.patch)
|
---|
273 | *
|
---|
274 | * @param string $packageName Required. Immutable. The package name of the app
|
---|
275 | * the parent subscription belongs to.
|
---|
276 | * @param string $productId Required. Immutable. The ID of the parent
|
---|
277 | * subscription this offer belongs to.
|
---|
278 | * @param string $basePlanId Required. Immutable. The ID of the base plan to
|
---|
279 | * which this offer is an extension.
|
---|
280 | * @param string $offerId Required. Immutable. Unique ID of this subscription
|
---|
281 | * offer. Must be unique within the base plan.
|
---|
282 | * @param SubscriptionOffer $postBody
|
---|
283 | * @param array $optParams Optional parameters.
|
---|
284 | *
|
---|
285 | * @opt_param bool allowMissing Optional. If set to true, and the subscription
|
---|
286 | * offer with the given package_name, product_id, base_plan_id and offer_id
|
---|
287 | * doesn't exist, an offer will be created. If a new offer is created,
|
---|
288 | * update_mask is ignored.
|
---|
289 | * @opt_param string latencyTolerance Optional. The latency tolerance for the
|
---|
290 | * propagation of this product update. Defaults to latency-sensitive.
|
---|
291 | * @opt_param string regionsVersion.version Required. A string representing the
|
---|
292 | * version of available regions being used for the specified resource. Regional
|
---|
293 | * prices for the resource have to be specified according to the information
|
---|
294 | * published in [this article](https://support.google.com/googleplay/android-
|
---|
295 | * developer/answer/10532353). Each time the supported locations substantially
|
---|
296 | * change, the version will be incremented. Using this field will ensure that
|
---|
297 | * creating and updating the resource with an older region's version and set of
|
---|
298 | * regional prices and currencies will succeed even though a new version is
|
---|
299 | * available. The latest version is 2022/02.
|
---|
300 | * @opt_param string updateMask Required. The list of fields to be updated.
|
---|
301 | * @return SubscriptionOffer
|
---|
302 | * @throws \Google\Service\Exception
|
---|
303 | */
|
---|
304 | public function patch($packageName, $productId, $basePlanId, $offerId, SubscriptionOffer $postBody, $optParams = [])
|
---|
305 | {
|
---|
306 | $params = ['packageName' => $packageName, 'productId' => $productId, 'basePlanId' => $basePlanId, 'offerId' => $offerId, 'postBody' => $postBody];
|
---|
307 | $params = array_merge($params, $optParams);
|
---|
308 | return $this->call('patch', [$params], SubscriptionOffer::class);
|
---|
309 | }
|
---|
310 | }
|
---|
311 |
|
---|
312 | // Adding a class alias for backwards compatibility with the previous class name.
|
---|
313 | class_alias(MonetizationSubscriptionsBasePlansOffers::class, 'Google_Service_AndroidPublisher_Resource_MonetizationSubscriptionsBasePlansOffers');
|
---|