Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.2.x will end 22 April 2024 (12 months).
  • Bug fixes for security issues in 4.2.x will end 7 October 2024 (18 months).
  • PHP version: minimum PHP 8.0.0 Note: minimum PHP version has increased since Moodle 4.1. PHP 8.1.x is supported too.

Differences Between: [Versions 310 and 402] [Versions 311 and 402] [Versions 39 and 402] [Versions 400 and 402] [Versions 401 and 402]

   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 Urlshortener (v1).
  20   *
  21   * <p>
  22   * Lets you create, inspect, and manage goo.gl short URLs</p>
  23   *
  24   * <p>
  25   * For more information about this service, see the API
  26   * <a href="https://developers.google.com/url-shortener/v1/getting_started" target="_blank">Documentation</a>
  27   * </p>
  28   *
  29   * @author Google, Inc.
  30   */
  31  #[AllowDynamicProperties]
  32  class Google_Service_Urlshortener extends Google_Service
  33  {
  34    /** Manage your goo.gl short URLs. */
  35    const URLSHORTENER =
  36        "https://www.googleapis.com/auth/urlshortener";
  37  
  38    public $url;
  39    
  40  
  41    /**
  42     * Constructs the internal representation of the Urlshortener service.
  43     *
  44     * @param Google_Client $client
  45     */
  46    public function __construct(Google_Client $client)
  47    {
  48      parent::__construct($client);
  49      $this->rootUrl = 'https://www.googleapis.com/';
  50      $this->servicePath = 'urlshortener/v1/';
  51      $this->version = 'v1';
  52      $this->serviceName = 'urlshortener';
  53  
  54      $this->url = new Google_Service_Urlshortener_Url_Resource(
  55          $this,
  56          $this->serviceName,
  57          'url',
  58          array(
  59            'methods' => array(
  60              'get' => array(
  61                'path' => 'url',
  62                'httpMethod' => 'GET',
  63                'parameters' => array(
  64                  'shortUrl' => array(
  65                    'location' => 'query',
  66                    'type' => 'string',
  67                    'required' => true,
  68                  ),
  69                  'projection' => array(
  70                    'location' => 'query',
  71                    'type' => 'string',
  72                  ),
  73                ),
  74              ),'insert' => array(
  75                'path' => 'url',
  76                'httpMethod' => 'POST',
  77                'parameters' => array(),
  78              ),'list' => array(
  79                'path' => 'url/history',
  80                'httpMethod' => 'GET',
  81                'parameters' => array(
  82                  'start-token' => array(
  83                    'location' => 'query',
  84                    'type' => 'string',
  85                  ),
  86                  'projection' => array(
  87                    'location' => 'query',
  88                    'type' => 'string',
  89                  ),
  90                ),
  91              ),
  92            )
  93          )
  94      );
  95    }
  96  }
  97  
  98  
  99  /**
 100   * The "url" collection of methods.
 101   * Typical usage is:
 102   *  <code>
 103   *   $urlshortenerService = new Google_Service_Urlshortener(...);
 104   *   $url = $urlshortenerService->url;
 105   *  </code>
 106   */
 107  #[AllowDynamicProperties]
 108  class Google_Service_Urlshortener_Url_Resource extends Google_Service_Resource
 109  {
 110  
 111    /**
 112     * Expands a short URL or gets creation time and analytics. (url.get)
 113     *
 114     * @param string $shortUrl The short URL, including the protocol.
 115     * @param array $optParams Optional parameters.
 116     *
 117     * @opt_param string projection Additional information to return.
 118     * @return Google_Service_Urlshortener_Url
 119     */
 120    public function get($shortUrl, $optParams = array())
 121    {
 122      $params = array('shortUrl' => $shortUrl);
 123      $params = array_merge($params, $optParams);
 124      return $this->call('get', array($params), "Google_Service_Urlshortener_Url");
 125    }
 126  
 127    /**
 128     * Creates a new short URL. (url.insert)
 129     *
 130     * @param Google_Url $postBody
 131     * @param array $optParams Optional parameters.
 132     * @return Google_Service_Urlshortener_Url
 133     */
 134    public function insert(Google_Service_Urlshortener_Url $postBody, $optParams = array())
 135    {
 136      $params = array('postBody' => $postBody);
 137      $params = array_merge($params, $optParams);
 138      return $this->call('insert', array($params), "Google_Service_Urlshortener_Url");
 139    }
 140  
 141    /**
 142     * Retrieves a list of URLs shortened by a user. (url.listUrl)
 143     *
 144     * @param array $optParams Optional parameters.
 145     *
 146     * @opt_param string start-token Token for requesting successive pages of
 147     * results.
 148     * @opt_param string projection Additional information to return.
 149     * @return Google_Service_Urlshortener_UrlHistory
 150     */
 151    public function listUrl($optParams = array())
 152    {
 153      $params = array();
 154      $params = array_merge($params, $optParams);
 155      return $this->call('list', array($params), "Google_Service_Urlshortener_UrlHistory");
 156    }
 157  }
 158  
 159  
 160  
 161  
 162  #[AllowDynamicProperties]
 163  class Google_Service_Urlshortener_AnalyticsSnapshot extends Google_Collection
 164  {
 165    protected $collection_key = 'referrers';
 166    protected $internal_gapi_mappings = array(
 167    );
 168    protected $browsersType = 'Google_Service_Urlshortener_StringCount';
 169    protected $browsersDataType = 'array';
 170    protected $countriesType = 'Google_Service_Urlshortener_StringCount';
 171    protected $countriesDataType = 'array';
 172    public $longUrlClicks;
 173    protected $platformsType = 'Google_Service_Urlshortener_StringCount';
 174    protected $platformsDataType = 'array';
 175    protected $referrersType = 'Google_Service_Urlshortener_StringCount';
 176    protected $referrersDataType = 'array';
 177    public $shortUrlClicks;
 178  
 179  
 180    public function setBrowsers($browsers)
 181    {
 182      $this->browsers = $browsers;
 183    }
 184    public function getBrowsers()
 185    {
 186      return $this->browsers;
 187    }
 188    public function setCountries($countries)
 189    {
 190      $this->countries = $countries;
 191    }
 192    public function getCountries()
 193    {
 194      return $this->countries;
 195    }
 196    public function setLongUrlClicks($longUrlClicks)
 197    {
 198      $this->longUrlClicks = $longUrlClicks;
 199    }
 200    public function getLongUrlClicks()
 201    {
 202      return $this->longUrlClicks;
 203    }
 204    public function setPlatforms($platforms)
 205    {
 206      $this->platforms = $platforms;
 207    }
 208    public function getPlatforms()
 209    {
 210      return $this->platforms;
 211    }
 212    public function setReferrers($referrers)
 213    {
 214      $this->referrers = $referrers;
 215    }
 216    public function getReferrers()
 217    {
 218      return $this->referrers;
 219    }
 220    public function setShortUrlClicks($shortUrlClicks)
 221    {
 222      $this->shortUrlClicks = $shortUrlClicks;
 223    }
 224    public function getShortUrlClicks()
 225    {
 226      return $this->shortUrlClicks;
 227    }
 228  }
 229  
 230  #[AllowDynamicProperties]
 231  class Google_Service_Urlshortener_AnalyticsSummary extends Google_Model
 232  {
 233    protected $internal_gapi_mappings = array(
 234    );
 235    protected $allTimeType = 'Google_Service_Urlshortener_AnalyticsSnapshot';
 236    protected $allTimeDataType = '';
 237    protected $dayType = 'Google_Service_Urlshortener_AnalyticsSnapshot';
 238    protected $dayDataType = '';
 239    protected $monthType = 'Google_Service_Urlshortener_AnalyticsSnapshot';
 240    protected $monthDataType = '';
 241    protected $twoHoursType = 'Google_Service_Urlshortener_AnalyticsSnapshot';
 242    protected $twoHoursDataType = '';
 243    protected $weekType = 'Google_Service_Urlshortener_AnalyticsSnapshot';
 244    protected $weekDataType = '';
 245  
 246  
 247    public function setAllTime(Google_Service_Urlshortener_AnalyticsSnapshot $allTime)
 248    {
 249      $this->allTime = $allTime;
 250    }
 251    public function getAllTime()
 252    {
 253      return $this->allTime;
 254    }
 255    public function setDay(Google_Service_Urlshortener_AnalyticsSnapshot $day)
 256    {
 257      $this->day = $day;
 258    }
 259    public function getDay()
 260    {
 261      return $this->day;
 262    }
 263    public function setMonth(Google_Service_Urlshortener_AnalyticsSnapshot $month)
 264    {
 265      $this->month = $month;
 266    }
 267    public function getMonth()
 268    {
 269      return $this->month;
 270    }
 271    public function setTwoHours(Google_Service_Urlshortener_AnalyticsSnapshot $twoHours)
 272    {
 273      $this->twoHours = $twoHours;
 274    }
 275    public function getTwoHours()
 276    {
 277      return $this->twoHours;
 278    }
 279    public function setWeek(Google_Service_Urlshortener_AnalyticsSnapshot $week)
 280    {
 281      $this->week = $week;
 282    }
 283    public function getWeek()
 284    {
 285      return $this->week;
 286    }
 287  }
 288  
 289  #[AllowDynamicProperties]
 290  class Google_Service_Urlshortener_StringCount extends Google_Model
 291  {
 292    protected $internal_gapi_mappings = array(
 293    );
 294    public $count;
 295    public $id;
 296  
 297  
 298    public function setCount($count)
 299    {
 300      $this->count = $count;
 301    }
 302    public function getCount()
 303    {
 304      return $this->count;
 305    }
 306    public function setId($id)
 307    {
 308      $this->id = $id;
 309    }
 310    public function getId()
 311    {
 312      return $this->id;
 313    }
 314  }
 315  
 316  #[AllowDynamicProperties]
 317  class Google_Service_Urlshortener_Url extends Google_Model
 318  {
 319    protected $internal_gapi_mappings = array(
 320    );
 321    protected $analyticsType = 'Google_Service_Urlshortener_AnalyticsSummary';
 322    protected $analyticsDataType = '';
 323    public $created;
 324    public $id;
 325    public $kind;
 326    public $longUrl;
 327    public $status;
 328  
 329  
 330    public function setAnalytics(Google_Service_Urlshortener_AnalyticsSummary $analytics)
 331    {
 332      $this->analytics = $analytics;
 333    }
 334    public function getAnalytics()
 335    {
 336      return $this->analytics;
 337    }
 338    public function setCreated($created)
 339    {
 340      $this->created = $created;
 341    }
 342    public function getCreated()
 343    {
 344      return $this->created;
 345    }
 346    public function setId($id)
 347    {
 348      $this->id = $id;
 349    }
 350    public function getId()
 351    {
 352      return $this->id;
 353    }
 354    public function setKind($kind)
 355    {
 356      $this->kind = $kind;
 357    }
 358    public function getKind()
 359    {
 360      return $this->kind;
 361    }
 362    public function setLongUrl($longUrl)
 363    {
 364      $this->longUrl = $longUrl;
 365    }
 366    public function getLongUrl()
 367    {
 368      return $this->longUrl;
 369    }
 370    public function setStatus($status)
 371    {
 372      $this->status = $status;
 373    }
 374    public function getStatus()
 375    {
 376      return $this->status;
 377    }
 378  }
 379  
 380  #[AllowDynamicProperties]
 381  class Google_Service_Urlshortener_UrlHistory extends Google_Collection
 382  {
 383    protected $collection_key = 'items';
 384    protected $internal_gapi_mappings = array(
 385    );
 386    protected $itemsType = 'Google_Service_Urlshortener_Url';
 387    protected $itemsDataType = 'array';
 388    public $itemsPerPage;
 389    public $kind;
 390    public $nextPageToken;
 391    public $totalItems;
 392  
 393  
 394    public function setItems($items)
 395    {
 396      $this->items = $items;
 397    }
 398    public function getItems()
 399    {
 400      return $this->items;
 401    }
 402    public function setItemsPerPage($itemsPerPage)
 403    {
 404      $this->itemsPerPage = $itemsPerPage;
 405    }
 406    public function getItemsPerPage()
 407    {
 408      return $this->itemsPerPage;
 409    }
 410    public function setKind($kind)
 411    {
 412      $this->kind = $kind;
 413    }
 414    public function getKind()
 415    {
 416      return $this->kind;
 417    }
 418    public function setNextPageToken($nextPageToken)
 419    {
 420      $this->nextPageToken = $nextPageToken;
 421    }
 422    public function getNextPageToken()
 423    {
 424      return $this->nextPageToken;
 425    }
 426    public function setTotalItems($totalItems)
 427    {
 428      $this->totalItems = $totalItems;
 429    }
 430    public function getTotalItems()
 431    {
 432      return $this->totalItems;
 433    }
 434  }