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\AndroidEnterprise\Resource;
|
---|
19 |
|
---|
20 | use Google\Service\AndroidEnterprise\AuthenticationToken;
|
---|
21 | use Google\Service\AndroidEnterprise\ProductSet;
|
---|
22 | use Google\Service\AndroidEnterprise\User;
|
---|
23 | use Google\Service\AndroidEnterprise\UsersListResponse;
|
---|
24 |
|
---|
25 | /**
|
---|
26 | * The "users" collection of methods.
|
---|
27 | * Typical usage is:
|
---|
28 | * <code>
|
---|
29 | * $androidenterpriseService = new Google\Service\AndroidEnterprise(...);
|
---|
30 | * $users = $androidenterpriseService->users;
|
---|
31 | * </code>
|
---|
32 | */
|
---|
33 | class Users extends \Google\Service\Resource
|
---|
34 | {
|
---|
35 | /**
|
---|
36 | * Deleted an EMM-managed user. (users.delete)
|
---|
37 | *
|
---|
38 | * @param string $enterpriseId The ID of the enterprise.
|
---|
39 | * @param string $userId The ID of the user.
|
---|
40 | * @param array $optParams Optional parameters.
|
---|
41 | * @throws \Google\Service\Exception
|
---|
42 | */
|
---|
43 | public function delete($enterpriseId, $userId, $optParams = [])
|
---|
44 | {
|
---|
45 | $params = ['enterpriseId' => $enterpriseId, 'userId' => $userId];
|
---|
46 | $params = array_merge($params, $optParams);
|
---|
47 | return $this->call('delete', [$params]);
|
---|
48 | }
|
---|
49 | /**
|
---|
50 | * Generates an authentication token which the device policy client can use to
|
---|
51 | * provision the given EMM-managed user account on a device. The generated token
|
---|
52 | * is single-use and expires after a few minutes. You can provision a maximum of
|
---|
53 | * 10 devices per user. This call only works with EMM-managed accounts.
|
---|
54 | * (users.generateAuthenticationToken)
|
---|
55 | *
|
---|
56 | * @param string $enterpriseId The ID of the enterprise.
|
---|
57 | * @param string $userId The ID of the user.
|
---|
58 | * @param array $optParams Optional parameters.
|
---|
59 | * @return AuthenticationToken
|
---|
60 | * @throws \Google\Service\Exception
|
---|
61 | */
|
---|
62 | public function generateAuthenticationToken($enterpriseId, $userId, $optParams = [])
|
---|
63 | {
|
---|
64 | $params = ['enterpriseId' => $enterpriseId, 'userId' => $userId];
|
---|
65 | $params = array_merge($params, $optParams);
|
---|
66 | return $this->call('generateAuthenticationToken', [$params], AuthenticationToken::class);
|
---|
67 | }
|
---|
68 | /**
|
---|
69 | * Retrieves a user's details. (users.get)
|
---|
70 | *
|
---|
71 | * @param string $enterpriseId The ID of the enterprise.
|
---|
72 | * @param string $userId The ID of the user.
|
---|
73 | * @param array $optParams Optional parameters.
|
---|
74 | * @return User
|
---|
75 | * @throws \Google\Service\Exception
|
---|
76 | */
|
---|
77 | public function get($enterpriseId, $userId, $optParams = [])
|
---|
78 | {
|
---|
79 | $params = ['enterpriseId' => $enterpriseId, 'userId' => $userId];
|
---|
80 | $params = array_merge($params, $optParams);
|
---|
81 | return $this->call('get', [$params], User::class);
|
---|
82 | }
|
---|
83 | /**
|
---|
84 | * Retrieves the set of products a user is entitled to access. **Note:** This
|
---|
85 | * item has been deprecated. New integrations cannot use this method and can
|
---|
86 | * refer to our new recommendations. (users.getAvailableProductSet)
|
---|
87 | *
|
---|
88 | * @param string $enterpriseId The ID of the enterprise.
|
---|
89 | * @param string $userId The ID of the user.
|
---|
90 | * @param array $optParams Optional parameters.
|
---|
91 | * @return ProductSet
|
---|
92 | * @throws \Google\Service\Exception
|
---|
93 | */
|
---|
94 | public function getAvailableProductSet($enterpriseId, $userId, $optParams = [])
|
---|
95 | {
|
---|
96 | $params = ['enterpriseId' => $enterpriseId, 'userId' => $userId];
|
---|
97 | $params = array_merge($params, $optParams);
|
---|
98 | return $this->call('getAvailableProductSet', [$params], ProductSet::class);
|
---|
99 | }
|
---|
100 | /**
|
---|
101 | * Creates a new EMM-managed user. The Users resource passed in the body of the
|
---|
102 | * request should include an accountIdentifier and an accountType. If a
|
---|
103 | * corresponding user already exists with the same account identifier, the user
|
---|
104 | * will be updated with the resource. In this case only the displayName field
|
---|
105 | * can be changed. (users.insert)
|
---|
106 | *
|
---|
107 | * @param string $enterpriseId The ID of the enterprise.
|
---|
108 | * @param User $postBody
|
---|
109 | * @param array $optParams Optional parameters.
|
---|
110 | * @return User
|
---|
111 | * @throws \Google\Service\Exception
|
---|
112 | */
|
---|
113 | public function insert($enterpriseId, User $postBody, $optParams = [])
|
---|
114 | {
|
---|
115 | $params = ['enterpriseId' => $enterpriseId, 'postBody' => $postBody];
|
---|
116 | $params = array_merge($params, $optParams);
|
---|
117 | return $this->call('insert', [$params], User::class);
|
---|
118 | }
|
---|
119 | /**
|
---|
120 | * Looks up a user by primary email address. This is only supported for Google-
|
---|
121 | * managed users. Lookup of the id is not needed for EMM-managed users because
|
---|
122 | * the id is already returned in the result of the Users.insert call.
|
---|
123 | * (users.listUsers)
|
---|
124 | *
|
---|
125 | * @param string $enterpriseId The ID of the enterprise.
|
---|
126 | * @param string $email Required. The exact primary email address of the user to
|
---|
127 | * look up.
|
---|
128 | * @param array $optParams Optional parameters.
|
---|
129 | * @return UsersListResponse
|
---|
130 | * @throws \Google\Service\Exception
|
---|
131 | */
|
---|
132 | public function listUsers($enterpriseId, $email, $optParams = [])
|
---|
133 | {
|
---|
134 | $params = ['enterpriseId' => $enterpriseId, 'email' => $email];
|
---|
135 | $params = array_merge($params, $optParams);
|
---|
136 | return $this->call('list', [$params], UsersListResponse::class);
|
---|
137 | }
|
---|
138 | /**
|
---|
139 | * Revokes access to all devices currently provisioned to the user. The user
|
---|
140 | * will no longer be able to use the managed Play store on any of their managed
|
---|
141 | * devices. This call only works with EMM-managed accounts.
|
---|
142 | * (users.revokeDeviceAccess)
|
---|
143 | *
|
---|
144 | * @param string $enterpriseId The ID of the enterprise.
|
---|
145 | * @param string $userId The ID of the user.
|
---|
146 | * @param array $optParams Optional parameters.
|
---|
147 | * @throws \Google\Service\Exception
|
---|
148 | */
|
---|
149 | public function revokeDeviceAccess($enterpriseId, $userId, $optParams = [])
|
---|
150 | {
|
---|
151 | $params = ['enterpriseId' => $enterpriseId, 'userId' => $userId];
|
---|
152 | $params = array_merge($params, $optParams);
|
---|
153 | return $this->call('revokeDeviceAccess', [$params]);
|
---|
154 | }
|
---|
155 | /**
|
---|
156 | * Modifies the set of products that a user is entitled to access (referred to
|
---|
157 | * as *whitelisted* products). Only products that are approved or products that
|
---|
158 | * were previously approved (products with revoked approval) can be whitelisted.
|
---|
159 | * **Note:** This item has been deprecated. New integrations cannot use this
|
---|
160 | * method and can refer to our new recommendations.
|
---|
161 | * (users.setAvailableProductSet)
|
---|
162 | *
|
---|
163 | * @param string $enterpriseId The ID of the enterprise.
|
---|
164 | * @param string $userId The ID of the user.
|
---|
165 | * @param ProductSet $postBody
|
---|
166 | * @param array $optParams Optional parameters.
|
---|
167 | * @return ProductSet
|
---|
168 | * @throws \Google\Service\Exception
|
---|
169 | */
|
---|
170 | public function setAvailableProductSet($enterpriseId, $userId, ProductSet $postBody, $optParams = [])
|
---|
171 | {
|
---|
172 | $params = ['enterpriseId' => $enterpriseId, 'userId' => $userId, 'postBody' => $postBody];
|
---|
173 | $params = array_merge($params, $optParams);
|
---|
174 | return $this->call('setAvailableProductSet', [$params], ProductSet::class);
|
---|
175 | }
|
---|
176 | /**
|
---|
177 | * Updates the details of an EMM-managed user. Can be used with EMM-managed
|
---|
178 | * users only (not Google managed users). Pass the new details in the Users
|
---|
179 | * resource in the request body. Only the displayName field can be changed.
|
---|
180 | * Other fields must either be unset or have the currently active value.
|
---|
181 | * (users.update)
|
---|
182 | *
|
---|
183 | * @param string $enterpriseId The ID of the enterprise.
|
---|
184 | * @param string $userId The ID of the user.
|
---|
185 | * @param User $postBody
|
---|
186 | * @param array $optParams Optional parameters.
|
---|
187 | * @return User
|
---|
188 | * @throws \Google\Service\Exception
|
---|
189 | */
|
---|
190 | public function update($enterpriseId, $userId, User $postBody, $optParams = [])
|
---|
191 | {
|
---|
192 | $params = ['enterpriseId' => $enterpriseId, 'userId' => $userId, 'postBody' => $postBody];
|
---|
193 | $params = array_merge($params, $optParams);
|
---|
194 | return $this->call('update', [$params], User::class);
|
---|
195 | }
|
---|
196 | }
|
---|
197 |
|
---|
198 | // Adding a class alias for backwards compatibility with the previous class name.
|
---|
199 | class_alias(Users::class, 'Google_Service_AndroidEnterprise_Resource_Users');
|
---|