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