1<?php
2/*
3 * Copyright 2014 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
18namespace Google\Service;
19
20use Google\Client;
21
22/**
23 * Service definition for PagespeedInsights (v5).
24 *
25 * <p>
26 * The PageSpeed Insights API lets you analyze the performance of your website
27 * with a simple API. It offers tailored suggestions for how you can optimize
28 * your site, and lets you easily integrate PageSpeed Insights analysis into
29 * your development tools and workflow.</p>
30 *
31 * <p>
32 * For more information about this service, see the API
33 * <a href="https://developers.google.com/speed/docs/insights/v5/about" target="_blank">Documentation</a>
34 * </p>
35 *
36 * @author Google, Inc.
37 */
38class PagespeedInsights extends \Google\Service
39{
40  /** Associate you with your personal info on Google. */
41  const OPENID =
42      "openid";
43
44  public $pagespeedapi;
45
46  /**
47   * Constructs the internal representation of the PagespeedInsights service.
48   *
49   * @param Client|array $clientOrConfig The client used to deliver requests, or a
50   *                                     config array to pass to a new Client instance.
51   * @param string $rootUrl The root URL used for requests to the service.
52   */
53  public function __construct($clientOrConfig = [], $rootUrl = null)
54  {
55    parent::__construct($clientOrConfig);
56    $this->rootUrl = $rootUrl ?: 'https://pagespeedonline.googleapis.com/';
57    $this->servicePath = '';
58    $this->batchPath = 'batch';
59    $this->version = 'v5';
60    $this->serviceName = 'pagespeedonline';
61
62    $this->pagespeedapi = new PagespeedInsights\Resource\Pagespeedapi(
63        $this,
64        $this->serviceName,
65        'pagespeedapi',
66        [
67          'methods' => [
68            'runpagespeed' => [
69              'path' => 'pagespeedonline/v5/runPagespeed',
70              'httpMethod' => 'GET',
71              'parameters' => [
72                'url' => [
73                  'location' => 'query',
74                  'type' => 'string',
75                  'required' => true,
76                ],
77                'captchaToken' => [
78                  'location' => 'query',
79                  'type' => 'string',
80                ],
81                'category' => [
82                  'location' => 'query',
83                  'type' => 'string',
84                  'repeated' => true,
85                ],
86                'locale' => [
87                  'location' => 'query',
88                  'type' => 'string',
89                ],
90                'strategy' => [
91                  'location' => 'query',
92                  'type' => 'string',
93                ],
94                'utm_campaign' => [
95                  'location' => 'query',
96                  'type' => 'string',
97                ],
98                'utm_source' => [
99                  'location' => 'query',
100                  'type' => 'string',
101                ],
102              ],
103            ],
104          ]
105        ]
106    );
107  }
108}
109
110// Adding a class alias for backwards compatibility with the previous class name.
111class_alias(PagespeedInsights::class, 'Google_Service_PagespeedInsights');
112