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\Licensing\Resource;
|
---|
19 |
|
---|
20 | use Google\Service\Licensing\LicenseAssignment;
|
---|
21 | use Google\Service\Licensing\LicenseAssignmentInsert;
|
---|
22 | use Google\Service\Licensing\LicenseAssignmentList;
|
---|
23 | use Google\Service\Licensing\LicensingEmpty;
|
---|
24 |
|
---|
25 | /**
|
---|
26 | * The "licenseAssignments" collection of methods.
|
---|
27 | * Typical usage is:
|
---|
28 | * <code>
|
---|
29 | * $licensingService = new Google\Service\Licensing(...);
|
---|
30 | * $licenseAssignments = $licensingService->licenseAssignments;
|
---|
31 | * </code>
|
---|
32 | */
|
---|
33 | class LicenseAssignments extends \Google\Service\Resource
|
---|
34 | {
|
---|
35 | /**
|
---|
36 | * Revoke a license. (licenseAssignments.delete)
|
---|
37 | *
|
---|
38 | * @param string $productId A product's unique identifier. For more information
|
---|
39 | * about products in this version of the API, see Products and SKUs.
|
---|
40 | * @param string $skuId A product SKU's unique identifier. For more information
|
---|
41 | * about available SKUs in this version of the API, see Products and SKUs.
|
---|
42 | * @param string $userId The user's current primary email address. If the user's
|
---|
43 | * email address changes, use the new email address in your API requests. Since
|
---|
44 | * a `userId` is subject to change, do not use a `userId` value as a key for
|
---|
45 | * persistent data. This key could break if the current user's email address
|
---|
46 | * changes. If the `userId` is suspended, the license status changes.
|
---|
47 | * @param array $optParams Optional parameters.
|
---|
48 | * @return LicensingEmpty
|
---|
49 | * @throws \Google\Service\Exception
|
---|
50 | */
|
---|
51 | public function delete($productId, $skuId, $userId, $optParams = [])
|
---|
52 | {
|
---|
53 | $params = ['productId' => $productId, 'skuId' => $skuId, 'userId' => $userId];
|
---|
54 | $params = array_merge($params, $optParams);
|
---|
55 | return $this->call('delete', [$params], LicensingEmpty::class);
|
---|
56 | }
|
---|
57 | /**
|
---|
58 | * Get a specific user's license by product SKU. (licenseAssignments.get)
|
---|
59 | *
|
---|
60 | * @param string $productId A product's unique identifier. For more information
|
---|
61 | * about products in this version of the API, see Products and SKUs.
|
---|
62 | * @param string $skuId A product SKU's unique identifier. For more information
|
---|
63 | * about available SKUs in this version of the API, see Products and SKUs.
|
---|
64 | * @param string $userId The user's current primary email address. If the user's
|
---|
65 | * email address changes, use the new email address in your API requests. Since
|
---|
66 | * a `userId` is subject to change, do not use a `userId` value as a key for
|
---|
67 | * persistent data. This key could break if the current user's email address
|
---|
68 | * changes. If the `userId` is suspended, the license status changes.
|
---|
69 | * @param array $optParams Optional parameters.
|
---|
70 | * @return LicenseAssignment
|
---|
71 | * @throws \Google\Service\Exception
|
---|
72 | */
|
---|
73 | public function get($productId, $skuId, $userId, $optParams = [])
|
---|
74 | {
|
---|
75 | $params = ['productId' => $productId, 'skuId' => $skuId, 'userId' => $userId];
|
---|
76 | $params = array_merge($params, $optParams);
|
---|
77 | return $this->call('get', [$params], LicenseAssignment::class);
|
---|
78 | }
|
---|
79 | /**
|
---|
80 | * Assign a license. (licenseAssignments.insert)
|
---|
81 | *
|
---|
82 | * @param string $productId A product's unique identifier. For more information
|
---|
83 | * about products in this version of the API, see Products and SKUs.
|
---|
84 | * @param string $skuId A product SKU's unique identifier. For more information
|
---|
85 | * about available SKUs in this version of the API, see Products and SKUs.
|
---|
86 | * @param LicenseAssignmentInsert $postBody
|
---|
87 | * @param array $optParams Optional parameters.
|
---|
88 | * @return LicenseAssignment
|
---|
89 | * @throws \Google\Service\Exception
|
---|
90 | */
|
---|
91 | public function insert($productId, $skuId, LicenseAssignmentInsert $postBody, $optParams = [])
|
---|
92 | {
|
---|
93 | $params = ['productId' => $productId, 'skuId' => $skuId, 'postBody' => $postBody];
|
---|
94 | $params = array_merge($params, $optParams);
|
---|
95 | return $this->call('insert', [$params], LicenseAssignment::class);
|
---|
96 | }
|
---|
97 | /**
|
---|
98 | * List all users assigned licenses for a specific product SKU.
|
---|
99 | * (licenseAssignments.listForProduct)
|
---|
100 | *
|
---|
101 | * @param string $productId A product's unique identifier. For more information
|
---|
102 | * about products in this version of the API, see Products and SKUs.
|
---|
103 | * @param string $customerId The customer's unique ID as defined in the Admin
|
---|
104 | * console, such as `C00000000`. If the customer is suspended, the server
|
---|
105 | * returns an error.
|
---|
106 | * @param array $optParams Optional parameters.
|
---|
107 | *
|
---|
108 | * @opt_param string maxResults The `maxResults` query string determines how
|
---|
109 | * many entries are returned on each page of a large response. This is an
|
---|
110 | * optional parameter. The value must be a positive number.
|
---|
111 | * @opt_param string pageToken Token to fetch the next page of data. The
|
---|
112 | * `maxResults` query string is related to the `pageToken` since `maxResults`
|
---|
113 | * determines how many entries are returned on each page. This is an optional
|
---|
114 | * query string. If not specified, the server returns the first page.
|
---|
115 | * @return LicenseAssignmentList
|
---|
116 | * @throws \Google\Service\Exception
|
---|
117 | */
|
---|
118 | public function listForProduct($productId, $customerId, $optParams = [])
|
---|
119 | {
|
---|
120 | $params = ['productId' => $productId, 'customerId' => $customerId];
|
---|
121 | $params = array_merge($params, $optParams);
|
---|
122 | return $this->call('listForProduct', [$params], LicenseAssignmentList::class);
|
---|
123 | }
|
---|
124 | /**
|
---|
125 | * List all users assigned licenses for a specific product SKU.
|
---|
126 | * (licenseAssignments.listForProductAndSku)
|
---|
127 | *
|
---|
128 | * @param string $productId A product's unique identifier. For more information
|
---|
129 | * about products in this version of the API, see Products and SKUs.
|
---|
130 | * @param string $skuId A product SKU's unique identifier. For more information
|
---|
131 | * about available SKUs in this version of the API, see Products and SKUs.
|
---|
132 | * @param string $customerId The customer's unique ID as defined in the Admin
|
---|
133 | * console, such as `C00000000`. If the customer is suspended, the server
|
---|
134 | * returns an error.
|
---|
135 | * @param array $optParams Optional parameters.
|
---|
136 | *
|
---|
137 | * @opt_param string maxResults The `maxResults` query string determines how
|
---|
138 | * many entries are returned on each page of a large response. This is an
|
---|
139 | * optional parameter. The value must be a positive number.
|
---|
140 | * @opt_param string pageToken Token to fetch the next page of data. The
|
---|
141 | * `maxResults` query string is related to the `pageToken` since `maxResults`
|
---|
142 | * determines how many entries are returned on each page. This is an optional
|
---|
143 | * query string. If not specified, the server returns the first page.
|
---|
144 | * @return LicenseAssignmentList
|
---|
145 | * @throws \Google\Service\Exception
|
---|
146 | */
|
---|
147 | public function listForProductAndSku($productId, $skuId, $customerId, $optParams = [])
|
---|
148 | {
|
---|
149 | $params = ['productId' => $productId, 'skuId' => $skuId, 'customerId' => $customerId];
|
---|
150 | $params = array_merge($params, $optParams);
|
---|
151 | return $this->call('listForProductAndSku', [$params], LicenseAssignmentList::class);
|
---|
152 | }
|
---|
153 | /**
|
---|
154 | * Reassign a user's product SKU with a different SKU in the same product. This
|
---|
155 | * method supports patch semantics. (licenseAssignments.patch)
|
---|
156 | *
|
---|
157 | * @param string $productId A product's unique identifier. For more information
|
---|
158 | * about products in this version of the API, see Products and SKUs.
|
---|
159 | * @param string $skuId A product SKU's unique identifier. For more information
|
---|
160 | * about available SKUs in this version of the API, see Products and SKUs.
|
---|
161 | * @param string $userId The user's current primary email address. If the user's
|
---|
162 | * email address changes, use the new email address in your API requests. Since
|
---|
163 | * a `userId` is subject to change, do not use a `userId` value as a key for
|
---|
164 | * persistent data. This key could break if the current user's email address
|
---|
165 | * changes. If the `userId` is suspended, the license status changes.
|
---|
166 | * @param LicenseAssignment $postBody
|
---|
167 | * @param array $optParams Optional parameters.
|
---|
168 | * @return LicenseAssignment
|
---|
169 | * @throws \Google\Service\Exception
|
---|
170 | */
|
---|
171 | public function patch($productId, $skuId, $userId, LicenseAssignment $postBody, $optParams = [])
|
---|
172 | {
|
---|
173 | $params = ['productId' => $productId, 'skuId' => $skuId, 'userId' => $userId, 'postBody' => $postBody];
|
---|
174 | $params = array_merge($params, $optParams);
|
---|
175 | return $this->call('patch', [$params], LicenseAssignment::class);
|
---|
176 | }
|
---|
177 | /**
|
---|
178 | * Reassign a user's product SKU with a different SKU in the same product.
|
---|
179 | * (licenseAssignments.update)
|
---|
180 | *
|
---|
181 | * @param string $productId A product's unique identifier. For more information
|
---|
182 | * about products in this version of the API, see Products and SKUs.
|
---|
183 | * @param string $skuId A product SKU's unique identifier. For more information
|
---|
184 | * about available SKUs in this version of the API, see Products and SKUs.
|
---|
185 | * @param string $userId The user's current primary email address. If the user's
|
---|
186 | * email address changes, use the new email address in your API requests. Since
|
---|
187 | * a `userId` is subject to change, do not use a `userId` value as a key for
|
---|
188 | * persistent data. This key could break if the current user's email address
|
---|
189 | * changes. If the `userId` is suspended, the license status changes.
|
---|
190 | * @param LicenseAssignment $postBody
|
---|
191 | * @param array $optParams Optional parameters.
|
---|
192 | * @return LicenseAssignment
|
---|
193 | * @throws \Google\Service\Exception
|
---|
194 | */
|
---|
195 | public function update($productId, $skuId, $userId, LicenseAssignment $postBody, $optParams = [])
|
---|
196 | {
|
---|
197 | $params = ['productId' => $productId, 'skuId' => $skuId, 'userId' => $userId, 'postBody' => $postBody];
|
---|
198 | $params = array_merge($params, $optParams);
|
---|
199 | return $this->call('update', [$params], LicenseAssignment::class);
|
---|
200 | }
|
---|
201 | }
|
---|
202 |
|
---|
203 | // Adding a class alias for backwards compatibility with the previous class name.
|
---|
204 | class_alias(LicenseAssignments::class, 'Google_Service_Licensing_Resource_LicenseAssignments');
|
---|