Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

  • Bug fixes for general core bugs in 4.1.x will end 13 November 2023 (12 months).
  • Bug fixes for security issues in 4.1.x will end 10 November 2025 (36 months).
  • PHP version: minimum PHP 7.4.0 Note: minimum PHP version has increased since Moodle 4.0. PHP 8.0.x is supported too.

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