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 Pagespeedonline (v2).
  20   *
  21   * <p>
  22   * Lets you analyze the performance of a web page and get tailored suggestions
  23   * to make that page faster.</p>
  24   *
  25   * <p>
  26   * For more information about this service, see the API
  27   * <a href="https://developers.google.com/speed/docs/insights/v2/getting-started" target="_blank">Documentation</a>
  28   * </p>
  29   *
  30   * @author Google, Inc.
  31   */
  32  class Google_Service_Pagespeedonline extends Google_Service
  33  {
  34  
  35  
  36    public $pagespeedapi;
  37    
  38  
  39    /**
  40     * Constructs the internal representation of the Pagespeedonline service.
  41     *
  42     * @param Google_Client $client
  43     */
  44    public function __construct(Google_Client $client)
  45    {
  46      parent::__construct($client);
  47      $this->rootUrl = 'https://www.googleapis.com/';
  48      $this->servicePath = 'pagespeedonline/v2/';
  49      $this->version = 'v2';
  50      $this->serviceName = 'pagespeedonline';
  51  
  52      $this->pagespeedapi = new Google_Service_Pagespeedonline_Pagespeedapi_Resource(
  53          $this,
  54          $this->serviceName,
  55          'pagespeedapi',
  56          array(
  57            'methods' => array(
  58              'runpagespeed' => array(
  59                'path' => 'runPagespeed',
  60                'httpMethod' => 'GET',
  61                'parameters' => array(
  62                  'url' => array(
  63                    'location' => 'query',
  64                    'type' => 'string',
  65                    'required' => true,
  66                  ),
  67                  'screenshot' => array(
  68                    'location' => 'query',
  69                    'type' => 'boolean',
  70                  ),
  71                  'locale' => array(
  72                    'location' => 'query',
  73                    'type' => 'string',
  74                  ),
  75                  'rule' => array(
  76                    'location' => 'query',
  77                    'type' => 'string',
  78                    'repeated' => true,
  79                  ),
  80                  'strategy' => array(
  81                    'location' => 'query',
  82                    'type' => 'string',
  83                  ),
  84                  'filter_third_party_resources' => array(
  85                    'location' => 'query',
  86                    'type' => 'boolean',
  87                  ),
  88                ),
  89              ),
  90            )
  91          )
  92      );
  93    }
  94  }
  95  
  96  
  97  /**
  98   * The "pagespeedapi" collection of methods.
  99   * Typical usage is:
 100   *  <code>
 101   *   $pagespeedonlineService = new Google_Service_Pagespeedonline(...);
 102   *   $pagespeedapi = $pagespeedonlineService->pagespeedapi;
 103   *  </code>
 104   */
 105  class Google_Service_Pagespeedonline_Pagespeedapi_Resource extends Google_Service_Resource
 106  {
 107  
 108    /**
 109     * Runs PageSpeed analysis on the page at the specified URL, and returns
 110     * PageSpeed scores, a list of suggestions to make that page faster, and other
 111     * information. (pagespeedapi.runpagespeed)
 112     *
 113     * @param string $url The URL to fetch and analyze
 114     * @param array $optParams Optional parameters.
 115     *
 116     * @opt_param bool screenshot Indicates if binary data containing a screenshot
 117     * should be included
 118     * @opt_param string locale The locale used to localize formatted results
 119     * @opt_param string rule A PageSpeed rule to run; if none are given, all rules
 120     * are run
 121     * @opt_param string strategy The analysis strategy to use
 122     * @opt_param bool filter_third_party_resources Indicates if third party
 123     * resources should be filtered out before PageSpeed analysis.
 124     * @return Google_Service_Pagespeedonline_Result
 125     */
 126    public function runpagespeed($url, $optParams = array())
 127    {
 128      $params = array('url' => $url);
 129      $params = array_merge($params, $optParams);
 130      return $this->call('runpagespeed', array($params), "Google_Service_Pagespeedonline_Result");
 131    }
 132  }
 133  
 134  
 135  
 136  
 137  class Google_Service_Pagespeedonline_PagespeedApiFormatStringV2 extends Google_Collection
 138  {
 139    protected $collection_key = 'args';
 140    protected $internal_gapi_mappings = array(
 141    );
 142    protected $argsType = 'Google_Service_Pagespeedonline_PagespeedApiFormatStringV2Args';
 143    protected $argsDataType = 'array';
 144    public $format;
 145  
 146  
 147    public function setArgs($args)
 148    {
 149      $this->args = $args;
 150    }
 151    public function getArgs()
 152    {
 153      return $this->args;
 154    }
 155    public function setFormat($format)
 156    {
 157      $this->format = $format;
 158    }
 159    public function getFormat()
 160    {
 161      return $this->format;
 162    }
 163  }
 164  
 165  class Google_Service_Pagespeedonline_PagespeedApiFormatStringV2Args extends Google_Collection
 166  {
 167    protected $collection_key = 'secondary_rects';
 168    protected $internal_gapi_mappings = array(
 169          "secondaryRects" => "secondary_rects",
 170    );
 171    public $key;
 172    protected $rectsType = 'Google_Service_Pagespeedonline_PagespeedApiFormatStringV2ArgsRects';
 173    protected $rectsDataType = 'array';
 174    protected $secondaryRectsType = 'Google_Service_Pagespeedonline_PagespeedApiFormatStringV2ArgsSecondaryRects';
 175    protected $secondaryRectsDataType = 'array';
 176    public $type;
 177    public $value;
 178  
 179  
 180    public function setKey($key)
 181    {
 182      $this->key = $key;
 183    }
 184    public function getKey()
 185    {
 186      return $this->key;
 187    }
 188    public function setRects($rects)
 189    {
 190      $this->rects = $rects;
 191    }
 192    public function getRects()
 193    {
 194      return $this->rects;
 195    }
 196    public function setSecondaryRects($secondaryRects)
 197    {
 198      $this->secondaryRects = $secondaryRects;
 199    }
 200    public function getSecondaryRects()
 201    {
 202      return $this->secondaryRects;
 203    }
 204    public function setType($type)
 205    {
 206      $this->type = $type;
 207    }
 208    public function getType()
 209    {
 210      return $this->type;
 211    }
 212    public function setValue($value)
 213    {
 214      $this->value = $value;
 215    }
 216    public function getValue()
 217    {
 218      return $this->value;
 219    }
 220  }
 221  
 222  class Google_Service_Pagespeedonline_PagespeedApiFormatStringV2ArgsRects extends Google_Model
 223  {
 224    protected $internal_gapi_mappings = array(
 225    );
 226    public $height;
 227    public $left;
 228    public $top;
 229    public $width;
 230  
 231  
 232    public function setHeight($height)
 233    {
 234      $this->height = $height;
 235    }
 236    public function getHeight()
 237    {
 238      return $this->height;
 239    }
 240    public function setLeft($left)
 241    {
 242      $this->left = $left;
 243    }
 244    public function getLeft()
 245    {
 246      return $this->left;
 247    }
 248    public function setTop($top)
 249    {
 250      $this->top = $top;
 251    }
 252    public function getTop()
 253    {
 254      return $this->top;
 255    }
 256    public function setWidth($width)
 257    {
 258      $this->width = $width;
 259    }
 260    public function getWidth()
 261    {
 262      return $this->width;
 263    }
 264  }
 265  
 266  class Google_Service_Pagespeedonline_PagespeedApiFormatStringV2ArgsSecondaryRects extends Google_Model
 267  {
 268    protected $internal_gapi_mappings = array(
 269    );
 270    public $height;
 271    public $left;
 272    public $top;
 273    public $width;
 274  
 275  
 276    public function setHeight($height)
 277    {
 278      $this->height = $height;
 279    }
 280    public function getHeight()
 281    {
 282      return $this->height;
 283    }
 284    public function setLeft($left)
 285    {
 286      $this->left = $left;
 287    }
 288    public function getLeft()
 289    {
 290      return $this->left;
 291    }
 292    public function setTop($top)
 293    {
 294      $this->top = $top;
 295    }
 296    public function getTop()
 297    {
 298      return $this->top;
 299    }
 300    public function setWidth($width)
 301    {
 302      $this->width = $width;
 303    }
 304    public function getWidth()
 305    {
 306      return $this->width;
 307    }
 308  }
 309  
 310  class Google_Service_Pagespeedonline_PagespeedApiImageV2 extends Google_Model
 311  {
 312    protected $internal_gapi_mappings = array(
 313          "mimeType" => "mime_type",
 314          "pageRect" => "page_rect",
 315    );
 316    public $data;
 317    public $height;
 318    public $key;
 319    public $mimeType;
 320    protected $pageRectType = 'Google_Service_Pagespeedonline_PagespeedApiImageV2PageRect';
 321    protected $pageRectDataType = '';
 322    public $width;
 323  
 324  
 325    public function setData($data)
 326    {
 327      $this->data = $data;
 328    }
 329    public function getData()
 330    {
 331      return $this->data;
 332    }
 333    public function setHeight($height)
 334    {
 335      $this->height = $height;
 336    }
 337    public function getHeight()
 338    {
 339      return $this->height;
 340    }
 341    public function setKey($key)
 342    {
 343      $this->key = $key;
 344    }
 345    public function getKey()
 346    {
 347      return $this->key;
 348    }
 349    public function setMimeType($mimeType)
 350    {
 351      $this->mimeType = $mimeType;
 352    }
 353    public function getMimeType()
 354    {
 355      return $this->mimeType;
 356    }
 357    public function setPageRect(Google_Service_Pagespeedonline_PagespeedApiImageV2PageRect $pageRect)
 358    {
 359      $this->pageRect = $pageRect;
 360    }
 361    public function getPageRect()
 362    {
 363      return $this->pageRect;
 364    }
 365    public function setWidth($width)
 366    {
 367      $this->width = $width;
 368    }
 369    public function getWidth()
 370    {
 371      return $this->width;
 372    }
 373  }
 374  
 375  class Google_Service_Pagespeedonline_PagespeedApiImageV2PageRect extends Google_Model
 376  {
 377    protected $internal_gapi_mappings = array(
 378    );
 379    public $height;
 380    public $left;
 381    public $top;
 382    public $width;
 383  
 384  
 385    public function setHeight($height)
 386    {
 387      $this->height = $height;
 388    }
 389    public function getHeight()
 390    {
 391      return $this->height;
 392    }
 393    public function setLeft($left)
 394    {
 395      $this->left = $left;
 396    }
 397    public function getLeft()
 398    {
 399      return $this->left;
 400    }
 401    public function setTop($top)
 402    {
 403      $this->top = $top;
 404    }
 405    public function getTop()
 406    {
 407      return $this->top;
 408    }
 409    public function setWidth($width)
 410    {
 411      $this->width = $width;
 412    }
 413    public function getWidth()
 414    {
 415      return $this->width;
 416    }
 417  }
 418  
 419  class Google_Service_Pagespeedonline_Result extends Google_Collection
 420  {
 421    protected $collection_key = 'invalidRules';
 422    protected $internal_gapi_mappings = array(
 423    );
 424    protected $formattedResultsType = 'Google_Service_Pagespeedonline_ResultFormattedResults';
 425    protected $formattedResultsDataType = '';
 426    public $id;
 427    public $invalidRules;
 428    public $kind;
 429    protected $pageStatsType = 'Google_Service_Pagespeedonline_ResultPageStats';
 430    protected $pageStatsDataType = '';
 431    public $responseCode;
 432    protected $ruleGroupsType = 'Google_Service_Pagespeedonline_ResultRuleGroupsElement';
 433    protected $ruleGroupsDataType = 'map';
 434    protected $screenshotType = 'Google_Service_Pagespeedonline_PagespeedApiImageV2';
 435    protected $screenshotDataType = '';
 436    public $title;
 437    protected $versionType = 'Google_Service_Pagespeedonline_ResultVersion';
 438    protected $versionDataType = '';
 439  
 440  
 441    public function setFormattedResults(Google_Service_Pagespeedonline_ResultFormattedResults $formattedResults)
 442    {
 443      $this->formattedResults = $formattedResults;
 444    }
 445    public function getFormattedResults()
 446    {
 447      return $this->formattedResults;
 448    }
 449    public function setId($id)
 450    {
 451      $this->id = $id;
 452    }
 453    public function getId()
 454    {
 455      return $this->id;
 456    }
 457    public function setInvalidRules($invalidRules)
 458    {
 459      $this->invalidRules = $invalidRules;
 460    }
 461    public function getInvalidRules()
 462    {
 463      return $this->invalidRules;
 464    }
 465    public function setKind($kind)
 466    {
 467      $this->kind = $kind;
 468    }
 469    public function getKind()
 470    {
 471      return $this->kind;
 472    }
 473    public function setPageStats(Google_Service_Pagespeedonline_ResultPageStats $pageStats)
 474    {
 475      $this->pageStats = $pageStats;
 476    }
 477    public function getPageStats()
 478    {
 479      return $this->pageStats;
 480    }
 481    public function setResponseCode($responseCode)
 482    {
 483      $this->responseCode = $responseCode;
 484    }
 485    public function getResponseCode()
 486    {
 487      return $this->responseCode;
 488    }
 489    public function setRuleGroups($ruleGroups)
 490    {
 491      $this->ruleGroups = $ruleGroups;
 492    }
 493    public function getRuleGroups()
 494    {
 495      return $this->ruleGroups;
 496    }
 497    public function setScreenshot(Google_Service_Pagespeedonline_PagespeedApiImageV2 $screenshot)
 498    {
 499      $this->screenshot = $screenshot;
 500    }
 501    public function getScreenshot()
 502    {
 503      return $this->screenshot;
 504    }
 505    public function setTitle($title)
 506    {
 507      $this->title = $title;
 508    }
 509    public function getTitle()
 510    {
 511      return $this->title;
 512    }
 513    public function setVersion(Google_Service_Pagespeedonline_ResultVersion $version)
 514    {
 515      $this->version = $version;
 516    }
 517    public function getVersion()
 518    {
 519      return $this->version;
 520    }
 521  }
 522  
 523  class Google_Service_Pagespeedonline_ResultFormattedResults extends Google_Model
 524  {
 525    protected $internal_gapi_mappings = array(
 526    );
 527    public $locale;
 528    protected $ruleResultsType = 'Google_Service_Pagespeedonline_ResultFormattedResultsRuleResultsElement';
 529    protected $ruleResultsDataType = 'map';
 530  
 531  
 532    public function setLocale($locale)
 533    {
 534      $this->locale = $locale;
 535    }
 536    public function getLocale()
 537    {
 538      return $this->locale;
 539    }
 540    public function setRuleResults($ruleResults)
 541    {
 542      $this->ruleResults = $ruleResults;
 543    }
 544    public function getRuleResults()
 545    {
 546      return $this->ruleResults;
 547    }
 548  }
 549  
 550  class Google_Service_Pagespeedonline_ResultFormattedResultsRuleResults extends Google_Model
 551  {
 552  }
 553  
 554  class Google_Service_Pagespeedonline_ResultFormattedResultsRuleResultsElement extends Google_Collection
 555  {
 556    protected $collection_key = 'urlBlocks';
 557    protected $internal_gapi_mappings = array(
 558    );
 559    public $groups;
 560    public $localizedRuleName;
 561    public $ruleImpact;
 562    protected $summaryType = 'Google_Service_Pagespeedonline_PagespeedApiFormatStringV2';
 563    protected $summaryDataType = '';
 564    protected $urlBlocksType = 'Google_Service_Pagespeedonline_ResultFormattedResultsRuleResultsElementUrlBlocks';
 565    protected $urlBlocksDataType = 'array';
 566  
 567  
 568    public function setGroups($groups)
 569    {
 570      $this->groups = $groups;
 571    }
 572    public function getGroups()
 573    {
 574      return $this->groups;
 575    }
 576    public function setLocalizedRuleName($localizedRuleName)
 577    {
 578      $this->localizedRuleName = $localizedRuleName;
 579    }
 580    public function getLocalizedRuleName()
 581    {
 582      return $this->localizedRuleName;
 583    }
 584    public function setRuleImpact($ruleImpact)
 585    {
 586      $this->ruleImpact = $ruleImpact;
 587    }
 588    public function getRuleImpact()
 589    {
 590      return $this->ruleImpact;
 591    }
 592    public function setSummary(Google_Service_Pagespeedonline_PagespeedApiFormatStringV2 $summary)
 593    {
 594      $this->summary = $summary;
 595    }
 596    public function getSummary()
 597    {
 598      return $this->summary;
 599    }
 600    public function setUrlBlocks($urlBlocks)
 601    {
 602      $this->urlBlocks = $urlBlocks;
 603    }
 604    public function getUrlBlocks()
 605    {
 606      return $this->urlBlocks;
 607    }
 608  }
 609  
 610  class Google_Service_Pagespeedonline_ResultFormattedResultsRuleResultsElementUrlBlocks extends Google_Collection
 611  {
 612    protected $collection_key = 'urls';
 613    protected $internal_gapi_mappings = array(
 614    );
 615    protected $headerType = 'Google_Service_Pagespeedonline_PagespeedApiFormatStringV2';
 616    protected $headerDataType = '';
 617    protected $urlsType = 'Google_Service_Pagespeedonline_ResultFormattedResultsRuleResultsElementUrlBlocksUrls';
 618    protected $urlsDataType = 'array';
 619  
 620  
 621    public function setHeader(Google_Service_Pagespeedonline_PagespeedApiFormatStringV2 $header)
 622    {
 623      $this->header = $header;
 624    }
 625    public function getHeader()
 626    {
 627      return $this->header;
 628    }
 629    public function setUrls($urls)
 630    {
 631      $this->urls = $urls;
 632    }
 633    public function getUrls()
 634    {
 635      return $this->urls;
 636    }
 637  }
 638  
 639  class Google_Service_Pagespeedonline_ResultFormattedResultsRuleResultsElementUrlBlocksUrls extends Google_Collection
 640  {
 641    protected $collection_key = 'details';
 642    protected $internal_gapi_mappings = array(
 643    );
 644    protected $detailsType = 'Google_Service_Pagespeedonline_PagespeedApiFormatStringV2';
 645    protected $detailsDataType = 'array';
 646    protected $resultType = 'Google_Service_Pagespeedonline_PagespeedApiFormatStringV2';
 647    protected $resultDataType = '';
 648  
 649  
 650    public function setDetails($details)
 651    {
 652      $this->details = $details;
 653    }
 654    public function getDetails()
 655    {
 656      return $this->details;
 657    }
 658    public function setResult(Google_Service_Pagespeedonline_PagespeedApiFormatStringV2 $result)
 659    {
 660      $this->result = $result;
 661    }
 662    public function getResult()
 663    {
 664      return $this->result;
 665    }
 666  }
 667  
 668  class Google_Service_Pagespeedonline_ResultPageStats extends Google_Model
 669  {
 670    protected $internal_gapi_mappings = array(
 671    );
 672    public $cssResponseBytes;
 673    public $flashResponseBytes;
 674    public $htmlResponseBytes;
 675    public $imageResponseBytes;
 676    public $javascriptResponseBytes;
 677    public $numberCssResources;
 678    public $numberHosts;
 679    public $numberJsResources;
 680    public $numberResources;
 681    public $numberStaticResources;
 682    public $otherResponseBytes;
 683    public $textResponseBytes;
 684    public $totalRequestBytes;
 685  
 686  
 687    public function setCssResponseBytes($cssResponseBytes)
 688    {
 689      $this->cssResponseBytes = $cssResponseBytes;
 690    }
 691    public function getCssResponseBytes()
 692    {
 693      return $this->cssResponseBytes;
 694    }
 695    public function setFlashResponseBytes($flashResponseBytes)
 696    {
 697      $this->flashResponseBytes = $flashResponseBytes;
 698    }
 699    public function getFlashResponseBytes()
 700    {
 701      return $this->flashResponseBytes;
 702    }
 703    public function setHtmlResponseBytes($htmlResponseBytes)
 704    {
 705      $this->htmlResponseBytes = $htmlResponseBytes;
 706    }
 707    public function getHtmlResponseBytes()
 708    {
 709      return $this->htmlResponseBytes;
 710    }
 711    public function setImageResponseBytes($imageResponseBytes)
 712    {
 713      $this->imageResponseBytes = $imageResponseBytes;
 714    }
 715    public function getImageResponseBytes()
 716    {
 717      return $this->imageResponseBytes;
 718    }
 719    public function setJavascriptResponseBytes($javascriptResponseBytes)
 720    {
 721      $this->javascriptResponseBytes = $javascriptResponseBytes;
 722    }
 723    public function getJavascriptResponseBytes()
 724    {
 725      return $this->javascriptResponseBytes;
 726    }
 727    public function setNumberCssResources($numberCssResources)
 728    {
 729      $this->numberCssResources = $numberCssResources;
 730    }
 731    public function getNumberCssResources()
 732    {
 733      return $this->numberCssResources;
 734    }
 735    public function setNumberHosts($numberHosts)
 736    {
 737      $this->numberHosts = $numberHosts;
 738    }
 739    public function getNumberHosts()
 740    {
 741      return $this->numberHosts;
 742    }
 743    public function setNumberJsResources($numberJsResources)
 744    {
 745      $this->numberJsResources = $numberJsResources;
 746    }
 747    public function getNumberJsResources()
 748    {
 749      return $this->numberJsResources;
 750    }
 751    public function setNumberResources($numberResources)
 752    {
 753      $this->numberResources = $numberResources;
 754    }
 755    public function getNumberResources()
 756    {
 757      return $this->numberResources;
 758    }
 759    public function setNumberStaticResources($numberStaticResources)
 760    {
 761      $this->numberStaticResources = $numberStaticResources;
 762    }
 763    public function getNumberStaticResources()
 764    {
 765      return $this->numberStaticResources;
 766    }
 767    public function setOtherResponseBytes($otherResponseBytes)
 768    {
 769      $this->otherResponseBytes = $otherResponseBytes;
 770    }
 771    public function getOtherResponseBytes()
 772    {
 773      return $this->otherResponseBytes;
 774    }
 775    public function setTextResponseBytes($textResponseBytes)
 776    {
 777      $this->textResponseBytes = $textResponseBytes;
 778    }
 779    public function getTextResponseBytes()
 780    {
 781      return $this->textResponseBytes;
 782    }
 783    public function setTotalRequestBytes($totalRequestBytes)
 784    {
 785      $this->totalRequestBytes = $totalRequestBytes;
 786    }
 787    public function getTotalRequestBytes()
 788    {
 789      return $this->totalRequestBytes;
 790    }
 791  }
 792  
 793  class Google_Service_Pagespeedonline_ResultRuleGroups extends Google_Model
 794  {
 795  }
 796  
 797  class Google_Service_Pagespeedonline_ResultRuleGroupsElement extends Google_Model
 798  {
 799    protected $internal_gapi_mappings = array(
 800    );
 801    public $score;
 802  
 803  
 804    public function setScore($score)
 805    {
 806      $this->score = $score;
 807    }
 808    public function getScore()
 809    {
 810      return $this->score;
 811    }
 812  }
 813  
 814  class Google_Service_Pagespeedonline_ResultVersion extends Google_Model
 815  {
 816    protected $internal_gapi_mappings = array(
 817    );
 818    public $major;
 819    public $minor;
 820  
 821  
 822    public function setMajor($major)
 823    {
 824      $this->major = $major;
 825    }
 826    public function getMajor()
 827    {
 828      return $this->major;
 829    }
 830    public function setMinor($minor)
 831    {
 832      $this->minor = $minor;
 833    }
 834    public function getMinor()
 835    {
 836      return $this->minor;
 837    }
 838  }