Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.11.x will end 14 Nov 2022 (12 months plus 6 months extension).
  • Bug fixes for security issues in 3.11.x will end 13 Nov 2023 (18 months plus 12 months extension).
  • PHP version: minimum PHP 7.3.0 Note: minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is supported too.

Differences Between: [Versions 311 and 402] [Versions 311 and 403]

   1  <?php
   2  /*
   3   * Copyright 2010 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  /**
  19   * Service definition for Licensing (v1).
  20   *
  21   * <p>
  22   * Licensing API to view and manage license for your domain.</p>
  23   *
  24   * <p>
  25   * For more information about this service, see the API
  26   * <a href="https://developers.google.com/google-apps/licensing/" target="_blank">Documentation</a>
  27   * </p>
  28   *
  29   * @author Google, Inc.
  30   */
  31  class Google_Service_Licensing extends Google_Service
  32  {
  33    /** View and manage Google Apps licenses for your domain. */
  34    const APPS_LICENSING =
  35        "https://www.googleapis.com/auth/apps.licensing";
  36  
  37    public $licenseAssignments;
  38    
  39  
  40    /**
  41     * Constructs the internal representation of the Licensing service.
  42     *
  43     * @param Google_Client $client
  44     */
  45    public function __construct(Google_Client $client)
  46    {
  47      parent::__construct($client);
  48      $this->rootUrl = 'https://www.googleapis.com/';
  49      $this->servicePath = 'apps/licensing/v1/product/';
  50      $this->version = 'v1';
  51      $this->serviceName = 'licensing';
  52  
  53      $this->licenseAssignments = new Google_Service_Licensing_LicenseAssignments_Resource(
  54          $this,
  55          $this->serviceName,
  56          'licenseAssignments',
  57          array(
  58            'methods' => array(
  59              'delete' => array(
  60                'path' => '{productId}/sku/{skuId}/user/{userId}',
  61                'httpMethod' => 'DELETE',
  62                'parameters' => array(
  63                  'productId' => array(
  64                    'location' => 'path',
  65                    'type' => 'string',
  66                    'required' => true,
  67                  ),
  68                  'skuId' => array(
  69                    'location' => 'path',
  70                    'type' => 'string',
  71                    'required' => true,
  72                  ),
  73                  'userId' => array(
  74                    'location' => 'path',
  75                    'type' => 'string',
  76                    'required' => true,
  77                  ),
  78                ),
  79              ),'get' => array(
  80                'path' => '{productId}/sku/{skuId}/user/{userId}',
  81                'httpMethod' => 'GET',
  82                'parameters' => array(
  83                  'productId' => array(
  84                    'location' => 'path',
  85                    'type' => 'string',
  86                    'required' => true,
  87                  ),
  88                  'skuId' => array(
  89                    'location' => 'path',
  90                    'type' => 'string',
  91                    'required' => true,
  92                  ),
  93                  'userId' => array(
  94                    'location' => 'path',
  95                    'type' => 'string',
  96                    'required' => true,
  97                  ),
  98                ),
  99              ),'insert' => array(
 100                'path' => '{productId}/sku/{skuId}/user',
 101                'httpMethod' => 'POST',
 102                'parameters' => array(
 103                  'productId' => array(
 104                    'location' => 'path',
 105                    'type' => 'string',
 106                    'required' => true,
 107                  ),
 108                  'skuId' => array(
 109                    'location' => 'path',
 110                    'type' => 'string',
 111                    'required' => true,
 112                  ),
 113                ),
 114              ),'listForProduct' => array(
 115                'path' => '{productId}/users',
 116                'httpMethod' => 'GET',
 117                'parameters' => array(
 118                  'productId' => array(
 119                    'location' => 'path',
 120                    'type' => 'string',
 121                    'required' => true,
 122                  ),
 123                  'customerId' => array(
 124                    'location' => 'query',
 125                    'type' => 'string',
 126                    'required' => true,
 127                  ),
 128                  'pageToken' => array(
 129                    'location' => 'query',
 130                    'type' => 'string',
 131                  ),
 132                  'maxResults' => array(
 133                    'location' => 'query',
 134                    'type' => 'integer',
 135                  ),
 136                ),
 137              ),'listForProductAndSku' => array(
 138                'path' => '{productId}/sku/{skuId}/users',
 139                'httpMethod' => 'GET',
 140                'parameters' => array(
 141                  'productId' => array(
 142                    'location' => 'path',
 143                    'type' => 'string',
 144                    'required' => true,
 145                  ),
 146                  'skuId' => array(
 147                    'location' => 'path',
 148                    'type' => 'string',
 149                    'required' => true,
 150                  ),
 151                  'customerId' => array(
 152                    'location' => 'query',
 153                    'type' => 'string',
 154                    'required' => true,
 155                  ),
 156                  'pageToken' => array(
 157                    'location' => 'query',
 158                    'type' => 'string',
 159                  ),
 160                  'maxResults' => array(
 161                    'location' => 'query',
 162                    'type' => 'integer',
 163                  ),
 164                ),
 165              ),'patch' => array(
 166                'path' => '{productId}/sku/{skuId}/user/{userId}',
 167                'httpMethod' => 'PATCH',
 168                'parameters' => array(
 169                  'productId' => array(
 170                    'location' => 'path',
 171                    'type' => 'string',
 172                    'required' => true,
 173                  ),
 174                  'skuId' => array(
 175                    'location' => 'path',
 176                    'type' => 'string',
 177                    'required' => true,
 178                  ),
 179                  'userId' => array(
 180                    'location' => 'path',
 181                    'type' => 'string',
 182                    'required' => true,
 183                  ),
 184                ),
 185              ),'update' => array(
 186                'path' => '{productId}/sku/{skuId}/user/{userId}',
 187                'httpMethod' => 'PUT',
 188                'parameters' => array(
 189                  'productId' => array(
 190                    'location' => 'path',
 191                    'type' => 'string',
 192                    'required' => true,
 193                  ),
 194                  'skuId' => array(
 195                    'location' => 'path',
 196                    'type' => 'string',
 197                    'required' => true,
 198                  ),
 199                  'userId' => array(
 200                    'location' => 'path',
 201                    'type' => 'string',
 202                    'required' => true,
 203                  ),
 204                ),
 205              ),
 206            )
 207          )
 208      );
 209    }
 210  }
 211  
 212  
 213  /**
 214   * The "licenseAssignments" collection of methods.
 215   * Typical usage is:
 216   *  <code>
 217   *   $licensingService = new Google_Service_Licensing(...);
 218   *   $licenseAssignments = $licensingService->licenseAssignments;
 219   *  </code>
 220   */
 221  class Google_Service_Licensing_LicenseAssignments_Resource extends Google_Service_Resource
 222  {
 223  
 224    /**
 225     * Revoke License. (licenseAssignments.delete)
 226     *
 227     * @param string $productId Name for product
 228     * @param string $skuId Name for sku
 229     * @param string $userId email id or unique Id of the user
 230     * @param array $optParams Optional parameters.
 231     */
 232    public function delete($productId, $skuId, $userId, $optParams = array())
 233    {
 234      $params = array('productId' => $productId, 'skuId' => $skuId, 'userId' => $userId);
 235      $params = array_merge($params, $optParams);
 236      return $this->call('delete', array($params));
 237    }
 238  
 239    /**
 240     * Get license assignment of a particular product and sku for a user
 241     * (licenseAssignments.get)
 242     *
 243     * @param string $productId Name for product
 244     * @param string $skuId Name for sku
 245     * @param string $userId email id or unique Id of the user
 246     * @param array $optParams Optional parameters.
 247     * @return Google_Service_Licensing_LicenseAssignment
 248     */
 249    public function get($productId, $skuId, $userId, $optParams = array())
 250    {
 251      $params = array('productId' => $productId, 'skuId' => $skuId, 'userId' => $userId);
 252      $params = array_merge($params, $optParams);
 253      return $this->call('get', array($params), "Google_Service_Licensing_LicenseAssignment");
 254    }
 255  
 256    /**
 257     * Assign License. (licenseAssignments.insert)
 258     *
 259     * @param string $productId Name for product
 260     * @param string $skuId Name for sku
 261     * @param Google_LicenseAssignmentInsert $postBody
 262     * @param array $optParams Optional parameters.
 263     * @return Google_Service_Licensing_LicenseAssignment
 264     */
 265    public function insert($productId, $skuId, Google_Service_Licensing_LicenseAssignmentInsert $postBody, $optParams = array())
 266    {
 267      $params = array('productId' => $productId, 'skuId' => $skuId, 'postBody' => $postBody);
 268      $params = array_merge($params, $optParams);
 269      return $this->call('insert', array($params), "Google_Service_Licensing_LicenseAssignment");
 270    }
 271  
 272    /**
 273     * List license assignments for given product of the customer.
 274     * (licenseAssignments.listForProduct)
 275     *
 276     * @param string $productId Name for product
 277     * @param string $customerId CustomerId represents the customer for whom
 278     * licenseassignments are queried
 279     * @param array $optParams Optional parameters.
 280     *
 281     * @opt_param string pageToken Token to fetch the next page.Optional. By default
 282     * server will return first page
 283     * @opt_param string maxResults Maximum number of campaigns to return at one
 284     * time. Must be positive. Optional. Default value is 100.
 285     * @return Google_Service_Licensing_LicenseAssignmentList
 286     */
 287    public function listForProduct($productId, $customerId, $optParams = array())
 288    {
 289      $params = array('productId' => $productId, 'customerId' => $customerId);
 290      $params = array_merge($params, $optParams);
 291      return $this->call('listForProduct', array($params), "Google_Service_Licensing_LicenseAssignmentList");
 292    }
 293  
 294    /**
 295     * List license assignments for given product and sku of the customer.
 296     * (licenseAssignments.listForProductAndSku)
 297     *
 298     * @param string $productId Name for product
 299     * @param string $skuId Name for sku
 300     * @param string $customerId CustomerId represents the customer for whom
 301     * licenseassignments are queried
 302     * @param array $optParams Optional parameters.
 303     *
 304     * @opt_param string pageToken Token to fetch the next page.Optional. By default
 305     * server will return first page
 306     * @opt_param string maxResults Maximum number of campaigns to return at one
 307     * time. Must be positive. Optional. Default value is 100.
 308     * @return Google_Service_Licensing_LicenseAssignmentList
 309     */
 310    public function listForProductAndSku($productId, $skuId, $customerId, $optParams = array())
 311    {
 312      $params = array('productId' => $productId, 'skuId' => $skuId, 'customerId' => $customerId);
 313      $params = array_merge($params, $optParams);
 314      return $this->call('listForProductAndSku', array($params), "Google_Service_Licensing_LicenseAssignmentList");
 315    }
 316  
 317    /**
 318     * Assign License. This method supports patch semantics.
 319     * (licenseAssignments.patch)
 320     *
 321     * @param string $productId Name for product
 322     * @param string $skuId Name for sku for which license would be revoked
 323     * @param string $userId email id or unique Id of the user
 324     * @param Google_LicenseAssignment $postBody
 325     * @param array $optParams Optional parameters.
 326     * @return Google_Service_Licensing_LicenseAssignment
 327     */
 328    public function patch($productId, $skuId, $userId, Google_Service_Licensing_LicenseAssignment $postBody, $optParams = array())
 329    {
 330      $params = array('productId' => $productId, 'skuId' => $skuId, 'userId' => $userId, 'postBody' => $postBody);
 331      $params = array_merge($params, $optParams);
 332      return $this->call('patch', array($params), "Google_Service_Licensing_LicenseAssignment");
 333    }
 334  
 335    /**
 336     * Assign License. (licenseAssignments.update)
 337     *
 338     * @param string $productId Name for product
 339     * @param string $skuId Name for sku for which license would be revoked
 340     * @param string $userId email id or unique Id of the user
 341     * @param Google_LicenseAssignment $postBody
 342     * @param array $optParams Optional parameters.
 343     * @return Google_Service_Licensing_LicenseAssignment
 344     */
 345    public function update($productId, $skuId, $userId, Google_Service_Licensing_LicenseAssignment $postBody, $optParams = array())
 346    {
 347      $params = array('productId' => $productId, 'skuId' => $skuId, 'userId' => $userId, 'postBody' => $postBody);
 348      $params = array_merge($params, $optParams);
 349      return $this->call('update', array($params), "Google_Service_Licensing_LicenseAssignment");
 350    }
 351  }
 352  
 353  
 354  
 355  
 356  class Google_Service_Licensing_LicenseAssignment extends Google_Model
 357  {
 358    protected $internal_gapi_mappings = array(
 359    );
 360    public $etags;
 361    public $kind;
 362    public $productId;
 363    public $selfLink;
 364    public $skuId;
 365    public $userId;
 366  
 367  
 368    public function setEtags($etags)
 369    {
 370      $this->etags = $etags;
 371    }
 372    public function getEtags()
 373    {
 374      return $this->etags;
 375    }
 376    public function setKind($kind)
 377    {
 378      $this->kind = $kind;
 379    }
 380    public function getKind()
 381    {
 382      return $this->kind;
 383    }
 384    public function setProductId($productId)
 385    {
 386      $this->productId = $productId;
 387    }
 388    public function getProductId()
 389    {
 390      return $this->productId;
 391    }
 392    public function setSelfLink($selfLink)
 393    {
 394      $this->selfLink = $selfLink;
 395    }
 396    public function getSelfLink()
 397    {
 398      return $this->selfLink;
 399    }
 400    public function setSkuId($skuId)
 401    {
 402      $this->skuId = $skuId;
 403    }
 404    public function getSkuId()
 405    {
 406      return $this->skuId;
 407    }
 408    public function setUserId($userId)
 409    {
 410      $this->userId = $userId;
 411    }
 412    public function getUserId()
 413    {
 414      return $this->userId;
 415    }
 416  }
 417  
 418  class Google_Service_Licensing_LicenseAssignmentInsert extends Google_Model
 419  {
 420    protected $internal_gapi_mappings = array(
 421    );
 422    public $userId;
 423  
 424  
 425    public function setUserId($userId)
 426    {
 427      $this->userId = $userId;
 428    }
 429    public function getUserId()
 430    {
 431      return $this->userId;
 432    }
 433  }
 434  
 435  class Google_Service_Licensing_LicenseAssignmentList extends Google_Collection
 436  {
 437    protected $collection_key = 'items';
 438    protected $internal_gapi_mappings = array(
 439    );
 440    public $etag;
 441    protected $itemsType = 'Google_Service_Licensing_LicenseAssignment';
 442    protected $itemsDataType = 'array';
 443    public $kind;
 444    public $nextPageToken;
 445  
 446  
 447    public function setEtag($etag)
 448    {
 449      $this->etag = $etag;
 450    }
 451    public function getEtag()
 452    {
 453      return $this->etag;
 454    }
 455    public function setItems($items)
 456    {
 457      $this->items = $items;
 458    }
 459    public function getItems()
 460    {
 461      return $this->items;
 462    }
 463    public function setKind($kind)
 464    {
 465      $this->kind = $kind;
 466    }
 467    public function getKind()
 468    {
 469      return $this->kind;
 470    }
 471    public function setNextPageToken($nextPageToken)
 472    {
 473      $this->nextPageToken = $nextPageToken;
 474    }
 475    public function getNextPageToken()
 476    {
 477      return $this->nextPageToken;
 478    }
 479  }