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