1<?php
2/*
3 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
4 * use this file except in compliance with the License. You may obtain a copy of
5 * the License at
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12 * License for the specific language governing permissions and limitations under
13 * the License.
14 */
15
16
17  /**
18   * The "pagespeedapi" collection of methods.
19   * Typical usage is:
20   *  <code>
21   *   $pagespeedonlineService = new Google_PagespeedonlineService(...);
22   *   $pagespeedapi = $pagespeedonlineService->pagespeedapi;
23   *  </code>
24   */
25  class Google_PagespeedapiServiceResource extends Google_ServiceResource {
26
27    /**
28     * Runs Page Speed analysis on the page at the specified URL, and returns a Page Speed score, a list
29     * of suggestions to make that page faster, and other information. (pagespeedapi.runpagespeed)
30     *
31     * @param string $url The URL to fetch and analyze
32     * @param array $optParams Optional parameters.
33     *
34     * @opt_param string locale The locale used to localize formatted results
35     * @opt_param string rule A Page Speed rule to run; if none are given, all rules are run
36     * @opt_param bool screenshot Indicates if binary data containing a screenshot should be included
37     * @opt_param string strategy The analysis strategy to use
38     * @return Google_Result
39     */
40    public function runpagespeed($url, $optParams = array()) {
41      $params = array('url' => $url);
42      $params = array_merge($params, $optParams);
43      $data = $this->__call('runpagespeed', array($params));
44      if ($this->useObjects()) {
45        return new Google_Result($data);
46      } else {
47        return $data;
48      }
49    }
50  }
51
52/**
53 * Service definition for Google_Pagespeedonline (v1).
54 *
55 * <p>
56 * Lets you analyze the performance of a web page and get tailored suggestions to make that page faster.
57 * </p>
58 *
59 * <p>
60 * For more information about this service, see the
61 * <a href="https://developers.google.com/speed/docs/insights/v1/getting_started" target="_blank">API Documentation</a>
62 * </p>
63 *
64 * @author Google, Inc.
65 */
66class Google_PagespeedonlineService extends Google_Service {
67  public $pagespeedapi;
68  /**
69   * Constructs the internal representation of the Pagespeedonline service.
70   *
71   * @param Google_Client $client
72   */
73  public function __construct(Google_Client $client) {
74    $this->servicePath = 'pagespeedonline/v1/';
75    $this->version = 'v1';
76    $this->serviceName = 'pagespeedonline';
77
78    $client->addService($this->serviceName, $this->version);
79    $this->pagespeedapi = new Google_PagespeedapiServiceResource($this, $this->serviceName, 'pagespeedapi', json_decode('{"methods": {"runpagespeed": {"id": "pagespeedonline.pagespeedapi.runpagespeed", "path": "runPagespeed", "httpMethod": "GET", "parameters": {"locale": {"type": "string", "location": "query"}, "rule": {"type": "string", "repeated": true, "location": "query"}, "screenshot": {"type": "boolean", "default": "false", "location": "query"}, "strategy": {"type": "string", "enum": ["desktop", "mobile"], "location": "query"}, "url": {"type": "string", "required": true, "location": "query"}}, "response": {"$ref": "Result"}}}}', true));
80
81  }
82}
83
84
85
86class Google_Result extends Google_Model {
87  protected $__formattedResultsType = 'Google_ResultFormattedResults';
88  protected $__formattedResultsDataType = '';
89  public $formattedResults;
90  public $id;
91  public $invalidRules;
92  public $kind;
93  protected $__pageStatsType = 'Google_ResultPageStats';
94  protected $__pageStatsDataType = '';
95  public $pageStats;
96  public $responseCode;
97  public $score;
98  protected $__screenshotType = 'Google_ResultScreenshot';
99  protected $__screenshotDataType = '';
100  public $screenshot;
101  public $title;
102  protected $__versionType = 'Google_ResultVersion';
103  protected $__versionDataType = '';
104  public $version;
105  public function setFormattedResults(Google_ResultFormattedResults $formattedResults) {
106    $this->formattedResults = $formattedResults;
107  }
108  public function getFormattedResults() {
109    return $this->formattedResults;
110  }
111  public function setId( $id) {
112    $this->id = $id;
113  }
114  public function getId() {
115    return $this->id;
116  }
117  public function setInvalidRules(/* array(Google_string) */ $invalidRules) {
118    $this->assertIsArray($invalidRules, 'Google_string', __METHOD__);
119    $this->invalidRules = $invalidRules;
120  }
121  public function getInvalidRules() {
122    return $this->invalidRules;
123  }
124  public function setKind( $kind) {
125    $this->kind = $kind;
126  }
127  public function getKind() {
128    return $this->kind;
129  }
130  public function setPageStats(Google_ResultPageStats $pageStats) {
131    $this->pageStats = $pageStats;
132  }
133  public function getPageStats() {
134    return $this->pageStats;
135  }
136  public function setResponseCode( $responseCode) {
137    $this->responseCode = $responseCode;
138  }
139  public function getResponseCode() {
140    return $this->responseCode;
141  }
142  public function setScore( $score) {
143    $this->score = $score;
144  }
145  public function getScore() {
146    return $this->score;
147  }
148  public function setScreenshot(Google_ResultScreenshot $screenshot) {
149    $this->screenshot = $screenshot;
150  }
151  public function getScreenshot() {
152    return $this->screenshot;
153  }
154  public function setTitle( $title) {
155    $this->title = $title;
156  }
157  public function getTitle() {
158    return $this->title;
159  }
160  public function setVersion(Google_ResultVersion $version) {
161    $this->version = $version;
162  }
163  public function getVersion() {
164    return $this->version;
165  }
166}
167
168class Google_ResultFormattedResults extends Google_Model {
169  public $locale;
170  protected $__ruleResultsType = 'Google_ResultFormattedResultsRuleResultsElement';
171  protected $__ruleResultsDataType = 'map';
172  public $ruleResults;
173  public function setLocale( $locale) {
174    $this->locale = $locale;
175  }
176  public function getLocale() {
177    return $this->locale;
178  }
179  public function setRuleResults(Google_ResultFormattedResultsRuleResultsElement $ruleResults) {
180    $this->ruleResults = $ruleResults;
181  }
182  public function getRuleResults() {
183    return $this->ruleResults;
184  }
185}
186
187class Google_ResultFormattedResultsRuleResultsElement extends Google_Model {
188  public $localizedRuleName;
189  public $ruleImpact;
190  public $ruleScore;
191  protected $__urlBlocksType = 'Google_ResultFormattedResultsRuleResultsElementUrlBlocks';
192  protected $__urlBlocksDataType = 'array';
193  public $urlBlocks;
194  public function setLocalizedRuleName( $localizedRuleName) {
195    $this->localizedRuleName = $localizedRuleName;
196  }
197  public function getLocalizedRuleName() {
198    return $this->localizedRuleName;
199  }
200  public function setRuleImpact( $ruleImpact) {
201    $this->ruleImpact = $ruleImpact;
202  }
203  public function getRuleImpact() {
204    return $this->ruleImpact;
205  }
206  public function setRuleScore( $ruleScore) {
207    $this->ruleScore = $ruleScore;
208  }
209  public function getRuleScore() {
210    return $this->ruleScore;
211  }
212  public function setUrlBlocks(/* array(Google_ResultFormattedResultsRuleResultsElementUrlBlocks) */ $urlBlocks) {
213    $this->assertIsArray($urlBlocks, 'Google_ResultFormattedResultsRuleResultsElementUrlBlocks', __METHOD__);
214    $this->urlBlocks = $urlBlocks;
215  }
216  public function getUrlBlocks() {
217    return $this->urlBlocks;
218  }
219}
220
221class Google_ResultFormattedResultsRuleResultsElementUrlBlocks extends Google_Model {
222  protected $__headerType = 'Google_ResultFormattedResultsRuleResultsElementUrlBlocksHeader';
223  protected $__headerDataType = '';
224  public $header;
225  protected $__urlsType = 'Google_ResultFormattedResultsRuleResultsElementUrlBlocksUrls';
226  protected $__urlsDataType = 'array';
227  public $urls;
228  public function setHeader(Google_ResultFormattedResultsRuleResultsElementUrlBlocksHeader $header) {
229    $this->header = $header;
230  }
231  public function getHeader() {
232    return $this->header;
233  }
234  public function setUrls(/* array(Google_ResultFormattedResultsRuleResultsElementUrlBlocksUrls) */ $urls) {
235    $this->assertIsArray($urls, 'Google_ResultFormattedResultsRuleResultsElementUrlBlocksUrls', __METHOD__);
236    $this->urls = $urls;
237  }
238  public function getUrls() {
239    return $this->urls;
240  }
241}
242
243class Google_ResultFormattedResultsRuleResultsElementUrlBlocksHeader extends Google_Model {
244  protected $__argsType = 'Google_ResultFormattedResultsRuleResultsElementUrlBlocksHeaderArgs';
245  protected $__argsDataType = 'array';
246  public $args;
247  public $format;
248  public function setArgs(/* array(Google_ResultFormattedResultsRuleResultsElementUrlBlocksHeaderArgs) */ $args) {
249    $this->assertIsArray($args, 'Google_ResultFormattedResultsRuleResultsElementUrlBlocksHeaderArgs', __METHOD__);
250    $this->args = $args;
251  }
252  public function getArgs() {
253    return $this->args;
254  }
255  public function setFormat( $format) {
256    $this->format = $format;
257  }
258  public function getFormat() {
259    return $this->format;
260  }
261}
262
263class Google_ResultFormattedResultsRuleResultsElementUrlBlocksHeaderArgs extends Google_Model {
264  public $type;
265  public $value;
266  public function setType( $type) {
267    $this->type = $type;
268  }
269  public function getType() {
270    return $this->type;
271  }
272  public function setValue( $value) {
273    $this->value = $value;
274  }
275  public function getValue() {
276    return $this->value;
277  }
278}
279
280class Google_ResultFormattedResultsRuleResultsElementUrlBlocksUrls extends Google_Model {
281  protected $__detailsType = 'Google_ResultFormattedResultsRuleResultsElementUrlBlocksUrlsDetails';
282  protected $__detailsDataType = 'array';
283  public $details;
284  protected $__resultType = 'Google_ResultFormattedResultsRuleResultsElementUrlBlocksUrlsResult';
285  protected $__resultDataType = '';
286  public $result;
287  public function setDetails(/* array(Google_ResultFormattedResultsRuleResultsElementUrlBlocksUrlsDetails) */ $details) {
288    $this->assertIsArray($details, 'Google_ResultFormattedResultsRuleResultsElementUrlBlocksUrlsDetails', __METHOD__);
289    $this->details = $details;
290  }
291  public function getDetails() {
292    return $this->details;
293  }
294  public function setResult(Google_ResultFormattedResultsRuleResultsElementUrlBlocksUrlsResult $result) {
295    $this->result = $result;
296  }
297  public function getResult() {
298    return $this->result;
299  }
300}
301
302class Google_ResultFormattedResultsRuleResultsElementUrlBlocksUrlsDetails extends Google_Model {
303  protected $__argsType = 'Google_ResultFormattedResultsRuleResultsElementUrlBlocksUrlsDetailsArgs';
304  protected $__argsDataType = 'array';
305  public $args;
306  public $format;
307  public function setArgs(/* array(Google_ResultFormattedResultsRuleResultsElementUrlBlocksUrlsDetailsArgs) */ $args) {
308    $this->assertIsArray($args, 'Google_ResultFormattedResultsRuleResultsElementUrlBlocksUrlsDetailsArgs', __METHOD__);
309    $this->args = $args;
310  }
311  public function getArgs() {
312    return $this->args;
313  }
314  public function setFormat( $format) {
315    $this->format = $format;
316  }
317  public function getFormat() {
318    return $this->format;
319  }
320}
321
322class Google_ResultFormattedResultsRuleResultsElementUrlBlocksUrlsDetailsArgs extends Google_Model {
323  public $type;
324  public $value;
325  public function setType( $type) {
326    $this->type = $type;
327  }
328  public function getType() {
329    return $this->type;
330  }
331  public function setValue( $value) {
332    $this->value = $value;
333  }
334  public function getValue() {
335    return $this->value;
336  }
337}
338
339class Google_ResultFormattedResultsRuleResultsElementUrlBlocksUrlsResult extends Google_Model {
340  protected $__argsType = 'Google_ResultFormattedResultsRuleResultsElementUrlBlocksUrlsResultArgs';
341  protected $__argsDataType = 'array';
342  public $args;
343  public $format;
344  public function setArgs(/* array(Google_ResultFormattedResultsRuleResultsElementUrlBlocksUrlsResultArgs) */ $args) {
345    $this->assertIsArray($args, 'Google_ResultFormattedResultsRuleResultsElementUrlBlocksUrlsResultArgs', __METHOD__);
346    $this->args = $args;
347  }
348  public function getArgs() {
349    return $this->args;
350  }
351  public function setFormat( $format) {
352    $this->format = $format;
353  }
354  public function getFormat() {
355    return $this->format;
356  }
357}
358
359class Google_ResultFormattedResultsRuleResultsElementUrlBlocksUrlsResultArgs extends Google_Model {
360  public $type;
361  public $value;
362  public function setType( $type) {
363    $this->type = $type;
364  }
365  public function getType() {
366    return $this->type;
367  }
368  public function setValue( $value) {
369    $this->value = $value;
370  }
371  public function getValue() {
372    return $this->value;
373  }
374}
375
376class Google_ResultPageStats extends Google_Model {
377  public $cssResponseBytes;
378  public $flashResponseBytes;
379  public $htmlResponseBytes;
380  public $imageResponseBytes;
381  public $javascriptResponseBytes;
382  public $numberCssResources;
383  public $numberHosts;
384  public $numberJsResources;
385  public $numberResources;
386  public $numberStaticResources;
387  public $otherResponseBytes;
388  public $textResponseBytes;
389  public $totalRequestBytes;
390  public function setCssResponseBytes( $cssResponseBytes) {
391    $this->cssResponseBytes = $cssResponseBytes;
392  }
393  public function getCssResponseBytes() {
394    return $this->cssResponseBytes;
395  }
396  public function setFlashResponseBytes( $flashResponseBytes) {
397    $this->flashResponseBytes = $flashResponseBytes;
398  }
399  public function getFlashResponseBytes() {
400    return $this->flashResponseBytes;
401  }
402  public function setHtmlResponseBytes( $htmlResponseBytes) {
403    $this->htmlResponseBytes = $htmlResponseBytes;
404  }
405  public function getHtmlResponseBytes() {
406    return $this->htmlResponseBytes;
407  }
408  public function setImageResponseBytes( $imageResponseBytes) {
409    $this->imageResponseBytes = $imageResponseBytes;
410  }
411  public function getImageResponseBytes() {
412    return $this->imageResponseBytes;
413  }
414  public function setJavascriptResponseBytes( $javascriptResponseBytes) {
415    $this->javascriptResponseBytes = $javascriptResponseBytes;
416  }
417  public function getJavascriptResponseBytes() {
418    return $this->javascriptResponseBytes;
419  }
420  public function setNumberCssResources( $numberCssResources) {
421    $this->numberCssResources = $numberCssResources;
422  }
423  public function getNumberCssResources() {
424    return $this->numberCssResources;
425  }
426  public function setNumberHosts( $numberHosts) {
427    $this->numberHosts = $numberHosts;
428  }
429  public function getNumberHosts() {
430    return $this->numberHosts;
431  }
432  public function setNumberJsResources( $numberJsResources) {
433    $this->numberJsResources = $numberJsResources;
434  }
435  public function getNumberJsResources() {
436    return $this->numberJsResources;
437  }
438  public function setNumberResources( $numberResources) {
439    $this->numberResources = $numberResources;
440  }
441  public function getNumberResources() {
442    return $this->numberResources;
443  }
444  public function setNumberStaticResources( $numberStaticResources) {
445    $this->numberStaticResources = $numberStaticResources;
446  }
447  public function getNumberStaticResources() {
448    return $this->numberStaticResources;
449  }
450  public function setOtherResponseBytes( $otherResponseBytes) {
451    $this->otherResponseBytes = $otherResponseBytes;
452  }
453  public function getOtherResponseBytes() {
454    return $this->otherResponseBytes;
455  }
456  public function setTextResponseBytes( $textResponseBytes) {
457    $this->textResponseBytes = $textResponseBytes;
458  }
459  public function getTextResponseBytes() {
460    return $this->textResponseBytes;
461  }
462  public function setTotalRequestBytes( $totalRequestBytes) {
463    $this->totalRequestBytes = $totalRequestBytes;
464  }
465  public function getTotalRequestBytes() {
466    return $this->totalRequestBytes;
467  }
468}
469
470class Google_ResultScreenshot extends Google_Model {
471  public $data;
472  public $height;
473  public $mime_type;
474  public $width;
475  public function setData( $data) {
476    $this->data = $data;
477  }
478  public function getData() {
479    return $this->data;
480  }
481  public function setHeight( $height) {
482    $this->height = $height;
483  }
484  public function getHeight() {
485    return $this->height;
486  }
487  public function setMime_type( $mime_type) {
488    $this->mime_type = $mime_type;
489  }
490  public function getMime_type() {
491    return $this->mime_type;
492  }
493  public function setWidth( $width) {
494    $this->width = $width;
495  }
496  public function getWidth() {
497    return $this->width;
498  }
499}
500
501class Google_ResultVersion extends Google_Model {
502  public $major;
503  public $minor;
504  public function setMajor( $major) {
505    $this->major = $major;
506  }
507  public function getMajor() {
508    return $this->major;
509  }
510  public function setMinor( $minor) {
511    $this->minor = $minor;
512  }
513  public function getMinor() {
514    return $this->minor;
515  }
516}
517