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