Webmasters.php 6.1 KB

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