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