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\AndroidPublisher\Resource;
19
20use Google\Service\AndroidPublisher\InAppProduct;
21use Google\Service\AndroidPublisher\InappproductsListResponse;
22
23/**
24 * The "inappproducts" collection of methods.
25 * Typical usage is:
26 *  <code>
27 *   $androidpublisherService = new Google\Service\AndroidPublisher(...);
28 *   $inappproducts = $androidpublisherService->inappproducts;
29 *  </code>
30 */
31class Inappproducts extends \Google\Service\Resource
32{
33  /**
34   * Deletes an in-app product (i.e. a managed product or a subscriptions).
35   * (inappproducts.delete)
36   *
37   * @param string $packageName Package name of the app.
38   * @param string $sku Unique identifier for the in-app product.
39   * @param array $optParams Optional parameters.
40   */
41  public function delete($packageName, $sku, $optParams = [])
42  {
43    $params = ['packageName' => $packageName, 'sku' => $sku];
44    $params = array_merge($params, $optParams);
45    return $this->call('delete', [$params]);
46  }
47  /**
48   * Gets an in-app product, which can be a managed product or a subscription.
49   * (inappproducts.get)
50   *
51   * @param string $packageName Package name of the app.
52   * @param string $sku Unique identifier for the in-app product.
53   * @param array $optParams Optional parameters.
54   * @return InAppProduct
55   */
56  public function get($packageName, $sku, $optParams = [])
57  {
58    $params = ['packageName' => $packageName, 'sku' => $sku];
59    $params = array_merge($params, $optParams);
60    return $this->call('get', [$params], InAppProduct::class);
61  }
62  /**
63   * Creates an in-app product (i.e. a managed product or a subscriptions).
64   * (inappproducts.insert)
65   *
66   * @param string $packageName Package name of the app.
67   * @param InAppProduct $postBody
68   * @param array $optParams Optional parameters.
69   *
70   * @opt_param bool autoConvertMissingPrices If true the prices for all regions
71   * targeted by the parent app that don't have a price specified for this in-app
72   * product will be auto converted to the target currency based on the default
73   * price. Defaults to false.
74   * @return InAppProduct
75   */
76  public function insert($packageName, InAppProduct $postBody, $optParams = [])
77  {
78    $params = ['packageName' => $packageName, 'postBody' => $postBody];
79    $params = array_merge($params, $optParams);
80    return $this->call('insert', [$params], InAppProduct::class);
81  }
82  /**
83   * Lists all in-app products - both managed products and subscriptions. If an
84   * app has a large number of in-app products, the response may be paginated. In
85   * this case the response field `tokenPagination.nextPageToken` will be set and
86   * the caller should provide its value as a `token` request parameter to
87   * retrieve the next page. (inappproducts.listInappproducts)
88   *
89   * @param string $packageName Package name of the app.
90   * @param array $optParams Optional parameters.
91   *
92   * @opt_param string maxResults Deprecated and ignored. The page size is
93   * determined by the server.
94   * @opt_param string startIndex Deprecated and ignored. Set the `token`
95   * parameter to rertieve the next page.
96   * @opt_param string token Pagination token. If empty, list starts at the first
97   * product.
98   * @return InappproductsListResponse
99   */
100  public function listInappproducts($packageName, $optParams = [])
101  {
102    $params = ['packageName' => $packageName];
103    $params = array_merge($params, $optParams);
104    return $this->call('list', [$params], InappproductsListResponse::class);
105  }
106  /**
107   * Patches an in-app product (i.e. a managed product or a subscriptions).
108   * (inappproducts.patch)
109   *
110   * @param string $packageName Package name of the app.
111   * @param string $sku Unique identifier for the in-app product.
112   * @param InAppProduct $postBody
113   * @param array $optParams Optional parameters.
114   *
115   * @opt_param bool autoConvertMissingPrices If true the prices for all regions
116   * targeted by the parent app that don't have a price specified for this in-app
117   * product will be auto converted to the target currency based on the default
118   * price. Defaults to false.
119   * @return InAppProduct
120   */
121  public function patch($packageName, $sku, InAppProduct $postBody, $optParams = [])
122  {
123    $params = ['packageName' => $packageName, 'sku' => $sku, 'postBody' => $postBody];
124    $params = array_merge($params, $optParams);
125    return $this->call('patch', [$params], InAppProduct::class);
126  }
127  /**
128   * Updates an in-app product (i.e. a managed product or a subscriptions).
129   * (inappproducts.update)
130   *
131   * @param string $packageName Package name of the app.
132   * @param string $sku Unique identifier for the in-app product.
133   * @param InAppProduct $postBody
134   * @param array $optParams Optional parameters.
135   *
136   * @opt_param bool allowMissing If set to true, and the in-app product with the
137   * given package_name and sku doesn't exist, the in-app product will be created.
138   * @opt_param bool autoConvertMissingPrices If true the prices for all regions
139   * targeted by the parent app that don't have a price specified for this in-app
140   * product will be auto converted to the target currency based on the default
141   * price. Defaults to false.
142   * @return InAppProduct
143   */
144  public function update($packageName, $sku, InAppProduct $postBody, $optParams = [])
145  {
146    $params = ['packageName' => $packageName, 'sku' => $sku, 'postBody' => $postBody];
147    $params = array_merge($params, $optParams);
148    return $this->call('update', [$params], InAppProduct::class);
149  }
150}
151
152// Adding a class alias for backwards compatibility with the previous class name.
153class_alias(Inappproducts::class, 'Google_Service_AndroidPublisher_Resource_Inappproducts');
154