[e3d4e0a] | 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\AdministratorWebToken;
|
---|
| 21 | use Google\Service\AndroidEnterprise\AdministratorWebTokenSpec;
|
---|
| 22 | use Google\Service\AndroidEnterprise\CreateEnrollmentTokenResponse;
|
---|
| 23 | use Google\Service\AndroidEnterprise\Enterprise;
|
---|
| 24 | use Google\Service\AndroidEnterprise\EnterpriseAccount;
|
---|
| 25 | use Google\Service\AndroidEnterprise\EnterprisesListResponse;
|
---|
| 26 | use Google\Service\AndroidEnterprise\EnterprisesSendTestPushNotificationResponse;
|
---|
| 27 | use Google\Service\AndroidEnterprise\NotificationSet;
|
---|
| 28 | use Google\Service\AndroidEnterprise\ServiceAccount;
|
---|
| 29 | use Google\Service\AndroidEnterprise\SignupInfo;
|
---|
| 30 | use Google\Service\AndroidEnterprise\StoreLayout;
|
---|
| 31 |
|
---|
| 32 | /**
|
---|
| 33 | * The "enterprises" collection of methods.
|
---|
| 34 | * Typical usage is:
|
---|
| 35 | * <code>
|
---|
| 36 | * $androidenterpriseService = new Google\Service\AndroidEnterprise(...);
|
---|
| 37 | * $enterprises = $androidenterpriseService->enterprises;
|
---|
| 38 | * </code>
|
---|
| 39 | */
|
---|
| 40 | class Enterprises extends \Google\Service\Resource
|
---|
| 41 | {
|
---|
| 42 | /**
|
---|
| 43 | * Acknowledges notifications that were received from
|
---|
| 44 | * Enterprises.PullNotificationSet to prevent subsequent calls from returning
|
---|
| 45 | * the same notifications. (enterprises.acknowledgeNotificationSet)
|
---|
| 46 | *
|
---|
| 47 | * @param array $optParams Optional parameters.
|
---|
| 48 | *
|
---|
| 49 | * @opt_param string notificationSetId The notification set ID as returned by
|
---|
| 50 | * Enterprises.PullNotificationSet. This must be provided.
|
---|
| 51 | * @throws \Google\Service\Exception
|
---|
| 52 | */
|
---|
| 53 | public function acknowledgeNotificationSet($optParams = [])
|
---|
| 54 | {
|
---|
| 55 | $params = [];
|
---|
| 56 | $params = array_merge($params, $optParams);
|
---|
| 57 | return $this->call('acknowledgeNotificationSet', [$params]);
|
---|
| 58 | }
|
---|
| 59 | /**
|
---|
| 60 | * Completes the signup flow, by specifying the Completion token and Enterprise
|
---|
| 61 | * token. This request must not be called multiple times for a given Enterprise
|
---|
| 62 | * Token. (enterprises.completeSignup)
|
---|
| 63 | *
|
---|
| 64 | * @param array $optParams Optional parameters.
|
---|
| 65 | *
|
---|
| 66 | * @opt_param string completionToken The Completion token initially returned by
|
---|
| 67 | * GenerateSignupUrl.
|
---|
| 68 | * @opt_param string enterpriseToken The Enterprise token appended to the
|
---|
| 69 | * Callback URL.
|
---|
| 70 | * @return Enterprise
|
---|
| 71 | * @throws \Google\Service\Exception
|
---|
| 72 | */
|
---|
| 73 | public function completeSignup($optParams = [])
|
---|
| 74 | {
|
---|
| 75 | $params = [];
|
---|
| 76 | $params = array_merge($params, $optParams);
|
---|
| 77 | return $this->call('completeSignup', [$params], Enterprise::class);
|
---|
| 78 | }
|
---|
| 79 | /**
|
---|
| 80 | * Returns a token for device enrollment. The DPC can encode this token within
|
---|
| 81 | * the QR/NFC/zero-touch enrollment payload or fetch it before calling the on-
|
---|
| 82 | * device API to authenticate the user. The token can be generated for each
|
---|
| 83 | * device or reused across multiple devices. (enterprises.createEnrollmentToken)
|
---|
| 84 | *
|
---|
| 85 | * @param string $enterpriseId Required. The ID of the enterprise.
|
---|
| 86 | * @param array $optParams Optional parameters.
|
---|
| 87 | *
|
---|
| 88 | * @opt_param string deviceType Deprecated: Use enrollment_token instead. this
|
---|
| 89 | * field will be removed in the future.
|
---|
| 90 | * @opt_param string enrollmentToken.duration [Optional] The length of time the
|
---|
| 91 | * enrollment token is valid, ranging from 1 minute to
|
---|
| 92 | * [`Durations.MAX_VALUE`](https://developers.google.com/protocol-buffers/docs/r
|
---|
| 93 | * eference/java/com/google/protobuf/util/Durations.html#MAX_VALUE),
|
---|
| 94 | * approximately 10,000 years. If not specified, the default duration is 1 hour.
|
---|
| 95 | * @opt_param string enrollmentToken.enrollmentTokenType [Required] The type of
|
---|
| 96 | * the enrollment token.
|
---|
| 97 | * @opt_param string enrollmentToken.token The token value that's passed to the
|
---|
| 98 | * device and authorizes the device to enroll. This is a read-only field
|
---|
| 99 | * generated by the server.
|
---|
| 100 | * @return CreateEnrollmentTokenResponse
|
---|
| 101 | * @throws \Google\Service\Exception
|
---|
| 102 | */
|
---|
| 103 | public function createEnrollmentToken($enterpriseId, $optParams = [])
|
---|
| 104 | {
|
---|
| 105 | $params = ['enterpriseId' => $enterpriseId];
|
---|
| 106 | $params = array_merge($params, $optParams);
|
---|
| 107 | return $this->call('createEnrollmentToken', [$params], CreateEnrollmentTokenResponse::class);
|
---|
| 108 | }
|
---|
| 109 | /**
|
---|
| 110 | * Returns a unique token to access an embeddable UI. To generate a web UI, pass
|
---|
| 111 | * the generated token into the managed Google Play javascript API. Each token
|
---|
| 112 | * may only be used to start one UI session. See the JavaScript API
|
---|
| 113 | * documentation for further information. (enterprises.createWebToken)
|
---|
| 114 | *
|
---|
| 115 | * @param string $enterpriseId The ID of the enterprise.
|
---|
| 116 | * @param AdministratorWebTokenSpec $postBody
|
---|
| 117 | * @param array $optParams Optional parameters.
|
---|
| 118 | * @return AdministratorWebToken
|
---|
| 119 | * @throws \Google\Service\Exception
|
---|
| 120 | */
|
---|
| 121 | public function createWebToken($enterpriseId, AdministratorWebTokenSpec $postBody, $optParams = [])
|
---|
| 122 | {
|
---|
| 123 | $params = ['enterpriseId' => $enterpriseId, 'postBody' => $postBody];
|
---|
| 124 | $params = array_merge($params, $optParams);
|
---|
| 125 | return $this->call('createWebToken', [$params], AdministratorWebToken::class);
|
---|
| 126 | }
|
---|
| 127 | /**
|
---|
| 128 | * Enrolls an enterprise with the calling EMM. (enterprises.enroll)
|
---|
| 129 | *
|
---|
| 130 | * @param string $token Required. The token provided by the enterprise to
|
---|
| 131 | * register the EMM.
|
---|
| 132 | * @param Enterprise $postBody
|
---|
| 133 | * @param array $optParams Optional parameters.
|
---|
| 134 | * @return Enterprise
|
---|
| 135 | * @throws \Google\Service\Exception
|
---|
| 136 | */
|
---|
| 137 | public function enroll($token, Enterprise $postBody, $optParams = [])
|
---|
| 138 | {
|
---|
| 139 | $params = ['token' => $token, 'postBody' => $postBody];
|
---|
| 140 | $params = array_merge($params, $optParams);
|
---|
| 141 | return $this->call('enroll', [$params], Enterprise::class);
|
---|
| 142 | }
|
---|
| 143 | /**
|
---|
| 144 | * Generates a sign-up URL. (enterprises.generateSignupUrl)
|
---|
| 145 | *
|
---|
| 146 | * @param array $optParams Optional parameters.
|
---|
| 147 | *
|
---|
| 148 | * @opt_param string adminEmail Optional. Email address used to prefill the
|
---|
| 149 | * admin field of the enterprise signup form. This value is a hint only and can
|
---|
| 150 | * be altered by the user.
|
---|
| 151 | * @opt_param string callbackUrl The callback URL to which the Admin will be
|
---|
| 152 | * redirected after successfully creating an enterprise. Before redirecting
|
---|
| 153 | * there the system will add a single query parameter to this URL named
|
---|
| 154 | * "enterpriseToken" which will contain an opaque token to be used for the
|
---|
| 155 | * CompleteSignup request. Beware that this means that the URL will be parsed,
|
---|
| 156 | * the parameter added and then a new URL formatted, i.e. there may be some
|
---|
| 157 | * minor formatting changes and, more importantly, the URL must be well-formed
|
---|
| 158 | * so that it can be parsed.
|
---|
| 159 | * @return SignupInfo
|
---|
| 160 | * @throws \Google\Service\Exception
|
---|
| 161 | */
|
---|
| 162 | public function generateSignupUrl($optParams = [])
|
---|
| 163 | {
|
---|
| 164 | $params = [];
|
---|
| 165 | $params = array_merge($params, $optParams);
|
---|
| 166 | return $this->call('generateSignupUrl', [$params], SignupInfo::class);
|
---|
| 167 | }
|
---|
| 168 | /**
|
---|
| 169 | * Retrieves the name and domain of an enterprise. (enterprises.get)
|
---|
| 170 | *
|
---|
| 171 | * @param string $enterpriseId The ID of the enterprise.
|
---|
| 172 | * @param array $optParams Optional parameters.
|
---|
| 173 | * @return Enterprise
|
---|
| 174 | * @throws \Google\Service\Exception
|
---|
| 175 | */
|
---|
| 176 | public function get($enterpriseId, $optParams = [])
|
---|
| 177 | {
|
---|
| 178 | $params = ['enterpriseId' => $enterpriseId];
|
---|
| 179 | $params = array_merge($params, $optParams);
|
---|
| 180 | return $this->call('get', [$params], Enterprise::class);
|
---|
| 181 | }
|
---|
| 182 | /**
|
---|
| 183 | * Returns a service account and credentials. The service account can be bound
|
---|
| 184 | * to the enterprise by calling setAccount. The service account is unique to
|
---|
| 185 | * this enterprise and EMM, and will be deleted if the enterprise is unbound.
|
---|
| 186 | * The credentials contain private key data and are not stored server-side. This
|
---|
| 187 | * method can only be called after calling Enterprises.Enroll or
|
---|
| 188 | * Enterprises.CompleteSignup, and before Enterprises.SetAccount; at other times
|
---|
| 189 | * it will return an error. Subsequent calls after the first will generate a
|
---|
| 190 | * new, unique set of credentials, and invalidate the previously generated
|
---|
| 191 | * credentials. Once the service account is bound to the enterprise, it can be
|
---|
| 192 | * managed using the serviceAccountKeys resource.
|
---|
| 193 | * (enterprises.getServiceAccount)
|
---|
| 194 | *
|
---|
| 195 | * @param string $enterpriseId The ID of the enterprise.
|
---|
| 196 | * @param array $optParams Optional parameters.
|
---|
| 197 | *
|
---|
| 198 | * @opt_param string keyType The type of credential to return with the service
|
---|
| 199 | * account. Required.
|
---|
| 200 | * @return ServiceAccount
|
---|
| 201 | * @throws \Google\Service\Exception
|
---|
| 202 | */
|
---|
| 203 | public function getServiceAccount($enterpriseId, $optParams = [])
|
---|
| 204 | {
|
---|
| 205 | $params = ['enterpriseId' => $enterpriseId];
|
---|
| 206 | $params = array_merge($params, $optParams);
|
---|
| 207 | return $this->call('getServiceAccount', [$params], ServiceAccount::class);
|
---|
| 208 | }
|
---|
| 209 | /**
|
---|
| 210 | * Returns the store layout for the enterprise. If the store layout has not been
|
---|
| 211 | * set, returns "basic" as the store layout type and no homepage.
|
---|
| 212 | * (enterprises.getStoreLayout)
|
---|
| 213 | *
|
---|
| 214 | * @param string $enterpriseId The ID of the enterprise.
|
---|
| 215 | * @param array $optParams Optional parameters.
|
---|
| 216 | * @return StoreLayout
|
---|
| 217 | * @throws \Google\Service\Exception
|
---|
| 218 | */
|
---|
| 219 | public function getStoreLayout($enterpriseId, $optParams = [])
|
---|
| 220 | {
|
---|
| 221 | $params = ['enterpriseId' => $enterpriseId];
|
---|
| 222 | $params = array_merge($params, $optParams);
|
---|
| 223 | return $this->call('getStoreLayout', [$params], StoreLayout::class);
|
---|
| 224 | }
|
---|
| 225 | /**
|
---|
| 226 | * Looks up an enterprise by domain name. This is only supported for enterprises
|
---|
| 227 | * created via the Google-initiated creation flow. Lookup of the id is not
|
---|
| 228 | * needed for enterprises created via the EMM-initiated flow since the EMM
|
---|
| 229 | * learns the enterprise ID in the callback specified in the
|
---|
| 230 | * Enterprises.generateSignupUrl call. (enterprises.listEnterprises)
|
---|
| 231 | *
|
---|
| 232 | * @param string $domain Required. The exact primary domain name of the
|
---|
| 233 | * enterprise to look up.
|
---|
| 234 | * @param array $optParams Optional parameters.
|
---|
| 235 | * @return EnterprisesListResponse
|
---|
| 236 | * @throws \Google\Service\Exception
|
---|
| 237 | */
|
---|
| 238 | public function listEnterprises($domain, $optParams = [])
|
---|
| 239 | {
|
---|
| 240 | $params = ['domain' => $domain];
|
---|
| 241 | $params = array_merge($params, $optParams);
|
---|
| 242 | return $this->call('list', [$params], EnterprisesListResponse::class);
|
---|
| 243 | }
|
---|
| 244 | /**
|
---|
| 245 | * Pulls and returns a notification set for the enterprises associated with the
|
---|
| 246 | * service account authenticated for the request. The notification set may be
|
---|
| 247 | * empty if no notification are pending. A notification set returned needs to be
|
---|
| 248 | * acknowledged within 20 seconds by calling
|
---|
| 249 | * Enterprises.AcknowledgeNotificationSet, unless the notification set is empty.
|
---|
| 250 | * Notifications that are not acknowledged within the 20 seconds will eventually
|
---|
| 251 | * be included again in the response to another PullNotificationSet request, and
|
---|
| 252 | * those that are never acknowledged will ultimately be deleted according to the
|
---|
| 253 | * Google Cloud Platform Pub/Sub system policy. Multiple requests might be
|
---|
| 254 | * performed concurrently to retrieve notifications, in which case the pending
|
---|
| 255 | * notifications (if any) will be split among each caller, if any are pending.
|
---|
| 256 | * If no notifications are present, an empty notification list is returned.
|
---|
| 257 | * Subsequent requests may return more notifications once they become available.
|
---|
| 258 | * (enterprises.pullNotificationSet)
|
---|
| 259 | *
|
---|
| 260 | * @param array $optParams Optional parameters.
|
---|
| 261 | *
|
---|
| 262 | * @opt_param string requestMode The request mode for pulling notifications.
|
---|
| 263 | * Specifying waitForNotifications will cause the request to block and wait
|
---|
| 264 | * until one or more notifications are present, or return an empty notification
|
---|
| 265 | * list if no notifications are present after some time. Specifying
|
---|
| 266 | * returnImmediately will cause the request to immediately return the pending
|
---|
| 267 | * notifications, or an empty list if no notifications are present. If omitted,
|
---|
| 268 | * defaults to waitForNotifications.
|
---|
| 269 | * @return NotificationSet
|
---|
| 270 | * @throws \Google\Service\Exception
|
---|
| 271 | */
|
---|
| 272 | public function pullNotificationSet($optParams = [])
|
---|
| 273 | {
|
---|
| 274 | $params = [];
|
---|
| 275 | $params = array_merge($params, $optParams);
|
---|
| 276 | return $this->call('pullNotificationSet', [$params], NotificationSet::class);
|
---|
| 277 | }
|
---|
| 278 | /**
|
---|
| 279 | * Sends a test notification to validate the EMM integration with the Google
|
---|
| 280 | * Cloud Pub/Sub service for this enterprise.
|
---|
| 281 | * (enterprises.sendTestPushNotification)
|
---|
| 282 | *
|
---|
| 283 | * @param string $enterpriseId The ID of the enterprise.
|
---|
| 284 | * @param array $optParams Optional parameters.
|
---|
| 285 | * @return EnterprisesSendTestPushNotificationResponse
|
---|
| 286 | * @throws \Google\Service\Exception
|
---|
| 287 | */
|
---|
| 288 | public function sendTestPushNotification($enterpriseId, $optParams = [])
|
---|
| 289 | {
|
---|
| 290 | $params = ['enterpriseId' => $enterpriseId];
|
---|
| 291 | $params = array_merge($params, $optParams);
|
---|
| 292 | return $this->call('sendTestPushNotification', [$params], EnterprisesSendTestPushNotificationResponse::class);
|
---|
| 293 | }
|
---|
| 294 | /**
|
---|
| 295 | * Sets the account that will be used to authenticate to the API as the
|
---|
| 296 | * enterprise. (enterprises.setAccount)
|
---|
| 297 | *
|
---|
| 298 | * @param string $enterpriseId The ID of the enterprise.
|
---|
| 299 | * @param EnterpriseAccount $postBody
|
---|
| 300 | * @param array $optParams Optional parameters.
|
---|
| 301 | * @return EnterpriseAccount
|
---|
| 302 | * @throws \Google\Service\Exception
|
---|
| 303 | */
|
---|
| 304 | public function setAccount($enterpriseId, EnterpriseAccount $postBody, $optParams = [])
|
---|
| 305 | {
|
---|
| 306 | $params = ['enterpriseId' => $enterpriseId, 'postBody' => $postBody];
|
---|
| 307 | $params = array_merge($params, $optParams);
|
---|
| 308 | return $this->call('setAccount', [$params], EnterpriseAccount::class);
|
---|
| 309 | }
|
---|
| 310 | /**
|
---|
| 311 | * Sets the store layout for the enterprise. By default, storeLayoutType is set
|
---|
| 312 | * to "basic" and the basic store layout is enabled. The basic layout only
|
---|
| 313 | * contains apps approved by the admin, and that have been added to the
|
---|
| 314 | * available product set for a user (using the setAvailableProductSet call).
|
---|
| 315 | * Apps on the page are sorted in order of their product ID value. If you create
|
---|
| 316 | * a custom store layout (by setting storeLayoutType = "custom" and setting a
|
---|
| 317 | * homepage), the basic store layout is disabled. (enterprises.setStoreLayout)
|
---|
| 318 | *
|
---|
| 319 | * @param string $enterpriseId The ID of the enterprise.
|
---|
| 320 | * @param StoreLayout $postBody
|
---|
| 321 | * @param array $optParams Optional parameters.
|
---|
| 322 | * @return StoreLayout
|
---|
| 323 | * @throws \Google\Service\Exception
|
---|
| 324 | */
|
---|
| 325 | public function setStoreLayout($enterpriseId, StoreLayout $postBody, $optParams = [])
|
---|
| 326 | {
|
---|
| 327 | $params = ['enterpriseId' => $enterpriseId, 'postBody' => $postBody];
|
---|
| 328 | $params = array_merge($params, $optParams);
|
---|
| 329 | return $this->call('setStoreLayout', [$params], StoreLayout::class);
|
---|
| 330 | }
|
---|
| 331 | /**
|
---|
| 332 | * Unenrolls an enterprise from the calling EMM. (enterprises.unenroll)
|
---|
| 333 | *
|
---|
| 334 | * @param string $enterpriseId The ID of the enterprise.
|
---|
| 335 | * @param array $optParams Optional parameters.
|
---|
| 336 | * @throws \Google\Service\Exception
|
---|
| 337 | */
|
---|
| 338 | public function unenroll($enterpriseId, $optParams = [])
|
---|
| 339 | {
|
---|
| 340 | $params = ['enterpriseId' => $enterpriseId];
|
---|
| 341 | $params = array_merge($params, $optParams);
|
---|
| 342 | return $this->call('unenroll', [$params]);
|
---|
| 343 | }
|
---|
| 344 | }
|
---|
| 345 |
|
---|
| 346 | // Adding a class alias for backwards compatibility with the previous class name.
|
---|
| 347 | class_alias(Enterprises::class, 'Google_Service_AndroidEnterprise_Resource_Enterprises');
|
---|