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\PaymentsResellerSubscription\Resource;
|
---|
19 |
|
---|
20 | use Google\Service\PaymentsResellerSubscription\GoogleCloudPaymentsResellerSubscriptionV1CancelSubscriptionRequest;
|
---|
21 | use Google\Service\PaymentsResellerSubscription\GoogleCloudPaymentsResellerSubscriptionV1CancelSubscriptionResponse;
|
---|
22 | use Google\Service\PaymentsResellerSubscription\GoogleCloudPaymentsResellerSubscriptionV1EntitleSubscriptionRequest;
|
---|
23 | use Google\Service\PaymentsResellerSubscription\GoogleCloudPaymentsResellerSubscriptionV1EntitleSubscriptionResponse;
|
---|
24 | use Google\Service\PaymentsResellerSubscription\GoogleCloudPaymentsResellerSubscriptionV1ExtendSubscriptionRequest;
|
---|
25 | use Google\Service\PaymentsResellerSubscription\GoogleCloudPaymentsResellerSubscriptionV1ExtendSubscriptionResponse;
|
---|
26 | use Google\Service\PaymentsResellerSubscription\GoogleCloudPaymentsResellerSubscriptionV1Subscription;
|
---|
27 | use Google\Service\PaymentsResellerSubscription\GoogleCloudPaymentsResellerSubscriptionV1UndoCancelSubscriptionRequest;
|
---|
28 | use Google\Service\PaymentsResellerSubscription\GoogleCloudPaymentsResellerSubscriptionV1UndoCancelSubscriptionResponse;
|
---|
29 |
|
---|
30 | /**
|
---|
31 | * The "subscriptions" collection of methods.
|
---|
32 | * Typical usage is:
|
---|
33 | * <code>
|
---|
34 | * $paymentsresellersubscriptionService = new Google\Service\PaymentsResellerSubscription(...);
|
---|
35 | * $subscriptions = $paymentsresellersubscriptionService->partners_subscriptions;
|
---|
36 | * </code>
|
---|
37 | */
|
---|
38 | class PartnersSubscriptions extends \Google\Service\Resource
|
---|
39 | {
|
---|
40 | /**
|
---|
41 | * Used by partners to cancel a subscription service either immediately or by
|
---|
42 | * the end of the current billing cycle for their customers. It should be called
|
---|
43 | * directly by the partner using service accounts. (subscriptions.cancel)
|
---|
44 | *
|
---|
45 | * @param string $name Required. The name of the subscription resource to be
|
---|
46 | * cancelled. It will have the format of
|
---|
47 | * "partners/{partner_id}/subscriptions/{subscription_id}"
|
---|
48 | * @param GoogleCloudPaymentsResellerSubscriptionV1CancelSubscriptionRequest $postBody
|
---|
49 | * @param array $optParams Optional parameters.
|
---|
50 | * @return GoogleCloudPaymentsResellerSubscriptionV1CancelSubscriptionResponse
|
---|
51 | * @throws \Google\Service\Exception
|
---|
52 | */
|
---|
53 | public function cancel($name, GoogleCloudPaymentsResellerSubscriptionV1CancelSubscriptionRequest $postBody, $optParams = [])
|
---|
54 | {
|
---|
55 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
56 | $params = array_merge($params, $optParams);
|
---|
57 | return $this->call('cancel', [$params], GoogleCloudPaymentsResellerSubscriptionV1CancelSubscriptionResponse::class);
|
---|
58 | }
|
---|
59 | /**
|
---|
60 | * Used by partners to create a subscription for their customers. The created
|
---|
61 | * subscription is associated with the end user inferred from the end user
|
---|
62 | * credentials. This API must be authorized by the end user using OAuth.
|
---|
63 | * (subscriptions.create)
|
---|
64 | *
|
---|
65 | * @param string $parent Required. The parent resource name, which is the
|
---|
66 | * identifier of the partner. It will have the format of
|
---|
67 | * "partners/{partner_id}".
|
---|
68 | * @param GoogleCloudPaymentsResellerSubscriptionV1Subscription $postBody
|
---|
69 | * @param array $optParams Optional parameters.
|
---|
70 | *
|
---|
71 | * @opt_param string subscriptionId Required. Identifies the subscription
|
---|
72 | * resource on the Partner side. The value is restricted to 63 ASCII characters
|
---|
73 | * at the maximum. If a subscription was previously created with the same
|
---|
74 | * subscription_id, we will directly return that one.
|
---|
75 | * @return GoogleCloudPaymentsResellerSubscriptionV1Subscription
|
---|
76 | * @throws \Google\Service\Exception
|
---|
77 | */
|
---|
78 | public function create($parent, GoogleCloudPaymentsResellerSubscriptionV1Subscription $postBody, $optParams = [])
|
---|
79 | {
|
---|
80 | $params = ['parent' => $parent, 'postBody' => $postBody];
|
---|
81 | $params = array_merge($params, $optParams);
|
---|
82 | return $this->call('create', [$params], GoogleCloudPaymentsResellerSubscriptionV1Subscription::class);
|
---|
83 | }
|
---|
84 | /**
|
---|
85 | * Used by partners to entitle a previously provisioned subscription to the
|
---|
86 | * current end user. The end user identity is inferred from the authorized
|
---|
87 | * credential of the request. This API must be authorized by the end user using
|
---|
88 | * OAuth. (subscriptions.entitle)
|
---|
89 | *
|
---|
90 | * @param string $name Required. The name of the subscription resource that is
|
---|
91 | * entitled to the current end user. It will have the format of
|
---|
92 | * "partners/{partner_id}/subscriptions/{subscription_id}"
|
---|
93 | * @param GoogleCloudPaymentsResellerSubscriptionV1EntitleSubscriptionRequest $postBody
|
---|
94 | * @param array $optParams Optional parameters.
|
---|
95 | * @return GoogleCloudPaymentsResellerSubscriptionV1EntitleSubscriptionResponse
|
---|
96 | * @throws \Google\Service\Exception
|
---|
97 | */
|
---|
98 | public function entitle($name, GoogleCloudPaymentsResellerSubscriptionV1EntitleSubscriptionRequest $postBody, $optParams = [])
|
---|
99 | {
|
---|
100 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
101 | $params = array_merge($params, $optParams);
|
---|
102 | return $this->call('entitle', [$params], GoogleCloudPaymentsResellerSubscriptionV1EntitleSubscriptionResponse::class);
|
---|
103 | }
|
---|
104 | /**
|
---|
105 | * [Opt-in only] Most partners should be on auto-extend by default. Used by
|
---|
106 | * partners to extend a subscription service for their customers on an ongoing
|
---|
107 | * basis for the subscription to remain active and renewable. It should be
|
---|
108 | * called directly by the partner using service accounts. (subscriptions.extend)
|
---|
109 | *
|
---|
110 | * @param string $name Required. The name of the subscription resource to be
|
---|
111 | * extended. It will have the format of
|
---|
112 | * "partners/{partner_id}/subscriptions/{subscription_id}".
|
---|
113 | * @param GoogleCloudPaymentsResellerSubscriptionV1ExtendSubscriptionRequest $postBody
|
---|
114 | * @param array $optParams Optional parameters.
|
---|
115 | * @return GoogleCloudPaymentsResellerSubscriptionV1ExtendSubscriptionResponse
|
---|
116 | * @throws \Google\Service\Exception
|
---|
117 | */
|
---|
118 | public function extend($name, GoogleCloudPaymentsResellerSubscriptionV1ExtendSubscriptionRequest $postBody, $optParams = [])
|
---|
119 | {
|
---|
120 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
121 | $params = array_merge($params, $optParams);
|
---|
122 | return $this->call('extend', [$params], GoogleCloudPaymentsResellerSubscriptionV1ExtendSubscriptionResponse::class);
|
---|
123 | }
|
---|
124 | /**
|
---|
125 | * Used by partners to get a subscription by id. It should be called directly by
|
---|
126 | * the partner using service accounts. (subscriptions.get)
|
---|
127 | *
|
---|
128 | * @param string $name Required. The name of the subscription resource to
|
---|
129 | * retrieve. It will have the format of
|
---|
130 | * "partners/{partner_id}/subscriptions/{subscription_id}"
|
---|
131 | * @param array $optParams Optional parameters.
|
---|
132 | * @return GoogleCloudPaymentsResellerSubscriptionV1Subscription
|
---|
133 | * @throws \Google\Service\Exception
|
---|
134 | */
|
---|
135 | public function get($name, $optParams = [])
|
---|
136 | {
|
---|
137 | $params = ['name' => $name];
|
---|
138 | $params = array_merge($params, $optParams);
|
---|
139 | return $this->call('get', [$params], GoogleCloudPaymentsResellerSubscriptionV1Subscription::class);
|
---|
140 | }
|
---|
141 | /**
|
---|
142 | * Used by partners to provision a subscription for their customers. This
|
---|
143 | * creates a subscription without associating it with the end user account.
|
---|
144 | * EntitleSubscription must be called separately using OAuth in order for the
|
---|
145 | * end user account to be associated with the subscription. It should be called
|
---|
146 | * directly by the partner using service accounts. (subscriptions.provision)
|
---|
147 | *
|
---|
148 | * @param string $parent Required. The parent resource name, which is the
|
---|
149 | * identifier of the partner. It will have the format of
|
---|
150 | * "partners/{partner_id}".
|
---|
151 | * @param GoogleCloudPaymentsResellerSubscriptionV1Subscription $postBody
|
---|
152 | * @param array $optParams Optional parameters.
|
---|
153 | *
|
---|
154 | * @opt_param string subscriptionId Required. Identifies the subscription
|
---|
155 | * resource on the Partner side. The value is restricted to 63 ASCII characters
|
---|
156 | * at the maximum. If a subscription was previously created with the same
|
---|
157 | * subscription_id, we will directly return that one.
|
---|
158 | * @return GoogleCloudPaymentsResellerSubscriptionV1Subscription
|
---|
159 | * @throws \Google\Service\Exception
|
---|
160 | */
|
---|
161 | public function provision($parent, GoogleCloudPaymentsResellerSubscriptionV1Subscription $postBody, $optParams = [])
|
---|
162 | {
|
---|
163 | $params = ['parent' => $parent, 'postBody' => $postBody];
|
---|
164 | $params = array_merge($params, $optParams);
|
---|
165 | return $this->call('provision', [$params], GoogleCloudPaymentsResellerSubscriptionV1Subscription::class);
|
---|
166 | }
|
---|
167 | /**
|
---|
168 | * Revokes the pending cancellation of a subscription, which is currently in
|
---|
169 | * `STATE_CANCEL_AT_END_OF_CYCLE` state. If the subscription is already
|
---|
170 | * cancelled, the request will fail. - **This API doesn't apply to YouTube
|
---|
171 | * subscriptions.** It should be called directly by the partner using service
|
---|
172 | * accounts. (subscriptions.undoCancel)
|
---|
173 | *
|
---|
174 | * @param string $name Required. The name of the subscription resource whose
|
---|
175 | * pending cancellation needs to be undone. It will have the format of
|
---|
176 | * "partners/{partner_id}/subscriptions/{subscription_id}"
|
---|
177 | * @param GoogleCloudPaymentsResellerSubscriptionV1UndoCancelSubscriptionRequest $postBody
|
---|
178 | * @param array $optParams Optional parameters.
|
---|
179 | * @return GoogleCloudPaymentsResellerSubscriptionV1UndoCancelSubscriptionResponse
|
---|
180 | * @throws \Google\Service\Exception
|
---|
181 | */
|
---|
182 | public function undoCancel($name, GoogleCloudPaymentsResellerSubscriptionV1UndoCancelSubscriptionRequest $postBody, $optParams = [])
|
---|
183 | {
|
---|
184 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
185 | $params = array_merge($params, $optParams);
|
---|
186 | return $this->call('undoCancel', [$params], GoogleCloudPaymentsResellerSubscriptionV1UndoCancelSubscriptionResponse::class);
|
---|
187 | }
|
---|
188 | }
|
---|
189 |
|
---|
190 | // Adding a class alias for backwards compatibility with the previous class name.
|
---|
191 | class_alias(PartnersSubscriptions::class, 'Google_Service_PaymentsResellerSubscription_Resource_PartnersSubscriptions');
|
---|