Safebrowsing.php 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197
  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 Safebrowsing (v4).
  21. *
  22. * <p>
  23. * Enables client applications to check web resources (most commonly URLs)
  24. * against Google-generated lists of unsafe web resources. The Safe Browsing
  25. * APIs are for non-commercial use only. If you need to use APIs to detect
  26. * malicious URLs for commercial purposes – meaning “for sale or revenue-
  27. * generating purposes” – please refer to the Web Risk API.</p>
  28. *
  29. * <p>
  30. * For more information about this service, see the API
  31. * <a href="https://developers.google.com/safe-browsing/" target="_blank">Documentation</a>
  32. * </p>
  33. *
  34. * @author Google, Inc.
  35. */
  36. class Safebrowsing extends \Google\Service
  37. {
  38. public $encodedFullHashes;
  39. public $encodedUpdates;
  40. public $fullHashes;
  41. public $threatHits;
  42. public $threatListUpdates;
  43. public $threatLists;
  44. public $threatMatches;
  45. /**
  46. * Constructs the internal representation of the Safebrowsing service.
  47. *
  48. * @param Client|array $clientOrConfig The client used to deliver requests, or a
  49. * config array to pass to a new Client instance.
  50. * @param string $rootUrl The root URL used for requests to the service.
  51. */
  52. public function __construct($clientOrConfig = [], $rootUrl = null)
  53. {
  54. parent::__construct($clientOrConfig);
  55. $this->rootUrl = $rootUrl ?: 'https://safebrowsing.googleapis.com/';
  56. $this->servicePath = '';
  57. $this->batchPath = 'batch';
  58. $this->version = 'v4';
  59. $this->serviceName = 'safebrowsing';
  60. $this->encodedFullHashes = new Safebrowsing\Resource\EncodedFullHashes(
  61. $this,
  62. $this->serviceName,
  63. 'encodedFullHashes',
  64. [
  65. 'methods' => [
  66. 'get' => [
  67. 'path' => 'v4/encodedFullHashes/{encodedRequest}',
  68. 'httpMethod' => 'GET',
  69. 'parameters' => [
  70. 'encodedRequest' => [
  71. 'location' => 'path',
  72. 'type' => 'string',
  73. 'required' => true,
  74. ],
  75. 'clientId' => [
  76. 'location' => 'query',
  77. 'type' => 'string',
  78. ],
  79. 'clientVersion' => [
  80. 'location' => 'query',
  81. 'type' => 'string',
  82. ],
  83. ],
  84. ],
  85. ]
  86. ]
  87. );
  88. $this->encodedUpdates = new Safebrowsing\Resource\EncodedUpdates(
  89. $this,
  90. $this->serviceName,
  91. 'encodedUpdates',
  92. [
  93. 'methods' => [
  94. 'get' => [
  95. 'path' => 'v4/encodedUpdates/{encodedRequest}',
  96. 'httpMethod' => 'GET',
  97. 'parameters' => [
  98. 'encodedRequest' => [
  99. 'location' => 'path',
  100. 'type' => 'string',
  101. 'required' => true,
  102. ],
  103. 'clientId' => [
  104. 'location' => 'query',
  105. 'type' => 'string',
  106. ],
  107. 'clientVersion' => [
  108. 'location' => 'query',
  109. 'type' => 'string',
  110. ],
  111. ],
  112. ],
  113. ]
  114. ]
  115. );
  116. $this->fullHashes = new Safebrowsing\Resource\FullHashes(
  117. $this,
  118. $this->serviceName,
  119. 'fullHashes',
  120. [
  121. 'methods' => [
  122. 'find' => [
  123. 'path' => 'v4/fullHashes:find',
  124. 'httpMethod' => 'POST',
  125. 'parameters' => [],
  126. ],
  127. ]
  128. ]
  129. );
  130. $this->threatHits = new Safebrowsing\Resource\ThreatHits(
  131. $this,
  132. $this->serviceName,
  133. 'threatHits',
  134. [
  135. 'methods' => [
  136. 'create' => [
  137. 'path' => 'v4/threatHits',
  138. 'httpMethod' => 'POST',
  139. 'parameters' => [],
  140. ],
  141. ]
  142. ]
  143. );
  144. $this->threatListUpdates = new Safebrowsing\Resource\ThreatListUpdates(
  145. $this,
  146. $this->serviceName,
  147. 'threatListUpdates',
  148. [
  149. 'methods' => [
  150. 'fetch' => [
  151. 'path' => 'v4/threatListUpdates:fetch',
  152. 'httpMethod' => 'POST',
  153. 'parameters' => [],
  154. ],
  155. ]
  156. ]
  157. );
  158. $this->threatLists = new Safebrowsing\Resource\ThreatLists(
  159. $this,
  160. $this->serviceName,
  161. 'threatLists',
  162. [
  163. 'methods' => [
  164. 'list' => [
  165. 'path' => 'v4/threatLists',
  166. 'httpMethod' => 'GET',
  167. 'parameters' => [],
  168. ],
  169. ]
  170. ]
  171. );
  172. $this->threatMatches = new Safebrowsing\Resource\ThreatMatches(
  173. $this,
  174. $this->serviceName,
  175. 'threatMatches',
  176. [
  177. 'methods' => [
  178. 'find' => [
  179. 'path' => 'v4/threatMatches:find',
  180. 'httpMethod' => 'POST',
  181. 'parameters' => [],
  182. ],
  183. ]
  184. ]
  185. );
  186. }
  187. }
  188. // Adding a class alias for backwards compatibility with the previous class name.
  189. class_alias(Safebrowsing::class, 'Google_Service_Safebrowsing');