1<?php 2/* 3 * Licensed under the Apache License, Version 2.0 (the "License"); you may not 4 * use this file except in compliance with the License. You may obtain a copy of 5 * the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 11 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 12 * License for the specific language governing permissions and limitations under 13 * the License. 14 */ 15 16 17 /** 18 * The "inapppurchases" collection of methods. 19 * Typical usage is: 20 * <code> 21 * $androidpublisherService = new Google_AndroidPublisherService(...); 22 * $inapppurchases = $androidpublisherService->inapppurchases; 23 * </code> 24 */ 25 class Google_InapppurchasesServiceResource extends Google_ServiceResource { 26 27 /** 28 * Checks the purchase and consumption status of an inapp item. (inapppurchases.get) 29 * 30 * @param string $packageName The package name of the application the inapp product was sold in (for example, 'com.some.thing'). 31 * @param string $productId The inapp product SKU (for example, 'com.some.thing.inapp1'). 32 * @param string $token The token provided to the user's device when the inapp product was purchased. 33 * @param array $optParams Optional parameters. 34 * @return Google_InappPurchase 35 */ 36 public function get($packageName, $productId, $token, $optParams = array()) { 37 $params = array('packageName' => $packageName, 'productId' => $productId, 'token' => $token); 38 $params = array_merge($params, $optParams); 39 $data = $this->__call('get', array($params)); 40 if ($this->useObjects()) { 41 return new Google_InappPurchase($data); 42 } else { 43 return $data; 44 } 45 } 46 } 47 48 /** 49 * The "purchases" collection of methods. 50 * Typical usage is: 51 * <code> 52 * $androidpublisherService = new Google_AndroidPublisherService(...); 53 * $purchases = $androidpublisherService->purchases; 54 * </code> 55 */ 56 class Google_PurchasesServiceResource extends Google_ServiceResource { 57 58 /** 59 * Cancels a user's subscription purchase. The subscription remains valid until its expiration time. 60 * (purchases.cancel) 61 * 62 * @param string $packageName The package name of the application for which this subscription was purchased (for example, 'com.some.thing'). 63 * @param string $subscriptionId The purchased subscription ID (for example, 'monthly001'). 64 * @param string $token The token provided to the user's device when the subscription was purchased. 65 * @param array $optParams Optional parameters. 66 */ 67 public function cancel($packageName, $subscriptionId, $token, $optParams = array()) { 68 $params = array('packageName' => $packageName, 'subscriptionId' => $subscriptionId, 'token' => $token); 69 $params = array_merge($params, $optParams); 70 $data = $this->__call('cancel', array($params)); 71 return $data; 72 } 73 /** 74 * Checks whether a user's subscription purchase is valid and returns its expiry time. 75 * (purchases.get) 76 * 77 * @param string $packageName The package name of the application for which this subscription was purchased (for example, 'com.some.thing'). 78 * @param string $subscriptionId The purchased subscription ID (for example, 'monthly001'). 79 * @param string $token The token provided to the user's device when the subscription was purchased. 80 * @param array $optParams Optional parameters. 81 * @return Google_SubscriptionPurchase 82 */ 83 public function get($packageName, $subscriptionId, $token, $optParams = array()) { 84 $params = array('packageName' => $packageName, 'subscriptionId' => $subscriptionId, 'token' => $token); 85 $params = array_merge($params, $optParams); 86 $data = $this->__call('get', array($params)); 87 if ($this->useObjects()) { 88 return new Google_SubscriptionPurchase($data); 89 } else { 90 return $data; 91 } 92 } 93 } 94 95/** 96 * Service definition for Google_AndroidPublisher (v1.1). 97 * 98 * <p> 99 * Lets Android application developers access their Google Play accounts. 100 * </p> 101 * 102 * <p> 103 * For more information about this service, see the 104 * <a href="https://developers.google.com/android-publisher" target="_blank">API Documentation</a> 105 * </p> 106 * 107 * @author Google, Inc. 108 */ 109class Google_AndroidPublisherService extends Google_Service { 110 public $inapppurchases; 111 public $purchases; 112 /** 113 * Constructs the internal representation of the AndroidPublisher service. 114 * 115 * @param Google_Client $client 116 */ 117 public function __construct(Google_Client $client) { 118 $this->servicePath = 'androidpublisher/v1.1/applications/'; 119 $this->version = 'v1.1'; 120 $this->serviceName = 'androidpublisher'; 121 122 $client->addService($this->serviceName, $this->version); 123 $this->inapppurchases = new Google_InapppurchasesServiceResource($this, $this->serviceName, 'inapppurchases', json_decode('{"methods": {"get": {"id": "androidpublisher.inapppurchases.get", "path": "{packageName}/inapp/{productId}/purchases/{token}", "httpMethod": "GET", "parameters": {"packageName": {"type": "string", "required": true, "location": "path"}, "productId": {"type": "string", "required": true, "location": "path"}, "token": {"type": "string", "required": true, "location": "path"}}, "response": {"$ref": "InappPurchase"}}}}', true)); 124 $this->purchases = new Google_PurchasesServiceResource($this, $this->serviceName, 'purchases', json_decode('{"methods": {"cancel": {"id": "androidpublisher.purchases.cancel", "path": "{packageName}/subscriptions/{subscriptionId}/purchases/{token}/cancel", "httpMethod": "POST", "parameters": {"packageName": {"type": "string", "required": true, "location": "path"}, "subscriptionId": {"type": "string", "required": true, "location": "path"}, "token": {"type": "string", "required": true, "location": "path"}}}, "get": {"id": "androidpublisher.purchases.get", "path": "{packageName}/subscriptions/{subscriptionId}/purchases/{token}", "httpMethod": "GET", "parameters": {"packageName": {"type": "string", "required": true, "location": "path"}, "subscriptionId": {"type": "string", "required": true, "location": "path"}, "token": {"type": "string", "required": true, "location": "path"}}, "response": {"$ref": "SubscriptionPurchase"}}}}', true)); 125 126 } 127} 128 129 130 131class Google_InappPurchase extends Google_Model { 132 public $consumptionState; 133 public $developerPayload; 134 public $kind; 135 public $purchaseState; 136 public $purchaseTime; 137 public function setConsumptionState( $consumptionState) { 138 $this->consumptionState = $consumptionState; 139 } 140 public function getConsumptionState() { 141 return $this->consumptionState; 142 } 143 public function setDeveloperPayload( $developerPayload) { 144 $this->developerPayload = $developerPayload; 145 } 146 public function getDeveloperPayload() { 147 return $this->developerPayload; 148 } 149 public function setKind( $kind) { 150 $this->kind = $kind; 151 } 152 public function getKind() { 153 return $this->kind; 154 } 155 public function setPurchaseState( $purchaseState) { 156 $this->purchaseState = $purchaseState; 157 } 158 public function getPurchaseState() { 159 return $this->purchaseState; 160 } 161 public function setPurchaseTime( $purchaseTime) { 162 $this->purchaseTime = $purchaseTime; 163 } 164 public function getPurchaseTime() { 165 return $this->purchaseTime; 166 } 167} 168 169class Google_SubscriptionPurchase extends Google_Model { 170 public $autoRenewing; 171 public $initiationTimestampMsec; 172 public $kind; 173 public $validUntilTimestampMsec; 174 public function setAutoRenewing( $autoRenewing) { 175 $this->autoRenewing = $autoRenewing; 176 } 177 public function getAutoRenewing() { 178 return $this->autoRenewing; 179 } 180 public function setInitiationTimestampMsec( $initiationTimestampMsec) { 181 $this->initiationTimestampMsec = $initiationTimestampMsec; 182 } 183 public function getInitiationTimestampMsec() { 184 return $this->initiationTimestampMsec; 185 } 186 public function setKind( $kind) { 187 $this->kind = $kind; 188 } 189 public function getKind() { 190 return $this->kind; 191 } 192 public function setValidUntilTimestampMsec( $validUntilTimestampMsec) { 193 $this->validUntilTimestampMsec = $validUntilTimestampMsec; 194 } 195 public function getValidUntilTimestampMsec() { 196 return $this->validUntilTimestampMsec; 197 } 198} 199