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\ArchiveSubscriptionRequest;
|
---|
21 | use Google\Service\AndroidPublisher\BatchGetSubscriptionsResponse;
|
---|
22 | use Google\Service\AndroidPublisher\BatchUpdateSubscriptionsRequest;
|
---|
23 | use Google\Service\AndroidPublisher\BatchUpdateSubscriptionsResponse;
|
---|
24 | use Google\Service\AndroidPublisher\ListSubscriptionsResponse;
|
---|
25 | use Google\Service\AndroidPublisher\Subscription;
|
---|
26 |
|
---|
27 | /**
|
---|
28 | * The "subscriptions" collection of methods.
|
---|
29 | * Typical usage is:
|
---|
30 | * <code>
|
---|
31 | * $androidpublisherService = new Google\Service\AndroidPublisher(...);
|
---|
32 | * $subscriptions = $androidpublisherService->monetization_subscriptions;
|
---|
33 | * </code>
|
---|
34 | */
|
---|
35 | class MonetizationSubscriptions extends \Google\Service\Resource
|
---|
36 | {
|
---|
37 | /**
|
---|
38 | * Deprecated: subscription archiving is not supported. (subscriptions.archive)
|
---|
39 | *
|
---|
40 | * @param string $packageName Required. The parent app (package name) of the app
|
---|
41 | * of the subscription to delete.
|
---|
42 | * @param string $productId Required. The unique product ID of the subscription
|
---|
43 | * to delete.
|
---|
44 | * @param ArchiveSubscriptionRequest $postBody
|
---|
45 | * @param array $optParams Optional parameters.
|
---|
46 | * @return Subscription
|
---|
47 | * @throws \Google\Service\Exception
|
---|
48 | */
|
---|
49 | public function archive($packageName, $productId, ArchiveSubscriptionRequest $postBody, $optParams = [])
|
---|
50 | {
|
---|
51 | $params = ['packageName' => $packageName, 'productId' => $productId, 'postBody' => $postBody];
|
---|
52 | $params = array_merge($params, $optParams);
|
---|
53 | return $this->call('archive', [$params], Subscription::class);
|
---|
54 | }
|
---|
55 | /**
|
---|
56 | * Reads one or more subscriptions. (subscriptions.batchGet)
|
---|
57 | *
|
---|
58 | * @param string $packageName Required. The parent app (package name) for which
|
---|
59 | * the subscriptions should be retrieved. Must be equal to the package_name
|
---|
60 | * field on all the requests.
|
---|
61 | * @param array $optParams Optional parameters.
|
---|
62 | *
|
---|
63 | * @opt_param string productIds Required. A list of up to 100 subscription
|
---|
64 | * product IDs to retrieve. All the IDs must be different.
|
---|
65 | * @return BatchGetSubscriptionsResponse
|
---|
66 | * @throws \Google\Service\Exception
|
---|
67 | */
|
---|
68 | public function batchGet($packageName, $optParams = [])
|
---|
69 | {
|
---|
70 | $params = ['packageName' => $packageName];
|
---|
71 | $params = array_merge($params, $optParams);
|
---|
72 | return $this->call('batchGet', [$params], BatchGetSubscriptionsResponse::class);
|
---|
73 | }
|
---|
74 | /**
|
---|
75 | * Updates a batch of subscriptions. Set the latencyTolerance field on nested
|
---|
76 | * requests to PRODUCT_UPDATE_LATENCY_TOLERANCE_LATENCY_TOLERANT to achieve
|
---|
77 | * maximum update throughput. (subscriptions.batchUpdate)
|
---|
78 | *
|
---|
79 | * @param string $packageName Required. The parent app (package name) for which
|
---|
80 | * the subscriptions should be updated. Must be equal to the package_name field
|
---|
81 | * on all the Subscription resources.
|
---|
82 | * @param BatchUpdateSubscriptionsRequest $postBody
|
---|
83 | * @param array $optParams Optional parameters.
|
---|
84 | * @return BatchUpdateSubscriptionsResponse
|
---|
85 | * @throws \Google\Service\Exception
|
---|
86 | */
|
---|
87 | public function batchUpdate($packageName, BatchUpdateSubscriptionsRequest $postBody, $optParams = [])
|
---|
88 | {
|
---|
89 | $params = ['packageName' => $packageName, 'postBody' => $postBody];
|
---|
90 | $params = array_merge($params, $optParams);
|
---|
91 | return $this->call('batchUpdate', [$params], BatchUpdateSubscriptionsResponse::class);
|
---|
92 | }
|
---|
93 | /**
|
---|
94 | * Creates a new subscription. Newly added base plans will remain in draft state
|
---|
95 | * until activated. (subscriptions.create)
|
---|
96 | *
|
---|
97 | * @param string $packageName Required. The parent app (package name) for which
|
---|
98 | * the subscription should be created. Must be equal to the package_name field
|
---|
99 | * on the Subscription resource.
|
---|
100 | * @param Subscription $postBody
|
---|
101 | * @param array $optParams Optional parameters.
|
---|
102 | *
|
---|
103 | * @opt_param string productId Required. The ID to use for the subscription. For
|
---|
104 | * the requirements on this format, see the documentation of the product_id
|
---|
105 | * field on the Subscription resource.
|
---|
106 | * @opt_param string regionsVersion.version Required. A string representing the
|
---|
107 | * version of available regions being used for the specified resource. Regional
|
---|
108 | * prices for the resource have to be specified according to the information
|
---|
109 | * published in [this article](https://support.google.com/googleplay/android-
|
---|
110 | * developer/answer/10532353). Each time the supported locations substantially
|
---|
111 | * change, the version will be incremented. Using this field will ensure that
|
---|
112 | * creating and updating the resource with an older region's version and set of
|
---|
113 | * regional prices and currencies will succeed even though a new version is
|
---|
114 | * available. The latest version is 2022/02.
|
---|
115 | * @return Subscription
|
---|
116 | * @throws \Google\Service\Exception
|
---|
117 | */
|
---|
118 | public function create($packageName, Subscription $postBody, $optParams = [])
|
---|
119 | {
|
---|
120 | $params = ['packageName' => $packageName, 'postBody' => $postBody];
|
---|
121 | $params = array_merge($params, $optParams);
|
---|
122 | return $this->call('create', [$params], Subscription::class);
|
---|
123 | }
|
---|
124 | /**
|
---|
125 | * Deletes a subscription. A subscription can only be deleted if it has never
|
---|
126 | * had a base plan published. (subscriptions.delete)
|
---|
127 | *
|
---|
128 | * @param string $packageName Required. The parent app (package name) of the app
|
---|
129 | * of the subscription to delete.
|
---|
130 | * @param string $productId Required. The unique product ID of the subscription
|
---|
131 | * to delete.
|
---|
132 | * @param array $optParams Optional parameters.
|
---|
133 | * @throws \Google\Service\Exception
|
---|
134 | */
|
---|
135 | public function delete($packageName, $productId, $optParams = [])
|
---|
136 | {
|
---|
137 | $params = ['packageName' => $packageName, 'productId' => $productId];
|
---|
138 | $params = array_merge($params, $optParams);
|
---|
139 | return $this->call('delete', [$params]);
|
---|
140 | }
|
---|
141 | /**
|
---|
142 | * Reads a single subscription. (subscriptions.get)
|
---|
143 | *
|
---|
144 | * @param string $packageName Required. The parent app (package name) of the
|
---|
145 | * subscription to get.
|
---|
146 | * @param string $productId Required. The unique product ID of the subscription
|
---|
147 | * to get.
|
---|
148 | * @param array $optParams Optional parameters.
|
---|
149 | * @return Subscription
|
---|
150 | * @throws \Google\Service\Exception
|
---|
151 | */
|
---|
152 | public function get($packageName, $productId, $optParams = [])
|
---|
153 | {
|
---|
154 | $params = ['packageName' => $packageName, 'productId' => $productId];
|
---|
155 | $params = array_merge($params, $optParams);
|
---|
156 | return $this->call('get', [$params], Subscription::class);
|
---|
157 | }
|
---|
158 | /**
|
---|
159 | * Lists all subscriptions under a given app.
|
---|
160 | * (subscriptions.listMonetizationSubscriptions)
|
---|
161 | *
|
---|
162 | * @param string $packageName Required. The parent app (package name) for which
|
---|
163 | * the subscriptions should be read.
|
---|
164 | * @param array $optParams Optional parameters.
|
---|
165 | *
|
---|
166 | * @opt_param int pageSize The maximum number of subscriptions to return. The
|
---|
167 | * service may return fewer than this value. If unspecified, at most 50
|
---|
168 | * subscriptions will be returned. The maximum value is 1000; values above 1000
|
---|
169 | * will be coerced to 1000.
|
---|
170 | * @opt_param string pageToken A page token, received from a previous
|
---|
171 | * `ListSubscriptions` call. Provide this to retrieve the subsequent page. When
|
---|
172 | * paginating, all other parameters provided to `ListSubscriptions` must match
|
---|
173 | * the call that provided the page token.
|
---|
174 | * @opt_param bool showArchived Deprecated: subscription archiving is not
|
---|
175 | * supported.
|
---|
176 | * @return ListSubscriptionsResponse
|
---|
177 | * @throws \Google\Service\Exception
|
---|
178 | */
|
---|
179 | public function listMonetizationSubscriptions($packageName, $optParams = [])
|
---|
180 | {
|
---|
181 | $params = ['packageName' => $packageName];
|
---|
182 | $params = array_merge($params, $optParams);
|
---|
183 | return $this->call('list', [$params], ListSubscriptionsResponse::class);
|
---|
184 | }
|
---|
185 | /**
|
---|
186 | * Updates an existing subscription. (subscriptions.patch)
|
---|
187 | *
|
---|
188 | * @param string $packageName Immutable. Package name of the parent app.
|
---|
189 | * @param string $productId Immutable. Unique product ID of the product. Unique
|
---|
190 | * within the parent app. Product IDs must be composed of lower-case letters
|
---|
191 | * (a-z), numbers (0-9), underscores (_) and dots (.). It must start with a
|
---|
192 | * lower-case letter or number, and be between 1 and 40 (inclusive) characters
|
---|
193 | * in length.
|
---|
194 | * @param Subscription $postBody
|
---|
195 | * @param array $optParams Optional parameters.
|
---|
196 | *
|
---|
197 | * @opt_param bool allowMissing Optional. If set to true, and the subscription
|
---|
198 | * with the given package_name and product_id doesn't exist, the subscription
|
---|
199 | * will be created. If a new subscription is created, update_mask is ignored.
|
---|
200 | * @opt_param string latencyTolerance Optional. The latency tolerance for the
|
---|
201 | * propagation of this product update. Defaults to latency-sensitive.
|
---|
202 | * @opt_param string regionsVersion.version Required. A string representing the
|
---|
203 | * version of available regions being used for the specified resource. Regional
|
---|
204 | * prices for the resource have to be specified according to the information
|
---|
205 | * published in [this article](https://support.google.com/googleplay/android-
|
---|
206 | * developer/answer/10532353). Each time the supported locations substantially
|
---|
207 | * change, the version will be incremented. Using this field will ensure that
|
---|
208 | * creating and updating the resource with an older region's version and set of
|
---|
209 | * regional prices and currencies will succeed even though a new version is
|
---|
210 | * available. The latest version is 2022/02.
|
---|
211 | * @opt_param string updateMask Required. The list of fields to be updated.
|
---|
212 | * @return Subscription
|
---|
213 | * @throws \Google\Service\Exception
|
---|
214 | */
|
---|
215 | public function patch($packageName, $productId, Subscription $postBody, $optParams = [])
|
---|
216 | {
|
---|
217 | $params = ['packageName' => $packageName, 'productId' => $productId, 'postBody' => $postBody];
|
---|
218 | $params = array_merge($params, $optParams);
|
---|
219 | return $this->call('patch', [$params], Subscription::class);
|
---|
220 | }
|
---|
221 | }
|
---|
222 |
|
---|
223 | // Adding a class alias for backwards compatibility with the previous class name.
|
---|
224 | class_alias(MonetizationSubscriptions::class, 'Google_Service_AndroidPublisher_Resource_MonetizationSubscriptions');
|
---|