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 SearchConsole (v1).
24 *
25 * <p>
26 * The Search Console API provides access to both Search Console data (verified
27 * users only) and to public information on an URL basis (anyone)</p>
28 *
29 * <p>
30 * For more information about this service, see the API
31 * <a href="https://developers.google.com/webmaster-tools/search-console-api/" target="_blank">Documentation</a>
32 * </p>
33 *
34 * @author Google, Inc.
35 */
36class SearchConsole extends \Google\Service
37{
38  /** View and manage Search Console data for your verified sites. */
39  const WEBMASTERS =
40      "https://www.googleapis.com/auth/webmasters";
41  /** View Search Console data for your verified sites. */
42  const WEBMASTERS_READONLY =
43      "https://www.googleapis.com/auth/webmasters.readonly";
44
45  public $searchanalytics;
46  public $sitemaps;
47  public $sites;
48  public $urlInspection_index;
49  public $urlTestingTools_mobileFriendlyTest;
50
51  /**
52   * Constructs the internal representation of the SearchConsole service.
53   *
54   * @param Client|array $clientOrConfig The client used to deliver requests, or a
55   *                                     config array to pass to a new Client instance.
56   * @param string $rootUrl The root URL used for requests to the service.
57   */
58  public function __construct($clientOrConfig = [], $rootUrl = null)
59  {
60    parent::__construct($clientOrConfig);
61    $this->rootUrl = $rootUrl ?: 'https://searchconsole.googleapis.com/';
62    $this->servicePath = '';
63    $this->batchPath = 'batch';
64    $this->version = 'v1';
65    $this->serviceName = 'searchconsole';
66
67    $this->searchanalytics = new SearchConsole\Resource\Searchanalytics(
68        $this,
69        $this->serviceName,
70        'searchanalytics',
71        [
72          'methods' => [
73            'query' => [
74              'path' => 'webmasters/v3/sites/{siteUrl}/searchAnalytics/query',
75              'httpMethod' => 'POST',
76              'parameters' => [
77                'siteUrl' => [
78                  'location' => 'path',
79                  'type' => 'string',
80                  'required' => true,
81                ],
82              ],
83            ],
84          ]
85        ]
86    );
87    $this->sitemaps = new SearchConsole\Resource\Sitemaps(
88        $this,
89        $this->serviceName,
90        'sitemaps',
91        [
92          'methods' => [
93            'delete' => [
94              'path' => 'webmasters/v3/sites/{siteUrl}/sitemaps/{feedpath}',
95              'httpMethod' => 'DELETE',
96              'parameters' => [
97                'siteUrl' => [
98                  'location' => 'path',
99                  'type' => 'string',
100                  'required' => true,
101                ],
102                'feedpath' => [
103                  'location' => 'path',
104                  'type' => 'string',
105                  'required' => true,
106                ],
107              ],
108            ],'get' => [
109              'path' => 'webmasters/v3/sites/{siteUrl}/sitemaps/{feedpath}',
110              'httpMethod' => 'GET',
111              'parameters' => [
112                'siteUrl' => [
113                  'location' => 'path',
114                  'type' => 'string',
115                  'required' => true,
116                ],
117                'feedpath' => [
118                  'location' => 'path',
119                  'type' => 'string',
120                  'required' => true,
121                ],
122              ],
123            ],'list' => [
124              'path' => 'webmasters/v3/sites/{siteUrl}/sitemaps',
125              'httpMethod' => 'GET',
126              'parameters' => [
127                'siteUrl' => [
128                  'location' => 'path',
129                  'type' => 'string',
130                  'required' => true,
131                ],
132                'sitemapIndex' => [
133                  'location' => 'query',
134                  'type' => 'string',
135                ],
136              ],
137            ],'submit' => [
138              'path' => 'webmasters/v3/sites/{siteUrl}/sitemaps/{feedpath}',
139              'httpMethod' => 'PUT',
140              'parameters' => [
141                'siteUrl' => [
142                  'location' => 'path',
143                  'type' => 'string',
144                  'required' => true,
145                ],
146                'feedpath' => [
147                  'location' => 'path',
148                  'type' => 'string',
149                  'required' => true,
150                ],
151              ],
152            ],
153          ]
154        ]
155    );
156    $this->sites = new SearchConsole\Resource\Sites(
157        $this,
158        $this->serviceName,
159        'sites',
160        [
161          'methods' => [
162            'add' => [
163              'path' => 'webmasters/v3/sites/{siteUrl}',
164              'httpMethod' => 'PUT',
165              'parameters' => [
166                'siteUrl' => [
167                  'location' => 'path',
168                  'type' => 'string',
169                  'required' => true,
170                ],
171              ],
172            ],'delete' => [
173              'path' => 'webmasters/v3/sites/{siteUrl}',
174              'httpMethod' => 'DELETE',
175              'parameters' => [
176                'siteUrl' => [
177                  'location' => 'path',
178                  'type' => 'string',
179                  'required' => true,
180                ],
181              ],
182            ],'get' => [
183              'path' => 'webmasters/v3/sites/{siteUrl}',
184              'httpMethod' => 'GET',
185              'parameters' => [
186                'siteUrl' => [
187                  'location' => 'path',
188                  'type' => 'string',
189                  'required' => true,
190                ],
191              ],
192            ],'list' => [
193              'path' => 'webmasters/v3/sites',
194              'httpMethod' => 'GET',
195              'parameters' => [],
196            ],
197          ]
198        ]
199    );
200    $this->urlInspection_index = new SearchConsole\Resource\UrlInspectionIndex(
201        $this,
202        $this->serviceName,
203        'index',
204        [
205          'methods' => [
206            'inspect' => [
207              'path' => 'v1/urlInspection/index:inspect',
208              'httpMethod' => 'POST',
209              'parameters' => [],
210            ],
211          ]
212        ]
213    );
214    $this->urlTestingTools_mobileFriendlyTest = new SearchConsole\Resource\UrlTestingToolsMobileFriendlyTest(
215        $this,
216        $this->serviceName,
217        'mobileFriendlyTest',
218        [
219          'methods' => [
220            'run' => [
221              'path' => 'v1/urlTestingTools/mobileFriendlyTest:run',
222              'httpMethod' => 'POST',
223              'parameters' => [],
224            ],
225          ]
226        ]
227    );
228  }
229}
230
231// Adding a class alias for backwards compatibility with the previous class name.
232class_alias(SearchConsole::class, 'Google_Service_SearchConsole');
233