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\PagespeedInsights\Resource;
19
20use Google\Service\PagespeedInsights\PagespeedApiPagespeedResponseV5;
21
22/**
23 * The "pagespeedapi" collection of methods.
24 * Typical usage is:
25 *  <code>
26 *   $pagespeedonlineService = new Google\Service\PagespeedInsights(...);
27 *   $pagespeedapi = $pagespeedonlineService->pagespeedapi;
28 *  </code>
29 */
30class Pagespeedapi extends \Google\Service\Resource
31{
32  /**
33   * Runs PageSpeed analysis on the page at the specified URL, and returns
34   * PageSpeed scores, a list of suggestions to make that page faster, and other
35   * information. (pagespeedapi.runpagespeed)
36   *
37   * @param string $url Required. The URL to fetch and analyze
38   * @param array $optParams Optional parameters.
39   *
40   * @opt_param string captchaToken The captcha token passed when filling out a
41   * captcha.
42   * @opt_param string category A Lighthouse category to run; if none are given,
43   * only Performance category will be run
44   * @opt_param string locale The locale used to localize formatted results
45   * @opt_param string strategy The analysis strategy (desktop or mobile) to use,
46   * and desktop is the default
47   * @opt_param string utm_campaign Campaign name for analytics.
48   * @opt_param string utm_source Campaign source for analytics.
49   * @return PagespeedApiPagespeedResponseV5
50   */
51  public function runpagespeed($url, $optParams = [])
52  {
53    $params = ['url' => $url];
54    $params = array_merge($params, $optParams);
55    return $this->call('runpagespeed', [$params], PagespeedApiPagespeedResponseV5::class);
56  }
57}
58
59// Adding a class alias for backwards compatibility with the previous class name.
60class_alias(Pagespeedapi::class, 'Google_Service_PagespeedInsights_Resource_Pagespeedapi');
61