on develop help sign in
Regenerating gogol-safebrowsing
commit42dd3d70665a71b1f67e5404e83dd3968e340f75 authorBrendan Hay <brendan.g.hay@gmail.com> dateFri 28 Oct 2016, 08:23 (10 years ago) parent015a674
14 files changed+2951
gogol-safebrowsing/LICENSE+367 gogol-safebrowsing/Makefile+1 gogol-safebrowsing/README.md+28 gogol-safebrowsing/Setup.hs+2 gogol-safebrowsing/gen/Network/Google/Resource/SafeBrowsing/FullHashes/Find.hs+169 gogol-safebrowsing/gen/Network/Google/Resource/SafeBrowsing/ThreatListUpdates/Fetch.hs+174 gogol-safebrowsing/gen/Network/Google/Resource/SafeBrowsing/ThreatLists/List.hs+157 gogol-safebrowsing/gen/Network/Google/Resource/SafeBrowsing/ThreatMatches/Find.hs+170 gogol-safebrowsing/gen/Network/Google/SafeBrowsing.hs+213 gogol-safebrowsing/gen/Network/Google/SafeBrowsing/Types.hs+184 gogol-safebrowsing/gen/Network/Google/SafeBrowsing/Types/Product.hs+1417 gogol-safebrowsing/gen/Network/Google/SafeBrowsing/Types/Sum.hs+19 gogol-safebrowsing/gogol-safebrowsing.cabal+50 gogol-safebrowsing/src/.gitkeep
gogol-safebrowsing/LICENSEnew file+367
@@ -0,0 +1,367 @@
1+Mozilla Public License Version 2.0
2+==================================
3+
4+1. Definitions
5+--------------
6+
7+1.1. "Contributor"
8+ means each individual or legal entity that creates, contributes to
9+ the creation of, or owns Covered Software.
10+
11+1.2. "Contributor Version"
12+ means the combination of the Contributions of others (if any) used
13+ by a Contributor and that particular Contributor's Contribution.
14+
15+1.3. "Contribution"
16+ means Covered Software of a particular Contributor.
17+
18+1.4. "Covered Software"
19+ means Source Code Form to which the initial Contributor has attached
20+ the notice in Exhibit A, the Executable Form of such Source Code
21+ Form, and Modifications of such Source Code Form, in each case
22+ including portions thereof.
23+
24+1.5. "Incompatible With Secondary Licenses"
25+ means
26+
27+ (a) that the initial Contributor has attached the notice described
28+ in Exhibit B to the Covered Software; or
29+
30+ (b) that the Covered Software was made available under the terms of
31+ version 1.1 or earlier of the License, but not also under the
32+ terms of a Secondary License.
33+
34+1.6. "Executable Form"
35+ means any form of the work other than Source Code Form.
36+
37+1.7. "Larger Work"
38+ means a work that combines Covered Software with other material, in
39+ a separate file or files, that is not Covered Software.
40+
41+1.8. "License"
42+ means this document.
43+
44+1.9. "Licensable"
45+ means having the right to grant, to the maximum extent possible,
46+ whether at the time of the initial grant or subsequently, any and
47+ all of the rights conveyed by this License.
48+
49+1.10. "Modifications"
50+ means any of the following:
51+
52+ (a) any file in Source Code Form that results from an addition to,
53+ deletion from, or modification of the contents of Covered
54+ Software; or
55+
56+ (b) any new file in Source Code Form that contains any Covered
57+ Software.
58+
59+1.11. "Patent Claims" of a Contributor
60+ means any patent claim(s), including without limitation, method,
61+ process, and apparatus claims, in any patent Licensable by such
62+ Contributor that would be infringed, but for the grant of the
63+ License, by the making, using, selling, offering for sale, having
64+ made, import, or transfer of either its Contributions or its
65+ Contributor Version.
66+
67+1.12. "Secondary License"
68+ means either the GNU General Public License, Version 2.0, the GNU
69+ Lesser General Public License, Version 2.1, the GNU Affero General
70+ Public License, Version 3.0, or any later versions of those
71+ licenses.
72+
73+1.13. "Source Code Form"
74+ means the form of the work preferred for making modifications.
75+
76+1.14. "You" (or "Your")
77+ means an individual or a legal entity exercising rights under this
78+ License. For legal entities, "You" includes any entity that
79+ controls, is controlled by, or is under common control with You. For
80+ purposes of this definition, "control" means (a) the power, direct
81+ or indirect, to cause the direction or management of such entity,
82+ whether by contract or otherwise, or (b) ownership of more than
83+ fifty percent (50%) of the outstanding shares or beneficial
84+ ownership of such entity.
85+
86+2. License Grants and Conditions
87+--------------------------------
88+
89+2.1. Grants
90+
91+Each Contributor hereby grants You a world-wide, royalty-free,
92+non-exclusive license:
93+
94+(a) under intellectual property rights (other than patent or trademark)
95+ Licensable by such Contributor to use, reproduce, make available,
96+ modify, display, perform, distribute, and otherwise exploit its
97+ Contributions, either on an unmodified basis, with Modifications, or
98+ as part of a Larger Work; and
99+
100+(b) under Patent Claims of such Contributor to make, use, sell, offer
101+ for sale, have made, import, and otherwise transfer either its
102+ Contributions or its Contributor Version.
103+
104+2.2. Effective Date
105+
106+The licenses granted in Section 2.1 with respect to any Contribution
107+become effective for each Contribution on the date the Contributor first
108+distributes such Contribution.
109+
110+2.3. Limitations on Grant Scope
111+
112+The licenses granted in this Section 2 are the only rights granted under
113+this License. No additional rights or licenses will be implied from the
114+distribution or licensing of Covered Software under this License.
115+Notwithstanding Section 2.1(b) above, no patent license is granted by a
116+Contributor:
117+
118+(a) for any code that a Contributor has removed from Covered Software;
119+ or
120+
121+(b) for infringements caused by: (i) Your and any other third party's
122+ modifications of Covered Software, or (ii) the combination of its
123+ Contributions with other software (except as part of its Contributor
124+ Version); or
125+
126+(c) under Patent Claims infringed by Covered Software in the absence of
127+ its Contributions.
128+
129+This License does not grant any rights in the trademarks, service marks,
130+or logos of any Contributor (except as may be necessary to comply with
131+the notice requirements in Section 3.4).
132+
133+2.4. Subsequent Licenses
134+
135+No Contributor makes additional grants as a result of Your choice to
136+distribute the Covered Software under a subsequent version of this
137+License (see Section 10.2) or under the terms of a Secondary License (if
138+permitted under the terms of Section 3.3).
139+
140+2.5. Representation
141+
142+Each Contributor represents that the Contributor believes its
143+Contributions are its original creation(s) or it has sufficient rights
144+to grant the rights to its Contributions conveyed by this License.
145+
146+2.6. Fair Use
147+
148+This License is not intended to limit any rights You have under
149+applicable copyright doctrines of fair use, fair dealing, or other
150+equivalents.
151+
152+2.7. Conditions
153+
154+Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted
155+in Section 2.1.
156+
157+3. Responsibilities
158+-------------------
159+
160+3.1. Distribution of Source Form
161+
162+All distribution of Covered Software in Source Code Form, including any
163+Modifications that You create or to which You contribute, must be under
164+the terms of this License. You must inform recipients that the Source
165+Code Form of the Covered Software is governed by the terms of this
166+License, and how they can obtain a copy of this License. You may not
167+attempt to alter or restrict the recipients' rights in the Source Code
168+Form.
169+
170+3.2. Distribution of Executable Form
171+
172+If You distribute Covered Software in Executable Form then:
173+
174+(a) such Covered Software must also be made available in Source Code
175+ Form, as described in Section 3.1, and You must inform recipients of
176+ the Executable Form how they can obtain a copy of such Source Code
177+ Form by reasonable means in a timely manner, at a charge no more
178+ than the cost of distribution to the recipient; and
179+
180+(b) You may distribute such Executable Form under the terms of this
181+ License, or sublicense it under different terms, provided that the
182+ license for the Executable Form does not attempt to limit or alter
183+ the recipients' rights in the Source Code Form under this License.
184+
185+3.3. Distribution of a Larger Work
186+
187+You may create and distribute a Larger Work under terms of Your choice,
188+provided that You also comply with the requirements of this License for
189+the Covered Software. If the Larger Work is a combination of Covered
190+Software with a work governed by one or more Secondary Licenses, and the
191+Covered Software is not Incompatible With Secondary Licenses, this
192+License permits You to additionally distribute such Covered Software
193+under the terms of such Secondary License(s), so that the recipient of
194+the Larger Work may, at their option, further distribute the Covered
195+Software under the terms of either this License or such Secondary
196+License(s).
197+
198+3.4. Notices
199+
200+You may not remove or alter the substance of any license notices
201+(including copyright notices, patent notices, disclaimers of warranty,
202+or limitations of liability) contained within the Source Code Form of
203+the Covered Software, except that You may alter any license notices to
204+the extent required to remedy known factual inaccuracies.
205+
206+3.5. Application of Additional Terms
207+
208+You may choose to offer, and to charge a fee for, warranty, support,
209+indemnity or liability obligations to one or more recipients of Covered
210+Software. However, You may do so only on Your own behalf, and not on
211+behalf of any Contributor. You must make it absolutely clear that any
212+such warranty, support, indemnity, or liability obligation is offered by
213+You alone, and You hereby agree to indemnify every Contributor for any
214+liability incurred by such Contributor as a result of warranty, support,
215+indemnity or liability terms You offer. You may include additional
216+disclaimers of warranty and limitations of liability specific to any
217+jurisdiction.
218+
219+4. Inability to Comply Due to Statute or Regulation
220+---------------------------------------------------
221+
222+If it is impossible for You to comply with any of the terms of this
223+License with respect to some or all of the Covered Software due to
224+statute, judicial order, or regulation then You must: (a) comply with
225+the terms of this License to the maximum extent possible; and (b)
226+describe the limitations and the code they affect. Such description must
227+be placed in a text file included with all distributions of the Covered
228+Software under this License. Except to the extent prohibited by statute
229+or regulation, such description must be sufficiently detailed for a
230+recipient of ordinary skill to be able to understand it.
231+
232+5. Termination
233+--------------
234+
235+5.1. The rights granted under this License will terminate automatically
236+if You fail to comply with any of its terms. However, if You become
237+compliant, then the rights granted under this License from a particular
238+Contributor are reinstated (a) provisionally, unless and until such
239+Contributor explicitly and finally terminates Your grants, and (b) on an
240+ongoing basis, if such Contributor fails to notify You of the
241+non-compliance by some reasonable means prior to 60 days after You have
242+come back into compliance. Moreover, Your grants from a particular
243+Contributor are reinstated on an ongoing basis if such Contributor
244+notifies You of the non-compliance by some reasonable means, this is the
245+first time You have received notice of non-compliance with this License
246+from such Contributor, and You become compliant prior to 30 days after
247+Your receipt of the notice.
248+
249+5.2. If You initiate litigation against any entity by asserting a patent
250+infringement claim (excluding declaratory judgment actions,
251+counter-claims, and cross-claims) alleging that a Contributor Version
252+directly or indirectly infringes any patent, then the rights granted to
253+You by any and all Contributors for the Covered Software under Section
254+2.1 of this License shall terminate.
255+
256+5.3. In the event of termination under Sections 5.1 or 5.2 above, all
257+end user license agreements (excluding distributors and resellers) which
258+have been validly granted by You or Your distributors under this License
259+prior to termination shall survive termination.
260+
261+************************************************************************
262+* *
263+* 6. Disclaimer of Warranty *
264+* ------------------------- *
265+* *
266+* Covered Software is provided under this License on an "as is" *
267+* basis, without warranty of any kind, either expressed, implied, or *
268+* statutory, including, without limitation, warranties that the *
269+* Covered Software is free of defects, merchantable, fit for a *
270+* particular purpose or non-infringing. The entire risk as to the *
271+* quality and performance of the Covered Software is with You. *
272+* Should any Covered Software prove defective in any respect, You *
273+* (not any Contributor) assume the cost of any necessary servicing, *
274+* repair, or correction. This disclaimer of warranty constitutes an *
275+* essential part of this License. No use of any Covered Software is *
276+* authorized under this License except under this disclaimer. *
277+* *
278+************************************************************************
279+
280+************************************************************************
281+* *
282+* 7. Limitation of Liability *
283+* -------------------------- *
284+* *
285+* Under no circumstances and under no legal theory, whether tort *
286+* (including negligence), contract, or otherwise, shall any *
287+* Contributor, or anyone who distributes Covered Software as *
288+* permitted above, be liable to You for any direct, indirect, *
289+* special, incidental, or consequential damages of any character *
290+* including, without limitation, damages for lost profits, loss of *
291+* goodwill, work stoppage, computer failure or malfunction, or any *
292+* and all other commercial damages or losses, even if such party *
293+* shall have been informed of the possibility of such damages. This *
294+* limitation of liability shall not apply to liability for death or *
295+* personal injury resulting from such party's negligence to the *
296+* extent applicable law prohibits such limitation. Some *
297+* jurisdictions do not allow the exclusion or limitation of *
298+* incidental or consequential damages, so this exclusion and *
299+* limitation may not apply to You. *
300+* *
301+************************************************************************
302+
303+8. Litigation
304+-------------
305+
306+Any litigation relating to this License may be brought only in the
307+courts of a jurisdiction where the defendant maintains its principal
308+place of business and such litigation shall be governed by laws of that
309+jurisdiction, without reference to its conflict-of-law provisions.
310+Nothing in this Section shall prevent a party's ability to bring
311+cross-claims or counter-claims.
312+
313+9. Miscellaneous
314+----------------
315+
316+This License represents the complete agreement concerning the subject
317+matter hereof. If any provision of this License is held to be
318+unenforceable, such provision shall be reformed only to the extent
319+necessary to make it enforceable. Any law or regulation which provides
320+that the language of a contract shall be construed against the drafter
321+shall not be used to construe this License against a Contributor.
322+
323+10. Versions of the License
324+---------------------------
325+
326+10.1. New Versions
327+
328+Mozilla Foundation is the license steward. Except as provided in Section
329+10.3, no one other than the license steward has the right to modify or
330+publish new versions of this License. Each version will be given a
331+distinguishing version number.
332+
333+10.2. Effect of New Versions
334+
335+You may distribute the Covered Software under the terms of the version
336+of the License under which You originally received the Covered Software,
337+or under the terms of any subsequent version published by the license
338+steward.
339+
340+10.3. Modified Versions
341+
342+If you create software not governed by this License, and you want to
343+create a new license for such software, you may create and use a
344+modified version of this License if you rename the license and remove
345+any references to the name of the license steward (except to note that
346+such modified license differs from this License).
347+
348+10.4. Distributing Source Code Form that is Incompatible With Secondary
349+Licenses
350+
351+If You choose to distribute Source Code Form that is Incompatible With
352+Secondary Licenses under the terms of this version of the License, the
353+notice described in Exhibit B of this License must be attached.
354+
355+Exhibit A - Source Code Form License Notice
356+-------------------------------------------
357+
358+ This Source Code Form is subject to the terms of the Mozilla Public
359+ License, v. 2.0. If a copy of the MPL was not distributed with this
360+ file, You can obtain one at http://mozilla.org/MPL/2.0/.
361+
362+If it is not possible or desirable to put the notice in a particular
363+file, then You may include the notice in a location (such as a LICENSE
364+file in a relevant directory) where a recipient would be likely to look
365+for such a notice.
366+
367+You may add additional accurate notices of copyright ownership.
gogol-safebrowsing/Makefilenew file+1
@@ -0,0 +1 @@
1+include ../share/library.mk
gogol-safebrowsing/README.mdnew file+28
@@ -0,0 +1,28 @@
1+# gogol-safebrowsing
2+
3+* [Version](#version)
4+* [Description](#description)
5+* [Contribute](#contribute)
6+* [Licence](#licence)
7+
8+
9+## Version
10+
11+`0.1.0`
12+
13+
14+## Description
15+
16+A client library for the Google Safe Browsing APIs.
17+
18+
19+## Contribute
20+
21+For any problems, comments, or feedback please create an issue [here on GitHub](https://github.com/brendanhay/gogol/issues).
22+
23+> _Note:_ this library is an auto-generated Haskell package. Please see `gogol-gen` for more information.
24+
25+
26+## Licence
27+
28+`gogol-safebrowsing` is released under the [Mozilla Public License Version 2.0](http://www.mozilla.org/MPL/).
gogol-safebrowsing/Setup.hsnew file+2
@@ -0,0 +1,2 @@
1+import Distribution.Simple
2+main = defaultMain
gogol-safebrowsing/gen/Network/Google/Resource/SafeBrowsing/FullHashes/Find.hsnew file+169
@@ -0,0 +1,169 @@
1+{-# LANGUAGE DataKinds #-}
2+{-# LANGUAGE DeriveDataTypeable #-}
3+{-# LANGUAGE DeriveGeneric #-}
4+{-# LANGUAGE FlexibleInstances #-}
5+{-# LANGUAGE NoImplicitPrelude #-}
6+{-# LANGUAGE OverloadedStrings #-}
7+{-# LANGUAGE RecordWildCards #-}
8+{-# LANGUAGE TypeFamilies #-}
9+{-# LANGUAGE TypeOperators #-}
10+
11+{-# OPTIONS_GHC -fno-warn-duplicate-exports #-}
12+{-# OPTIONS_GHC -fno-warn-unused-binds #-}
13+{-# OPTIONS_GHC -fno-warn-unused-imports #-}
14+
15+-- |
16+-- Module : Network.Google.Resource.SafeBrowsing.FullHashes.Find
17+-- Copyright : (c) 2015-2016 Brendan Hay
18+-- License : Mozilla Public License, v. 2.0.
19+-- Maintainer : Brendan Hay <brendan.g.hay@gmail.com>
20+-- Stability : auto-generated
21+-- Portability : non-portable (GHC extensions)
22+--
23+-- Finds the full hashes that match the requested hash prefixes.
24+--
25+-- /See:/ <https://developers.google.com/safe-browsing/ Safe Browsing APIs Reference> for @safebrowsing.fullHashes.find@.
26+module Network.Google.Resource.SafeBrowsing.FullHashes.Find
27+ (
28+ -- * REST Resource
29+ FullHashesFindResource
30+
31+ -- * Creating a Request
32+ , fullHashesFind
33+ , FullHashesFind
34+
35+ -- * Request Lenses
36+ , fhfXgafv
37+ , fhfUploadProtocol
38+ , fhfPp
39+ , fhfAccessToken
40+ , fhfUploadType
41+ , fhfPayload
42+ , fhfBearerToken
43+ , fhfCallback
44+ ) where
45+
46+import Network.Google.Prelude
47+import Network.Google.SafeBrowsing.Types
48+
49+-- | A resource alias for @safebrowsing.fullHashes.find@ method which the
50+-- 'FullHashesFind' request conforms to.
51+type FullHashesFindResource =
52+ "v4" :>
53+ "fullHashes:find" :>
54+ QueryParam "$.xgafv" Text :>
55+ QueryParam "upload_protocol" Text :>
56+ QueryParam "pp" Bool :>
57+ QueryParam "access_token" Text :>
58+ QueryParam "uploadType" Text :>
59+ QueryParam "bearer_token" Text :>
60+ QueryParam "callback" Text :>
61+ QueryParam "alt" AltJSON :>
62+ ReqBody '[JSON] FindFullHashesRequest :>
63+ Post '[JSON] FindFullHashesResponse
64+
65+-- | Finds the full hashes that match the requested hash prefixes.
66+--
67+-- /See:/ 'fullHashesFind' smart constructor.
68+data FullHashesFind = FullHashesFind'
69+ { _fhfXgafv :: !(Maybe Text)
70+ , _fhfUploadProtocol :: !(Maybe Text)
71+ , _fhfPp :: !Bool
72+ , _fhfAccessToken :: !(Maybe Text)
73+ , _fhfUploadType :: !(Maybe Text)
74+ , _fhfPayload :: !FindFullHashesRequest
75+ , _fhfBearerToken :: !(Maybe Text)
76+ , _fhfCallback :: !(Maybe Text)
77+ } deriving (Eq,Show,Data,Typeable,Generic)
78+
79+-- | Creates a value of 'FullHashesFind' with the minimum fields required to make a request.
80+--
81+-- Use one of the following lenses to modify other fields as desired:
82+--
83+-- * 'fhfXgafv'
84+--
85+-- * 'fhfUploadProtocol'
86+--
87+-- * 'fhfPp'
88+--
89+-- * 'fhfAccessToken'
90+--
91+-- * 'fhfUploadType'
92+--
93+-- * 'fhfPayload'
94+--
95+-- * 'fhfBearerToken'
96+--
97+-- * 'fhfCallback'
98+fullHashesFind
99+ :: FindFullHashesRequest -- ^ 'fhfPayload'
100+ -> FullHashesFind
101+fullHashesFind pFhfPayload_ =
102+ FullHashesFind'
103+ { _fhfXgafv = Nothing
104+ , _fhfUploadProtocol = Nothing
105+ , _fhfPp = True
106+ , _fhfAccessToken = Nothing
107+ , _fhfUploadType = Nothing
108+ , _fhfPayload = pFhfPayload_
109+ , _fhfBearerToken = Nothing
110+ , _fhfCallback = Nothing
111+ }
112+
113+-- | V1 error format.
114+fhfXgafv :: Lens' FullHashesFind (Maybe Text)
115+fhfXgafv = lens _fhfXgafv (\ s a -> s{_fhfXgafv = a})
116+
117+-- | Upload protocol for media (e.g. \"raw\", \"multipart\").
118+fhfUploadProtocol :: Lens' FullHashesFind (Maybe Text)
119+fhfUploadProtocol
120+ = lens _fhfUploadProtocol
121+ (\ s a -> s{_fhfUploadProtocol = a})
122+
123+-- | Pretty-print response.
124+fhfPp :: Lens' FullHashesFind Bool
125+fhfPp = lens _fhfPp (\ s a -> s{_fhfPp = a})
126+
127+-- | OAuth access token.
128+fhfAccessToken :: Lens' FullHashesFind (Maybe Text)
129+fhfAccessToken
130+ = lens _fhfAccessToken
131+ (\ s a -> s{_fhfAccessToken = a})
132+
133+-- | Legacy upload protocol for media (e.g. \"media\", \"multipart\").
134+fhfUploadType :: Lens' FullHashesFind (Maybe Text)
135+fhfUploadType
136+ = lens _fhfUploadType
137+ (\ s a -> s{_fhfUploadType = a})
138+
139+-- | Multipart request metadata.
140+fhfPayload :: Lens' FullHashesFind FindFullHashesRequest
141+fhfPayload
142+ = lens _fhfPayload (\ s a -> s{_fhfPayload = a})
143+
144+-- | OAuth bearer token.
145+fhfBearerToken :: Lens' FullHashesFind (Maybe Text)
146+fhfBearerToken
147+ = lens _fhfBearerToken
148+ (\ s a -> s{_fhfBearerToken = a})
149+
150+-- | JSONP
151+fhfCallback :: Lens' FullHashesFind (Maybe Text)
152+fhfCallback
153+ = lens _fhfCallback (\ s a -> s{_fhfCallback = a})
154+
155+instance GoogleRequest FullHashesFind where
156+ type Rs FullHashesFind = FindFullHashesResponse
157+ type Scopes FullHashesFind = '[]
158+ requestClient FullHashesFind'{..}
159+ = go _fhfXgafv _fhfUploadProtocol (Just _fhfPp)
160+ _fhfAccessToken
161+ _fhfUploadType
162+ _fhfBearerToken
163+ _fhfCallback
164+ (Just AltJSON)
165+ _fhfPayload
166+ safeBrowsingService
167+ where go
168+ = buildClient (Proxy :: Proxy FullHashesFindResource)
169+ mempty
gogol-safebrowsing/gen/Network/Google/Resource/SafeBrowsing/ThreatListUpdates/Fetch.hsnew file+174
@@ -0,0 +1,174 @@
1+{-# LANGUAGE DataKinds #-}
2+{-# LANGUAGE DeriveDataTypeable #-}
3+{-# LANGUAGE DeriveGeneric #-}
4+{-# LANGUAGE FlexibleInstances #-}
5+{-# LANGUAGE NoImplicitPrelude #-}
6+{-# LANGUAGE OverloadedStrings #-}
7+{-# LANGUAGE RecordWildCards #-}
8+{-# LANGUAGE TypeFamilies #-}
9+{-# LANGUAGE TypeOperators #-}
10+
11+{-# OPTIONS_GHC -fno-warn-duplicate-exports #-}
12+{-# OPTIONS_GHC -fno-warn-unused-binds #-}
13+{-# OPTIONS_GHC -fno-warn-unused-imports #-}
14+
15+-- |
16+-- Module : Network.Google.Resource.SafeBrowsing.ThreatListUpdates.Fetch
17+-- Copyright : (c) 2015-2016 Brendan Hay
18+-- License : Mozilla Public License, v. 2.0.
19+-- Maintainer : Brendan Hay <brendan.g.hay@gmail.com>
20+-- Stability : auto-generated
21+-- Portability : non-portable (GHC extensions)
22+--
23+-- Fetches the most recent threat list updates. A client can request
24+-- updates for multiple lists at once.
25+--
26+-- /See:/ <https://developers.google.com/safe-browsing/ Safe Browsing APIs Reference> for @safebrowsing.threatListUpdates.fetch@.
27+module Network.Google.Resource.SafeBrowsing.ThreatListUpdates.Fetch
28+ (
29+ -- * REST Resource
30+ ThreatListUpdatesFetchResource
31+
32+ -- * Creating a Request
33+ , threatListUpdatesFetch
34+ , ThreatListUpdatesFetch
35+
36+ -- * Request Lenses
37+ , tlufXgafv
38+ , tlufUploadProtocol
39+ , tlufPp
40+ , tlufAccessToken
41+ , tlufUploadType
42+ , tlufPayload
43+ , tlufBearerToken
44+ , tlufCallback
45+ ) where
46+
47+import Network.Google.Prelude
48+import Network.Google.SafeBrowsing.Types
49+
50+-- | A resource alias for @safebrowsing.threatListUpdates.fetch@ method which the
51+-- 'ThreatListUpdatesFetch' request conforms to.
52+type ThreatListUpdatesFetchResource =
53+ "v4" :>
54+ "threatListUpdates:fetch" :>
55+ QueryParam "$.xgafv" Text :>
56+ QueryParam "upload_protocol" Text :>
57+ QueryParam "pp" Bool :>
58+ QueryParam "access_token" Text :>
59+ QueryParam "uploadType" Text :>
60+ QueryParam "bearer_token" Text :>
61+ QueryParam "callback" Text :>
62+ QueryParam "alt" AltJSON :>
63+ ReqBody '[JSON] FetchThreatListUpdatesRequest :>
64+ Post '[JSON] FetchThreatListUpdatesResponse
65+
66+-- | Fetches the most recent threat list updates. A client can request
67+-- updates for multiple lists at once.
68+--
69+-- /See:/ 'threatListUpdatesFetch' smart constructor.
70+data ThreatListUpdatesFetch = ThreatListUpdatesFetch'
71+ { _tlufXgafv :: !(Maybe Text)
72+ , _tlufUploadProtocol :: !(Maybe Text)
73+ , _tlufPp :: !Bool
74+ , _tlufAccessToken :: !(Maybe Text)
75+ , _tlufUploadType :: !(Maybe Text)
76+ , _tlufPayload :: !FetchThreatListUpdatesRequest
77+ , _tlufBearerToken :: !(Maybe Text)
78+ , _tlufCallback :: !(Maybe Text)
79+ } deriving (Eq,Show,Data,Typeable,Generic)
80+
81+-- | Creates a value of 'ThreatListUpdatesFetch' with the minimum fields required to make a request.
82+--
83+-- Use one of the following lenses to modify other fields as desired:
84+--
85+-- * 'tlufXgafv'
86+--
87+-- * 'tlufUploadProtocol'
88+--
89+-- * 'tlufPp'
90+--
91+-- * 'tlufAccessToken'
92+--
93+-- * 'tlufUploadType'
94+--
95+-- * 'tlufPayload'
96+--
97+-- * 'tlufBearerToken'
98+--
99+-- * 'tlufCallback'
100+threatListUpdatesFetch
101+ :: FetchThreatListUpdatesRequest -- ^ 'tlufPayload'
102+ -> ThreatListUpdatesFetch
103+threatListUpdatesFetch pTlufPayload_ =
104+ ThreatListUpdatesFetch'
105+ { _tlufXgafv = Nothing
106+ , _tlufUploadProtocol = Nothing
107+ , _tlufPp = True
108+ , _tlufAccessToken = Nothing
109+ , _tlufUploadType = Nothing
110+ , _tlufPayload = pTlufPayload_
111+ , _tlufBearerToken = Nothing
112+ , _tlufCallback = Nothing
113+ }
114+
115+-- | V1 error format.
116+tlufXgafv :: Lens' ThreatListUpdatesFetch (Maybe Text)
117+tlufXgafv
118+ = lens _tlufXgafv (\ s a -> s{_tlufXgafv = a})
119+
120+-- | Upload protocol for media (e.g. \"raw\", \"multipart\").
121+tlufUploadProtocol :: Lens' ThreatListUpdatesFetch (Maybe Text)
122+tlufUploadProtocol
123+ = lens _tlufUploadProtocol
124+ (\ s a -> s{_tlufUploadProtocol = a})
125+
126+-- | Pretty-print response.
127+tlufPp :: Lens' ThreatListUpdatesFetch Bool
128+tlufPp = lens _tlufPp (\ s a -> s{_tlufPp = a})
129+
130+-- | OAuth access token.
131+tlufAccessToken :: Lens' ThreatListUpdatesFetch (Maybe Text)
132+tlufAccessToken
133+ = lens _tlufAccessToken
134+ (\ s a -> s{_tlufAccessToken = a})
135+
136+-- | Legacy upload protocol for media (e.g. \"media\", \"multipart\").
137+tlufUploadType :: Lens' ThreatListUpdatesFetch (Maybe Text)
138+tlufUploadType
139+ = lens _tlufUploadType
140+ (\ s a -> s{_tlufUploadType = a})
141+
142+-- | Multipart request metadata.
143+tlufPayload :: Lens' ThreatListUpdatesFetch FetchThreatListUpdatesRequest
144+tlufPayload
145+ = lens _tlufPayload (\ s a -> s{_tlufPayload = a})
146+
147+-- | OAuth bearer token.
148+tlufBearerToken :: Lens' ThreatListUpdatesFetch (Maybe Text)
149+tlufBearerToken
150+ = lens _tlufBearerToken
151+ (\ s a -> s{_tlufBearerToken = a})
152+
153+-- | JSONP
154+tlufCallback :: Lens' ThreatListUpdatesFetch (Maybe Text)
155+tlufCallback
156+ = lens _tlufCallback (\ s a -> s{_tlufCallback = a})
157+
158+instance GoogleRequest ThreatListUpdatesFetch where
159+ type Rs ThreatListUpdatesFetch =
160+ FetchThreatListUpdatesResponse
161+ type Scopes ThreatListUpdatesFetch = '[]
162+ requestClient ThreatListUpdatesFetch'{..}
163+ = go _tlufXgafv _tlufUploadProtocol (Just _tlufPp)
164+ _tlufAccessToken
165+ _tlufUploadType
166+ _tlufBearerToken
167+ _tlufCallback
168+ (Just AltJSON)
169+ _tlufPayload
170+ safeBrowsingService
171+ where go
172+ = buildClient
173+ (Proxy :: Proxy ThreatListUpdatesFetchResource)
174+ mempty
gogol-safebrowsing/gen/Network/Google/Resource/SafeBrowsing/ThreatLists/List.hsnew file+157
@@ -0,0 +1,157 @@
1+{-# LANGUAGE DataKinds #-}
2+{-# LANGUAGE DeriveDataTypeable #-}
3+{-# LANGUAGE DeriveGeneric #-}
4+{-# LANGUAGE FlexibleInstances #-}
5+{-# LANGUAGE NoImplicitPrelude #-}
6+{-# LANGUAGE OverloadedStrings #-}
7+{-# LANGUAGE RecordWildCards #-}
8+{-# LANGUAGE TypeFamilies #-}
9+{-# LANGUAGE TypeOperators #-}
10+
11+{-# OPTIONS_GHC -fno-warn-duplicate-exports #-}
12+{-# OPTIONS_GHC -fno-warn-unused-binds #-}
13+{-# OPTIONS_GHC -fno-warn-unused-imports #-}
14+
15+-- |
16+-- Module : Network.Google.Resource.SafeBrowsing.ThreatLists.List
17+-- Copyright : (c) 2015-2016 Brendan Hay
18+-- License : Mozilla Public License, v. 2.0.
19+-- Maintainer : Brendan Hay <brendan.g.hay@gmail.com>
20+-- Stability : auto-generated
21+-- Portability : non-portable (GHC extensions)
22+--
23+-- Lists the Safe Browsing threat lists available for download.
24+--
25+-- /See:/ <https://developers.google.com/safe-browsing/ Safe Browsing APIs Reference> for @safebrowsing.threatLists.list@.
26+module Network.Google.Resource.SafeBrowsing.ThreatLists.List
27+ (
28+ -- * REST Resource
29+ ThreatListsListResource
30+
31+ -- * Creating a Request
32+ , threatListsList
33+ , ThreatListsList
34+
35+ -- * Request Lenses
36+ , tllXgafv
37+ , tllUploadProtocol
38+ , tllPp
39+ , tllAccessToken
40+ , tllUploadType
41+ , tllBearerToken
42+ , tllCallback
43+ ) where
44+
45+import Network.Google.Prelude
46+import Network.Google.SafeBrowsing.Types
47+
48+-- | A resource alias for @safebrowsing.threatLists.list@ method which the
49+-- 'ThreatListsList' request conforms to.
50+type ThreatListsListResource =
51+ "v4" :>
52+ "threatLists" :>
53+ QueryParam "$.xgafv" Text :>
54+ QueryParam "upload_protocol" Text :>
55+ QueryParam "pp" Bool :>
56+ QueryParam "access_token" Text :>
57+ QueryParam "uploadType" Text :>
58+ QueryParam "bearer_token" Text :>
59+ QueryParam "callback" Text :>
60+ QueryParam "alt" AltJSON :>
61+ Get '[JSON] ListThreatListsResponse
62+
63+-- | Lists the Safe Browsing threat lists available for download.
64+--
65+-- /See:/ 'threatListsList' smart constructor.
66+data ThreatListsList = ThreatListsList'
67+ { _tllXgafv :: !(Maybe Text)
68+ , _tllUploadProtocol :: !(Maybe Text)
69+ , _tllPp :: !Bool
70+ , _tllAccessToken :: !(Maybe Text)
71+ , _tllUploadType :: !(Maybe Text)
72+ , _tllBearerToken :: !(Maybe Text)
73+ , _tllCallback :: !(Maybe Text)
74+ } deriving (Eq,Show,Data,Typeable,Generic)
75+
76+-- | Creates a value of 'ThreatListsList' with the minimum fields required to make a request.
77+--
78+-- Use one of the following lenses to modify other fields as desired:
79+--
80+-- * 'tllXgafv'
81+--
82+-- * 'tllUploadProtocol'
83+--
84+-- * 'tllPp'
85+--
86+-- * 'tllAccessToken'
87+--
88+-- * 'tllUploadType'
89+--
90+-- * 'tllBearerToken'
91+--
92+-- * 'tllCallback'
93+threatListsList
94+ :: ThreatListsList
95+threatListsList =
96+ ThreatListsList'
97+ { _tllXgafv = Nothing
98+ , _tllUploadProtocol = Nothing
99+ , _tllPp = True
100+ , _tllAccessToken = Nothing
101+ , _tllUploadType = Nothing
102+ , _tllBearerToken = Nothing
103+ , _tllCallback = Nothing
104+ }
105+
106+-- | V1 error format.
107+tllXgafv :: Lens' ThreatListsList (Maybe Text)
108+tllXgafv = lens _tllXgafv (\ s a -> s{_tllXgafv = a})
109+
110+-- | Upload protocol for media (e.g. \"raw\", \"multipart\").
111+tllUploadProtocol :: Lens' ThreatListsList (Maybe Text)
112+tllUploadProtocol
113+ = lens _tllUploadProtocol
114+ (\ s a -> s{_tllUploadProtocol = a})
115+
116+-- | Pretty-print response.
117+tllPp :: Lens' ThreatListsList Bool
118+tllPp = lens _tllPp (\ s a -> s{_tllPp = a})
119+
120+-- | OAuth access token.
121+tllAccessToken :: Lens' ThreatListsList (Maybe Text)
122+tllAccessToken
123+ = lens _tllAccessToken
124+ (\ s a -> s{_tllAccessToken = a})
125+
126+-- | Legacy upload protocol for media (e.g. \"media\", \"multipart\").
127+tllUploadType :: Lens' ThreatListsList (Maybe Text)
128+tllUploadType
129+ = lens _tllUploadType
130+ (\ s a -> s{_tllUploadType = a})
131+
132+-- | OAuth bearer token.
133+tllBearerToken :: Lens' ThreatListsList (Maybe Text)
134+tllBearerToken
135+ = lens _tllBearerToken
136+ (\ s a -> s{_tllBearerToken = a})
137+
138+-- | JSONP
139+tllCallback :: Lens' ThreatListsList (Maybe Text)
140+tllCallback
141+ = lens _tllCallback (\ s a -> s{_tllCallback = a})
142+
143+instance GoogleRequest ThreatListsList where
144+ type Rs ThreatListsList = ListThreatListsResponse
145+ type Scopes ThreatListsList = '[]
146+ requestClient ThreatListsList'{..}
147+ = go _tllXgafv _tllUploadProtocol (Just _tllPp)
148+ _tllAccessToken
149+ _tllUploadType
150+ _tllBearerToken
151+ _tllCallback
152+ (Just AltJSON)
153+ safeBrowsingService
154+ where go
155+ = buildClient
156+ (Proxy :: Proxy ThreatListsListResource)
157+ mempty
gogol-safebrowsing/gen/Network/Google/Resource/SafeBrowsing/ThreatMatches/Find.hsnew file+170
@@ -0,0 +1,170 @@
1+{-# LANGUAGE DataKinds #-}
2+{-# LANGUAGE DeriveDataTypeable #-}
3+{-# LANGUAGE DeriveGeneric #-}
4+{-# LANGUAGE FlexibleInstances #-}
5+{-# LANGUAGE NoImplicitPrelude #-}
6+{-# LANGUAGE OverloadedStrings #-}
7+{-# LANGUAGE RecordWildCards #-}
8+{-# LANGUAGE TypeFamilies #-}
9+{-# LANGUAGE TypeOperators #-}
10+
11+{-# OPTIONS_GHC -fno-warn-duplicate-exports #-}
12+{-# OPTIONS_GHC -fno-warn-unused-binds #-}
13+{-# OPTIONS_GHC -fno-warn-unused-imports #-}
14+
15+-- |
16+-- Module : Network.Google.Resource.SafeBrowsing.ThreatMatches.Find
17+-- Copyright : (c) 2015-2016 Brendan Hay
18+-- License : Mozilla Public License, v. 2.0.
19+-- Maintainer : Brendan Hay <brendan.g.hay@gmail.com>
20+-- Stability : auto-generated
21+-- Portability : non-portable (GHC extensions)
22+--
23+-- Finds the threat entries that match the Safe Browsing lists.
24+--
25+-- /See:/ <https://developers.google.com/safe-browsing/ Safe Browsing APIs Reference> for @safebrowsing.threatMatches.find@.
26+module Network.Google.Resource.SafeBrowsing.ThreatMatches.Find
27+ (
28+ -- * REST Resource
29+ ThreatMatchesFindResource
30+
31+ -- * Creating a Request
32+ , threatMatchesFind
33+ , ThreatMatchesFind
34+
35+ -- * Request Lenses
36+ , tmfXgafv
37+ , tmfUploadProtocol
38+ , tmfPp
39+ , tmfAccessToken
40+ , tmfUploadType
41+ , tmfPayload
42+ , tmfBearerToken
43+ , tmfCallback
44+ ) where
45+
46+import Network.Google.Prelude
47+import Network.Google.SafeBrowsing.Types
48+
49+-- | A resource alias for @safebrowsing.threatMatches.find@ method which the
50+-- 'ThreatMatchesFind' request conforms to.
51+type ThreatMatchesFindResource =
52+ "v4" :>
53+ "threatMatches:find" :>
54+ QueryParam "$.xgafv" Text :>
55+ QueryParam "upload_protocol" Text :>
56+ QueryParam "pp" Bool :>
57+ QueryParam "access_token" Text :>
58+ QueryParam "uploadType" Text :>
59+ QueryParam "bearer_token" Text :>
60+ QueryParam "callback" Text :>
61+ QueryParam "alt" AltJSON :>
62+ ReqBody '[JSON] FindThreatMatchesRequest :>
63+ Post '[JSON] FindThreatMatchesResponse
64+
65+-- | Finds the threat entries that match the Safe Browsing lists.
66+--
67+-- /See:/ 'threatMatchesFind' smart constructor.
68+data ThreatMatchesFind = ThreatMatchesFind'
69+ { _tmfXgafv :: !(Maybe Text)
70+ , _tmfUploadProtocol :: !(Maybe Text)
71+ , _tmfPp :: !Bool
72+ , _tmfAccessToken :: !(Maybe Text)
73+ , _tmfUploadType :: !(Maybe Text)
74+ , _tmfPayload :: !FindThreatMatchesRequest
75+ , _tmfBearerToken :: !(Maybe Text)
76+ , _tmfCallback :: !(Maybe Text)
77+ } deriving (Eq,Show,Data,Typeable,Generic)
78+
79+-- | Creates a value of 'ThreatMatchesFind' with the minimum fields required to make a request.
80+--
81+-- Use one of the following lenses to modify other fields as desired:
82+--
83+-- * 'tmfXgafv'
84+--
85+-- * 'tmfUploadProtocol'
86+--
87+-- * 'tmfPp'
88+--
89+-- * 'tmfAccessToken'
90+--
91+-- * 'tmfUploadType'
92+--
93+-- * 'tmfPayload'
94+--
95+-- * 'tmfBearerToken'
96+--
97+-- * 'tmfCallback'
98+threatMatchesFind
99+ :: FindThreatMatchesRequest -- ^ 'tmfPayload'
100+ -> ThreatMatchesFind
101+threatMatchesFind pTmfPayload_ =
102+ ThreatMatchesFind'
103+ { _tmfXgafv = Nothing
104+ , _tmfUploadProtocol = Nothing
105+ , _tmfPp = True
106+ , _tmfAccessToken = Nothing
107+ , _tmfUploadType = Nothing
108+ , _tmfPayload = pTmfPayload_
109+ , _tmfBearerToken = Nothing
110+ , _tmfCallback = Nothing
111+ }
112+
113+-- | V1 error format.
114+tmfXgafv :: Lens' ThreatMatchesFind (Maybe Text)
115+tmfXgafv = lens _tmfXgafv (\ s a -> s{_tmfXgafv = a})
116+
117+-- | Upload protocol for media (e.g. \"raw\", \"multipart\").
118+tmfUploadProtocol :: Lens' ThreatMatchesFind (Maybe Text)
119+tmfUploadProtocol
120+ = lens _tmfUploadProtocol
121+ (\ s a -> s{_tmfUploadProtocol = a})
122+
123+-- | Pretty-print response.
124+tmfPp :: Lens' ThreatMatchesFind Bool
125+tmfPp = lens _tmfPp (\ s a -> s{_tmfPp = a})
126+
127+-- | OAuth access token.
128+tmfAccessToken :: Lens' ThreatMatchesFind (Maybe Text)
129+tmfAccessToken
130+ = lens _tmfAccessToken
131+ (\ s a -> s{_tmfAccessToken = a})
132+
133+-- | Legacy upload protocol for media (e.g. \"media\", \"multipart\").
134+tmfUploadType :: Lens' ThreatMatchesFind (Maybe Text)
135+tmfUploadType
136+ = lens _tmfUploadType
137+ (\ s a -> s{_tmfUploadType = a})
138+
139+-- | Multipart request metadata.
140+tmfPayload :: Lens' ThreatMatchesFind FindThreatMatchesRequest
141+tmfPayload
142+ = lens _tmfPayload (\ s a -> s{_tmfPayload = a})
143+
144+-- | OAuth bearer token.
145+tmfBearerToken :: Lens' ThreatMatchesFind (Maybe Text)
146+tmfBearerToken
147+ = lens _tmfBearerToken
148+ (\ s a -> s{_tmfBearerToken = a})
149+
150+-- | JSONP
151+tmfCallback :: Lens' ThreatMatchesFind (Maybe Text)
152+tmfCallback
153+ = lens _tmfCallback (\ s a -> s{_tmfCallback = a})
154+
155+instance GoogleRequest ThreatMatchesFind where
156+ type Rs ThreatMatchesFind = FindThreatMatchesResponse
157+ type Scopes ThreatMatchesFind = '[]
158+ requestClient ThreatMatchesFind'{..}
159+ = go _tmfXgafv _tmfUploadProtocol (Just _tmfPp)
160+ _tmfAccessToken
161+ _tmfUploadType
162+ _tmfBearerToken
163+ _tmfCallback
164+ (Just AltJSON)
165+ _tmfPayload
166+ safeBrowsingService
167+ where go
168+ = buildClient
169+ (Proxy :: Proxy ThreatMatchesFindResource)
170+ mempty
gogol-safebrowsing/gen/Network/Google/SafeBrowsing.hsnew file+213
@@ -0,0 +1,213 @@
1+{-# LANGUAGE DataKinds #-}
2+{-# LANGUAGE NoImplicitPrelude #-}
3+{-# LANGUAGE TypeOperators #-}
4+
5+{-# OPTIONS_GHC -fno-warn-unused-imports #-}
6+{-# OPTIONS_GHC -fno-warn-duplicate-exports #-}
7+
8+-- |
9+-- Module : Network.Google.SafeBrowsing
10+-- Copyright : (c) 2015-2016 Brendan Hay
11+-- License : Mozilla Public License, v. 2.0.
12+-- Maintainer : Brendan Hay <brendan.g.hay@gmail.com>
13+-- Stability : auto-generated
14+-- Portability : non-portable (GHC extensions)
15+--
16+-- Enables client applications to check web resources (most commonly URLs)
17+-- against Google-generated lists of unsafe web resources.
18+--
19+-- /See:/ <https://developers.google.com/safe-browsing/ Safe Browsing APIs Reference>
20+module Network.Google.SafeBrowsing
21+ (
22+ -- * Service Configuration
23+ safeBrowsingService
24+
25+ -- * API Declaration
26+ , SafeBrowsingAPI
27+
28+ -- * Resources
29+
30+ -- ** safebrowsing.fullHashes.find
31+ , module Network.Google.Resource.SafeBrowsing.FullHashes.Find
32+
33+ -- ** safebrowsing.threatListUpdates.fetch
34+ , module Network.Google.Resource.SafeBrowsing.ThreatListUpdates.Fetch
35+
36+ -- ** safebrowsing.threatLists.list
37+ , module Network.Google.Resource.SafeBrowsing.ThreatLists.List
38+
39+ -- ** safebrowsing.threatMatches.find
40+ , module Network.Google.Resource.SafeBrowsing.ThreatMatches.Find
41+
42+ -- * Types
43+
44+ -- ** ThreatEntryMetadata
45+ , ThreatEntryMetadata
46+ , threatEntryMetadata
47+ , temEntries
48+
49+ -- ** Checksum
50+ , Checksum
51+ , checksum
52+ , cSha256
53+
54+ -- ** FindThreatMatchesResponse
55+ , FindThreatMatchesResponse
56+ , findThreatMatchesResponse
57+ , ftmrMatches
58+
59+ -- ** ThreatInfo
60+ , ThreatInfo
61+ , threatInfo
62+ , tiThreatEntries
63+ , tiThreatTypes
64+ , tiPlatformTypes
65+ , tiThreatEntryTypes
66+
67+ -- ** FetchThreatListUpdatesRequest
68+ , FetchThreatListUpdatesRequest
69+ , fetchThreatListUpdatesRequest
70+ , ftlurListUpdateRequests
71+ , ftlurClient
72+
73+ -- ** FindFullHashesRequest
74+ , FindFullHashesRequest
75+ , findFullHashesRequest
76+ , ffhrThreatInfo
77+ , ffhrClientStates
78+ , ffhrClient
79+
80+ -- ** Constraints
81+ , Constraints
82+ , constraints
83+ , cMaxUpdateEntries
84+ , cRegion
85+ , cSupportedCompressions
86+ , cMaxDatabaseEntries
87+
88+ -- ** RiceDeltaEncoding
89+ , RiceDeltaEncoding
90+ , riceDeltaEncoding
91+ , rdeFirstValue
92+ , rdeRiceParameter
93+ , rdeNumEntries
94+ , rdeEncodedData
95+
96+ -- ** ListThreatListsResponse
97+ , ListThreatListsResponse
98+ , listThreatListsResponse
99+ , ltlrThreatLists
100+
101+ -- ** ThreatListDescriptor
102+ , ThreatListDescriptor
103+ , threatListDescriptor
104+ , tldThreatEntryType
105+ , tldThreatType
106+ , tldPlatformType
107+
108+ -- ** ClientInfo
109+ , ClientInfo
110+ , clientInfo
111+ , ciClientId
112+ , ciClientVersion
113+
114+ -- ** FindThreatMatchesRequest
115+ , FindThreatMatchesRequest
116+ , findThreatMatchesRequest
117+ , ftmrThreatInfo
118+ , ftmrClient
119+
120+ -- ** ListUpdateRequest
121+ , ListUpdateRequest
122+ , listUpdateRequest
123+ , lurState
124+ , lurThreatEntryType
125+ , lurConstraints
126+ , lurThreatType
127+ , lurPlatformType
128+
129+ -- ** ThreatEntry
130+ , ThreatEntry
131+ , threatEntry
132+ , teHash
133+ , teURL
134+ , teDigest
135+
136+ -- ** ThreatMatch
137+ , ThreatMatch
138+ , threatMatch
139+ , tmThreatEntryMetadata
140+ , tmThreatEntryType
141+ , tmThreatType
142+ , tmPlatformType
143+ , tmCacheDuration
144+ , tmThreat
145+
146+ -- ** RawHashes
147+ , RawHashes
148+ , rawHashes
149+ , rhPrefixSize
150+ , rhRawHashes
151+
152+ -- ** ListUpdateResponse
153+ , ListUpdateResponse
154+ , listUpdateResponse
155+ , lAdditions
156+ , lThreatEntryType
157+ , lChecksum
158+ , lThreatType
159+ , lPlatformType
160+ , lNewClientState
161+ , lRemovals
162+ , lResponseType
163+
164+ -- ** ThreatEntrySet
165+ , ThreatEntrySet
166+ , threatEntrySet
167+ , tesRiceHashes
168+ , tesRiceIndices
169+ , tesRawHashes
170+ , tesRawIndices
171+ , tesCompressionType
172+
173+ -- ** RawIndices
174+ , RawIndices
175+ , rawIndices
176+ , riIndices
177+
178+ -- ** FindFullHashesResponse
179+ , FindFullHashesResponse
180+ , findFullHashesResponse
181+ , ffhrMatches
182+ , ffhrNegativeCacheDuration
183+ , ffhrMinimumWaitDuration
184+
185+ -- ** MetadataEntry
186+ , MetadataEntry
187+ , metadataEntry
188+ , meValue
189+ , meKey
190+
191+ -- ** FetchThreatListUpdatesResponse
192+ , FetchThreatListUpdatesResponse
193+ , fetchThreatListUpdatesResponse
194+ , ftlurListUpdateResponses
195+ , ftlurMinimumWaitDuration
196+ ) where
197+
198+import Network.Google.Prelude
199+import Network.Google.Resource.SafeBrowsing.FullHashes.Find
200+import Network.Google.Resource.SafeBrowsing.ThreatLists.List
201+import Network.Google.Resource.SafeBrowsing.ThreatListUpdates.Fetch
202+import Network.Google.Resource.SafeBrowsing.ThreatMatches.Find
203+import Network.Google.SafeBrowsing.Types
204+
205+{- $resources
206+TODO
207+-}
208+
209+-- | Represents the entirety of the methods and resources available for the Safe Browsing APIs service.
210+type SafeBrowsingAPI =
211+ FullHashesFindResource :<|> ThreatMatchesFindResource
212+ :<|> ThreatListUpdatesFetchResource
213+ :<|> ThreatListsListResource
gogol-safebrowsing/gen/Network/Google/SafeBrowsing/Types.hsnew file+184
@@ -0,0 +1,184 @@
1+{-# LANGUAGE DataKinds #-}
2+{-# LANGUAGE DeriveDataTypeable #-}
3+{-# LANGUAGE DeriveGeneric #-}
4+{-# LANGUAGE NoImplicitPrelude #-}
5+{-# LANGUAGE OverloadedStrings #-}
6+
7+{-# OPTIONS_GHC -fno-warn-unused-imports #-}
8+
9+-- |
10+-- Module : Network.Google.SafeBrowsing.Types
11+-- Copyright : (c) 2015-2016 Brendan Hay
12+-- License : Mozilla Public License, v. 2.0.
13+-- Maintainer : Brendan Hay <brendan.g.hay@gmail.com>
14+-- Stability : auto-generated
15+-- Portability : non-portable (GHC extensions)
16+--
17+module Network.Google.SafeBrowsing.Types
18+ (
19+ -- * Service Configuration
20+ safeBrowsingService
21+
22+ -- * ThreatEntryMetadata
23+ , ThreatEntryMetadata
24+ , threatEntryMetadata
25+ , temEntries
26+
27+ -- * Checksum
28+ , Checksum
29+ , checksum
30+ , cSha256
31+
32+ -- * FindThreatMatchesResponse
33+ , FindThreatMatchesResponse
34+ , findThreatMatchesResponse
35+ , ftmrMatches
36+
37+ -- * ThreatInfo
38+ , ThreatInfo
39+ , threatInfo
40+ , tiThreatEntries
41+ , tiThreatTypes
42+ , tiPlatformTypes
43+ , tiThreatEntryTypes
44+
45+ -- * FetchThreatListUpdatesRequest
46+ , FetchThreatListUpdatesRequest
47+ , fetchThreatListUpdatesRequest
48+ , ftlurListUpdateRequests
49+ , ftlurClient
50+
51+ -- * FindFullHashesRequest
52+ , FindFullHashesRequest
53+ , findFullHashesRequest
54+ , ffhrThreatInfo
55+ , ffhrClientStates
56+ , ffhrClient
57+
58+ -- * Constraints
59+ , Constraints
60+ , constraints
61+ , cMaxUpdateEntries
62+ , cRegion
63+ , cSupportedCompressions
64+ , cMaxDatabaseEntries
65+
66+ -- * RiceDeltaEncoding
67+ , RiceDeltaEncoding
68+ , riceDeltaEncoding
69+ , rdeFirstValue
70+ , rdeRiceParameter
71+ , rdeNumEntries
72+ , rdeEncodedData
73+
74+ -- * ListThreatListsResponse
75+ , ListThreatListsResponse
76+ , listThreatListsResponse
77+ , ltlrThreatLists
78+
79+ -- * ThreatListDescriptor
80+ , ThreatListDescriptor
81+ , threatListDescriptor
82+ , tldThreatEntryType
83+ , tldThreatType
84+ , tldPlatformType
85+
86+ -- * ClientInfo
87+ , ClientInfo
88+ , clientInfo
89+ , ciClientId
90+ , ciClientVersion
91+
92+ -- * FindThreatMatchesRequest
93+ , FindThreatMatchesRequest
94+ , findThreatMatchesRequest
95+ , ftmrThreatInfo
96+ , ftmrClient
97+
98+ -- * ListUpdateRequest
99+ , ListUpdateRequest
100+ , listUpdateRequest
101+ , lurState
102+ , lurThreatEntryType
103+ , lurConstraints
104+ , lurThreatType
105+ , lurPlatformType
106+
107+ -- * ThreatEntry
108+ , ThreatEntry
109+ , threatEntry
110+ , teHash
111+ , teURL
112+ , teDigest
113+
114+ -- * ThreatMatch
115+ , ThreatMatch
116+ , threatMatch
117+ , tmThreatEntryMetadata
118+ , tmThreatEntryType
119+ , tmThreatType
120+ , tmPlatformType
121+ , tmCacheDuration
122+ , tmThreat
123+
124+ -- * RawHashes
125+ , RawHashes
126+ , rawHashes
127+ , rhPrefixSize
128+ , rhRawHashes
129+
130+ -- * ListUpdateResponse
131+ , ListUpdateResponse
132+ , listUpdateResponse
133+ , lAdditions
134+ , lThreatEntryType
135+ , lChecksum
136+ , lThreatType
137+ , lPlatformType
138+ , lNewClientState
139+ , lRemovals
140+ , lResponseType
141+
142+ -- * ThreatEntrySet
143+ , ThreatEntrySet
144+ , threatEntrySet
145+ , tesRiceHashes
146+ , tesRiceIndices
147+ , tesRawHashes
148+ , tesRawIndices
149+ , tesCompressionType
150+
151+ -- * RawIndices
152+ , RawIndices
153+ , rawIndices
154+ , riIndices
155+
156+ -- * FindFullHashesResponse
157+ , FindFullHashesResponse
158+ , findFullHashesResponse
159+ , ffhrMatches
160+ , ffhrNegativeCacheDuration
161+ , ffhrMinimumWaitDuration
162+
163+ -- * MetadataEntry
164+ , MetadataEntry
165+ , metadataEntry
166+ , meValue
167+ , meKey
168+
169+ -- * FetchThreatListUpdatesResponse
170+ , FetchThreatListUpdatesResponse
171+ , fetchThreatListUpdatesResponse
172+ , ftlurListUpdateResponses
173+ , ftlurMinimumWaitDuration
174+ ) where
175+
176+import Network.Google.Prelude
177+import Network.Google.SafeBrowsing.Types.Product
178+import Network.Google.SafeBrowsing.Types.Sum
179+
180+-- | Default request referring to version 'v4' of the Safe Browsing APIs. This contains the host and root path used as a starting point for constructing service requests.
181+safeBrowsingService :: ServiceConfig
182+safeBrowsingService
183+ = defaultService (ServiceId "safebrowsing:v4")
184+ "safebrowsing.googleapis.com"
gogol-safebrowsing/gen/Network/Google/SafeBrowsing/Types/Product.hsnew file+1417
@@ -0,0 +1,1417 @@
1+{-# LANGUAGE DeriveDataTypeable #-}
2+{-# LANGUAGE DeriveGeneric #-}
3+{-# LANGUAGE NoImplicitPrelude #-}
4+{-# LANGUAGE OverloadedStrings #-}
5+{-# LANGUAGE RecordWildCards #-}
6+
7+{-# OPTIONS_GHC -fno-warn-unused-binds #-}
8+{-# OPTIONS_GHC -fno-warn-unused-imports #-}
9+
10+-- |
11+-- Module : Network.Google.SafeBrowsing.Types.Product
12+-- Copyright : (c) 2015-2016 Brendan Hay
13+-- License : Mozilla Public License, v. 2.0.
14+-- Maintainer : Brendan Hay <brendan.g.hay@gmail.com>
15+-- Stability : auto-generated
16+-- Portability : non-portable (GHC extensions)
17+--
18+module Network.Google.SafeBrowsing.Types.Product where
19+
20+import Network.Google.Prelude
21+import Network.Google.SafeBrowsing.Types.Sum
22+
23+-- | The metadata associated with a specific threat entry. The client is
24+-- expected to know the metadata key\/value pairs associated with each
25+-- threat type.
26+--
27+-- /See:/ 'threatEntryMetadata' smart constructor.
28+newtype ThreatEntryMetadata = ThreatEntryMetadata'
29+ { _temEntries :: Maybe [MetadataEntry]
30+ } deriving (Eq,Show,Data,Typeable,Generic)
31+
32+-- | Creates a value of 'ThreatEntryMetadata' with the minimum fields required to make a request.
33+--
34+-- Use one of the following lenses to modify other fields as desired:
35+--
36+-- * 'temEntries'
37+threatEntryMetadata
38+ :: ThreatEntryMetadata
39+threatEntryMetadata =
40+ ThreatEntryMetadata'
41+ { _temEntries = Nothing
42+ }
43+
44+-- | The metadata entries.
45+temEntries :: Lens' ThreatEntryMetadata [MetadataEntry]
46+temEntries
47+ = lens _temEntries (\ s a -> s{_temEntries = a}) .
48+ _Default
49+ . _Coerce
50+
51+instance FromJSON ThreatEntryMetadata where
52+ parseJSON
53+ = withObject "ThreatEntryMetadata"
54+ (\ o ->
55+ ThreatEntryMetadata' <$>
56+ (o .:? "entries" .!= mempty))
57+
58+instance ToJSON ThreatEntryMetadata where
59+ toJSON ThreatEntryMetadata'{..}
60+ = object (catMaybes [("entries" .=) <$> _temEntries])
61+
62+-- | The expected state of a client\'s local database.
63+--
64+-- /See:/ 'checksum' smart constructor.
65+newtype Checksum = Checksum'
66+ { _cSha256 :: Maybe Base64
67+ } deriving (Eq,Show,Data,Typeable,Generic)
68+
69+-- | Creates a value of 'Checksum' with the minimum fields required to make a request.
70+--
71+-- Use one of the following lenses to modify other fields as desired:
72+--
73+-- * 'cSha256'
74+checksum
75+ :: Checksum
76+checksum =
77+ Checksum'
78+ { _cSha256 = Nothing
79+ }
80+
81+-- | The SHA256 hash of the client state; that is, of the sorted list of all
82+-- hashes present in the database.
83+cSha256 :: Lens' Checksum (Maybe ByteString)
84+cSha256
85+ = lens _cSha256 (\ s a -> s{_cSha256 = a}) .
86+ mapping _Base64
87+
88+instance FromJSON Checksum where
89+ parseJSON
90+ = withObject "Checksum"
91+ (\ o -> Checksum' <$> (o .:? "sha256"))
92+
93+instance ToJSON Checksum where
94+ toJSON Checksum'{..}
95+ = object (catMaybes [("sha256" .=) <$> _cSha256])
96+
97+--
98+-- /See:/ 'findThreatMatchesResponse' smart constructor.
99+newtype FindThreatMatchesResponse = FindThreatMatchesResponse'
100+ { _ftmrMatches :: Maybe [ThreatMatch]
101+ } deriving (Eq,Show,Data,Typeable,Generic)
102+
103+-- | Creates a value of 'FindThreatMatchesResponse' with the minimum fields required to make a request.
104+--
105+-- Use one of the following lenses to modify other fields as desired:
106+--
107+-- * 'ftmrMatches'
108+findThreatMatchesResponse
109+ :: FindThreatMatchesResponse
110+findThreatMatchesResponse =
111+ FindThreatMatchesResponse'
112+ { _ftmrMatches = Nothing
113+ }
114+
115+-- | The threat list matches.
116+ftmrMatches :: Lens' FindThreatMatchesResponse [ThreatMatch]
117+ftmrMatches
118+ = lens _ftmrMatches (\ s a -> s{_ftmrMatches = a}) .
119+ _Default
120+ . _Coerce
121+
122+instance FromJSON FindThreatMatchesResponse where
123+ parseJSON
124+ = withObject "FindThreatMatchesResponse"
125+ (\ o ->
126+ FindThreatMatchesResponse' <$>
127+ (o .:? "matches" .!= mempty))
128+
129+instance ToJSON FindThreatMatchesResponse where
130+ toJSON FindThreatMatchesResponse'{..}
131+ = object
132+ (catMaybes [("matches" .=) <$> _ftmrMatches])
133+
134+-- | The information regarding one or more threats that a client submits when
135+-- checking for matches in threat lists.
136+--
137+-- /See:/ 'threatInfo' smart constructor.
138+data ThreatInfo = ThreatInfo'
139+ { _tiThreatEntries :: !(Maybe [ThreatEntry])
140+ , _tiThreatTypes :: !(Maybe [Text])
141+ , _tiPlatformTypes :: !(Maybe [Text])
142+ , _tiThreatEntryTypes :: !(Maybe [Text])
143+ } deriving (Eq,Show,Data,Typeable,Generic)
144+
145+-- | Creates a value of 'ThreatInfo' with the minimum fields required to make a request.
146+--
147+-- Use one of the following lenses to modify other fields as desired:
148+--
149+-- * 'tiThreatEntries'
150+--
151+-- * 'tiThreatTypes'
152+--
153+-- * 'tiPlatformTypes'
154+--
155+-- * 'tiThreatEntryTypes'
156+threatInfo
157+ :: ThreatInfo
158+threatInfo =
159+ ThreatInfo'
160+ { _tiThreatEntries = Nothing
161+ , _tiThreatTypes = Nothing
162+ , _tiPlatformTypes = Nothing
163+ , _tiThreatEntryTypes = Nothing
164+ }
165+
166+-- | The threat entries to be checked.
167+tiThreatEntries :: Lens' ThreatInfo [ThreatEntry]
168+tiThreatEntries
169+ = lens _tiThreatEntries
170+ (\ s a -> s{_tiThreatEntries = a})
171+ . _Default
172+ . _Coerce
173+
174+-- | The threat types to be checked.
175+tiThreatTypes :: Lens' ThreatInfo [Text]
176+tiThreatTypes
177+ = lens _tiThreatTypes
178+ (\ s a -> s{_tiThreatTypes = a})
179+ . _Default
180+ . _Coerce
181+
182+-- | The platform types to be checked.
183+tiPlatformTypes :: Lens' ThreatInfo [Text]
184+tiPlatformTypes
185+ = lens _tiPlatformTypes
186+ (\ s a -> s{_tiPlatformTypes = a})
187+ . _Default
188+ . _Coerce
189+
190+-- | The entry types to be checked.
191+tiThreatEntryTypes :: Lens' ThreatInfo [Text]
192+tiThreatEntryTypes
193+ = lens _tiThreatEntryTypes
194+ (\ s a -> s{_tiThreatEntryTypes = a})
195+ . _Default
196+ . _Coerce
197+
198+instance FromJSON ThreatInfo where
199+ parseJSON
200+ = withObject "ThreatInfo"
201+ (\ o ->
202+ ThreatInfo' <$>
203+ (o .:? "threatEntries" .!= mempty) <*>
204+ (o .:? "threatTypes" .!= mempty)
205+ <*> (o .:? "platformTypes" .!= mempty)
206+ <*> (o .:? "threatEntryTypes" .!= mempty))
207+
208+instance ToJSON ThreatInfo where
209+ toJSON ThreatInfo'{..}
210+ = object
211+ (catMaybes
212+ [("threatEntries" .=) <$> _tiThreatEntries,
213+ ("threatTypes" .=) <$> _tiThreatTypes,
214+ ("platformTypes" .=) <$> _tiPlatformTypes,
215+ ("threatEntryTypes" .=) <$> _tiThreatEntryTypes])
216+
217+-- | Describes a Safe Browsing API update request. Clients can request
218+-- updates for multiple lists in a single request. NOTE: Field index 2 is
219+-- unused. NEXT: 4
220+--
221+-- /See:/ 'fetchThreatListUpdatesRequest' smart constructor.
222+data FetchThreatListUpdatesRequest = FetchThreatListUpdatesRequest'
223+ { _ftlurListUpdateRequests :: !(Maybe [ListUpdateRequest])
224+ , _ftlurClient :: !(Maybe ClientInfo)
225+ } deriving (Eq,Show,Data,Typeable,Generic)
226+
227+-- | Creates a value of 'FetchThreatListUpdatesRequest' with the minimum fields required to make a request.
228+--
229+-- Use one of the following lenses to modify other fields as desired:
230+--
231+-- * 'ftlurListUpdateRequests'
232+--
233+-- * 'ftlurClient'
234+fetchThreatListUpdatesRequest
235+ :: FetchThreatListUpdatesRequest
236+fetchThreatListUpdatesRequest =
237+ FetchThreatListUpdatesRequest'
238+ { _ftlurListUpdateRequests = Nothing
239+ , _ftlurClient = Nothing
240+ }
241+
242+-- | The requested threat list updates.
243+ftlurListUpdateRequests :: Lens' FetchThreatListUpdatesRequest [ListUpdateRequest]
244+ftlurListUpdateRequests
245+ = lens _ftlurListUpdateRequests
246+ (\ s a -> s{_ftlurListUpdateRequests = a})
247+ . _Default
248+ . _Coerce
249+
250+-- | The client metadata.
251+ftlurClient :: Lens' FetchThreatListUpdatesRequest (Maybe ClientInfo)
252+ftlurClient
253+ = lens _ftlurClient (\ s a -> s{_ftlurClient = a})
254+
255+instance FromJSON FetchThreatListUpdatesRequest where
256+ parseJSON
257+ = withObject "FetchThreatListUpdatesRequest"
258+ (\ o ->
259+ FetchThreatListUpdatesRequest' <$>
260+ (o .:? "listUpdateRequests" .!= mempty) <*>
261+ (o .:? "client"))
262+
263+instance ToJSON FetchThreatListUpdatesRequest where
264+ toJSON FetchThreatListUpdatesRequest'{..}
265+ = object
266+ (catMaybes
267+ [("listUpdateRequests" .=) <$>
268+ _ftlurListUpdateRequests,
269+ ("client" .=) <$> _ftlurClient])
270+
271+-- | Request to return full hashes matched by the provided hash prefixes.
272+--
273+-- /See:/ 'findFullHashesRequest' smart constructor.
274+data FindFullHashesRequest = FindFullHashesRequest'
275+ { _ffhrThreatInfo :: !(Maybe ThreatInfo)
276+ , _ffhrClientStates :: !(Maybe [Base64])
277+ , _ffhrClient :: !(Maybe ClientInfo)
278+ } deriving (Eq,Show,Data,Typeable,Generic)
279+
280+-- | Creates a value of 'FindFullHashesRequest' with the minimum fields required to make a request.
281+--
282+-- Use one of the following lenses to modify other fields as desired:
283+--
284+-- * 'ffhrThreatInfo'
285+--
286+-- * 'ffhrClientStates'
287+--
288+-- * 'ffhrClient'
289+findFullHashesRequest
290+ :: FindFullHashesRequest
291+findFullHashesRequest =
292+ FindFullHashesRequest'
293+ { _ffhrThreatInfo = Nothing
294+ , _ffhrClientStates = Nothing
295+ , _ffhrClient = Nothing
296+ }
297+
298+-- | The lists and hashes to be checked.
299+ffhrThreatInfo :: Lens' FindFullHashesRequest (Maybe ThreatInfo)
300+ffhrThreatInfo
301+ = lens _ffhrThreatInfo
302+ (\ s a -> s{_ffhrThreatInfo = a})
303+
304+-- | The current client states for each of the client\'s local threat lists.
305+ffhrClientStates :: Lens' FindFullHashesRequest [ByteString]
306+ffhrClientStates
307+ = lens _ffhrClientStates
308+ (\ s a -> s{_ffhrClientStates = a})
309+ . _Default
310+ . _Coerce
311+
312+-- | The client metadata.
313+ffhrClient :: Lens' FindFullHashesRequest (Maybe ClientInfo)
314+ffhrClient
315+ = lens _ffhrClient (\ s a -> s{_ffhrClient = a})
316+
317+instance FromJSON FindFullHashesRequest where
318+ parseJSON
319+ = withObject "FindFullHashesRequest"
320+ (\ o ->
321+ FindFullHashesRequest' <$>
322+ (o .:? "threatInfo") <*>
323+ (o .:? "clientStates" .!= mempty)
324+ <*> (o .:? "client"))
325+
326+instance ToJSON FindFullHashesRequest where
327+ toJSON FindFullHashesRequest'{..}
328+ = object
329+ (catMaybes
330+ [("threatInfo" .=) <$> _ffhrThreatInfo,
331+ ("clientStates" .=) <$> _ffhrClientStates,
332+ ("client" .=) <$> _ffhrClient])
333+
334+-- | The constraints for this update.
335+--
336+-- /See:/ 'constraints' smart constructor.
337+data Constraints = Constraints'
338+ { _cMaxUpdateEntries :: !(Maybe (Textual Int32))
339+ , _cRegion :: !(Maybe Text)
340+ , _cSupportedCompressions :: !(Maybe [Text])
341+ , _cMaxDatabaseEntries :: !(Maybe (Textual Int32))
342+ } deriving (Eq,Show,Data,Typeable,Generic)
343+
344+-- | Creates a value of 'Constraints' with the minimum fields required to make a request.
345+--
346+-- Use one of the following lenses to modify other fields as desired:
347+--
348+-- * 'cMaxUpdateEntries'
349+--
350+-- * 'cRegion'
351+--
352+-- * 'cSupportedCompressions'
353+--
354+-- * 'cMaxDatabaseEntries'
355+constraints
356+ :: Constraints
357+constraints =
358+ Constraints'
359+ { _cMaxUpdateEntries = Nothing
360+ , _cRegion = Nothing
361+ , _cSupportedCompressions = Nothing
362+ , _cMaxDatabaseEntries = Nothing
363+ }
364+
365+-- | The maximum size in number of entries. The update will not contain more
366+-- entries than this value. This should be a power of 2 between 2**10 and
367+-- 2**20. If zero, no update size limit is set.
368+cMaxUpdateEntries :: Lens' Constraints (Maybe Int32)
369+cMaxUpdateEntries
370+ = lens _cMaxUpdateEntries
371+ (\ s a -> s{_cMaxUpdateEntries = a})
372+ . mapping _Coerce
373+
374+-- | Requests the list for a specific geographic location. If not set the
375+-- server may pick that value based on the user\'s IP address. Expects ISO
376+-- 3166-1 alpha-2 format.
377+cRegion :: Lens' Constraints (Maybe Text)
378+cRegion = lens _cRegion (\ s a -> s{_cRegion = a})
379+
380+-- | The compression types supported by the client.
381+cSupportedCompressions :: Lens' Constraints [Text]
382+cSupportedCompressions
383+ = lens _cSupportedCompressions
384+ (\ s a -> s{_cSupportedCompressions = a})
385+ . _Default
386+ . _Coerce
387+
388+-- | Sets the maximum number of entries that the client is willing to have in
389+-- the local database. This should be a power of 2 between 2**10 and 2**20.
390+-- If zero, no database size limit is set.
391+cMaxDatabaseEntries :: Lens' Constraints (Maybe Int32)
392+cMaxDatabaseEntries
393+ = lens _cMaxDatabaseEntries
394+ (\ s a -> s{_cMaxDatabaseEntries = a})
395+ . mapping _Coerce
396+
397+instance FromJSON Constraints where
398+ parseJSON
399+ = withObject "Constraints"
400+ (\ o ->
401+ Constraints' <$>
402+ (o .:? "maxUpdateEntries") <*> (o .:? "region") <*>
403+ (o .:? "supportedCompressions" .!= mempty)
404+ <*> (o .:? "maxDatabaseEntries"))
405+
406+instance ToJSON Constraints where
407+ toJSON Constraints'{..}
408+ = object
409+ (catMaybes
410+ [("maxUpdateEntries" .=) <$> _cMaxUpdateEntries,
411+ ("region" .=) <$> _cRegion,
412+ ("supportedCompressions" .=) <$>
413+ _cSupportedCompressions,
414+ ("maxDatabaseEntries" .=) <$> _cMaxDatabaseEntries])
415+
416+-- | The Rice-Golomb encoded data. Used for sending compressed 4-byte hashes
417+-- or compressed removal indices.
418+--
419+-- /See:/ 'riceDeltaEncoding' smart constructor.
420+data RiceDeltaEncoding = RiceDeltaEncoding'
421+ { _rdeFirstValue :: !(Maybe (Textual Int64))
422+ , _rdeRiceParameter :: !(Maybe (Textual Int32))
423+ , _rdeNumEntries :: !(Maybe (Textual Int32))
424+ , _rdeEncodedData :: !(Maybe Base64)
425+ } deriving (Eq,Show,Data,Typeable,Generic)
426+
427+-- | Creates a value of 'RiceDeltaEncoding' with the minimum fields required to make a request.
428+--
429+-- Use one of the following lenses to modify other fields as desired:
430+--
431+-- * 'rdeFirstValue'
432+--
433+-- * 'rdeRiceParameter'
434+--
435+-- * 'rdeNumEntries'
436+--
437+-- * 'rdeEncodedData'
438+riceDeltaEncoding
439+ :: RiceDeltaEncoding
440+riceDeltaEncoding =
441+ RiceDeltaEncoding'
442+ { _rdeFirstValue = Nothing
443+ , _rdeRiceParameter = Nothing
444+ , _rdeNumEntries = Nothing
445+ , _rdeEncodedData = Nothing
446+ }
447+
448+-- | The offset of the first entry in the encoded data, or, if only a single
449+-- integer was encoded, that single integer\'s value.
450+rdeFirstValue :: Lens' RiceDeltaEncoding (Maybe Int64)
451+rdeFirstValue
452+ = lens _rdeFirstValue
453+ (\ s a -> s{_rdeFirstValue = a})
454+ . mapping _Coerce
455+
456+-- | The Golomb-Rice parameter, which is a number between 2 and 28. This
457+-- field is missing (that is, zero) if \`num_entries\` is zero.
458+rdeRiceParameter :: Lens' RiceDeltaEncoding (Maybe Int32)
459+rdeRiceParameter
460+ = lens _rdeRiceParameter
461+ (\ s a -> s{_rdeRiceParameter = a})
462+ . mapping _Coerce
463+
464+-- | The number of entries that are delta encoded in the encoded data. If
465+-- only a single integer was encoded, this will be zero and the single
466+-- value will be stored in \`first_value\`.
467+rdeNumEntries :: Lens' RiceDeltaEncoding (Maybe Int32)
468+rdeNumEntries
469+ = lens _rdeNumEntries
470+ (\ s a -> s{_rdeNumEntries = a})
471+ . mapping _Coerce
472+
473+-- | The encoded deltas that are encoded using the Golomb-Rice coder.
474+rdeEncodedData :: Lens' RiceDeltaEncoding (Maybe ByteString)
475+rdeEncodedData
476+ = lens _rdeEncodedData
477+ (\ s a -> s{_rdeEncodedData = a})
478+ . mapping _Base64
479+
480+instance FromJSON RiceDeltaEncoding where
481+ parseJSON
482+ = withObject "RiceDeltaEncoding"
483+ (\ o ->
484+ RiceDeltaEncoding' <$>
485+ (o .:? "firstValue") <*> (o .:? "riceParameter") <*>
486+ (o .:? "numEntries")
487+ <*> (o .:? "encodedData"))
488+
489+instance ToJSON RiceDeltaEncoding where
490+ toJSON RiceDeltaEncoding'{..}
491+ = object
492+ (catMaybes
493+ [("firstValue" .=) <$> _rdeFirstValue,
494+ ("riceParameter" .=) <$> _rdeRiceParameter,
495+ ("numEntries" .=) <$> _rdeNumEntries,
496+ ("encodedData" .=) <$> _rdeEncodedData])
497+
498+--
499+-- /See:/ 'listThreatListsResponse' smart constructor.
500+newtype ListThreatListsResponse = ListThreatListsResponse'
501+ { _ltlrThreatLists :: Maybe [ThreatListDescriptor]
502+ } deriving (Eq,Show,Data,Typeable,Generic)
503+
504+-- | Creates a value of 'ListThreatListsResponse' with the minimum fields required to make a request.
505+--
506+-- Use one of the following lenses to modify other fields as desired:
507+--
508+-- * 'ltlrThreatLists'
509+listThreatListsResponse
510+ :: ListThreatListsResponse
511+listThreatListsResponse =
512+ ListThreatListsResponse'
513+ { _ltlrThreatLists = Nothing
514+ }
515+
516+-- | The lists available for download by the client.
517+ltlrThreatLists :: Lens' ListThreatListsResponse [ThreatListDescriptor]
518+ltlrThreatLists
519+ = lens _ltlrThreatLists
520+ (\ s a -> s{_ltlrThreatLists = a})
521+ . _Default
522+ . _Coerce
523+
524+instance FromJSON ListThreatListsResponse where
525+ parseJSON
526+ = withObject "ListThreatListsResponse"
527+ (\ o ->
528+ ListThreatListsResponse' <$>
529+ (o .:? "threatLists" .!= mempty))
530+
531+instance ToJSON ListThreatListsResponse where
532+ toJSON ListThreatListsResponse'{..}
533+ = object
534+ (catMaybes [("threatLists" .=) <$> _ltlrThreatLists])
535+
536+-- | Describes an individual threat list. A list is defined by three
537+-- parameters: the type of threat posed, the type of platform targeted by
538+-- the threat, and the type of entries in the list.
539+--
540+-- /See:/ 'threatListDescriptor' smart constructor.
541+data ThreatListDescriptor = ThreatListDescriptor'
542+ { _tldThreatEntryType :: !(Maybe Text)
543+ , _tldThreatType :: !(Maybe Text)
544+ , _tldPlatformType :: !(Maybe Text)
545+ } deriving (Eq,Show,Data,Typeable,Generic)
546+
547+-- | Creates a value of 'ThreatListDescriptor' with the minimum fields required to make a request.
548+--
549+-- Use one of the following lenses to modify other fields as desired:
550+--
551+-- * 'tldThreatEntryType'
552+--
553+-- * 'tldThreatType'
554+--
555+-- * 'tldPlatformType'
556+threatListDescriptor
557+ :: ThreatListDescriptor
558+threatListDescriptor =
559+ ThreatListDescriptor'
560+ { _tldThreatEntryType = Nothing
561+ , _tldThreatType = Nothing
562+ , _tldPlatformType = Nothing
563+ }
564+
565+-- | The entry types contained in the list.
566+tldThreatEntryType :: Lens' ThreatListDescriptor (Maybe Text)
567+tldThreatEntryType
568+ = lens _tldThreatEntryType
569+ (\ s a -> s{_tldThreatEntryType = a})
570+
571+-- | The threat type posed by the list\'s entries.
572+tldThreatType :: Lens' ThreatListDescriptor (Maybe Text)
573+tldThreatType
574+ = lens _tldThreatType
575+ (\ s a -> s{_tldThreatType = a})
576+
577+-- | The platform type targeted by the list\'s entries.
578+tldPlatformType :: Lens' ThreatListDescriptor (Maybe Text)
579+tldPlatformType
580+ = lens _tldPlatformType
581+ (\ s a -> s{_tldPlatformType = a})
582+
583+instance FromJSON ThreatListDescriptor where
584+ parseJSON
585+ = withObject "ThreatListDescriptor"
586+ (\ o ->
587+ ThreatListDescriptor' <$>
588+ (o .:? "threatEntryType") <*> (o .:? "threatType")
589+ <*> (o .:? "platformType"))
590+
591+instance ToJSON ThreatListDescriptor where
592+ toJSON ThreatListDescriptor'{..}
593+ = object
594+ (catMaybes
595+ [("threatEntryType" .=) <$> _tldThreatEntryType,
596+ ("threatType" .=) <$> _tldThreatType,
597+ ("platformType" .=) <$> _tldPlatformType])
598+
599+-- | The client metadata associated with Safe Browsing API requests.
600+--
601+-- /See:/ 'clientInfo' smart constructor.
602+data ClientInfo = ClientInfo'
603+ { _ciClientId :: !(Maybe Text)
604+ , _ciClientVersion :: !(Maybe Text)
605+ } deriving (Eq,Show,Data,Typeable,Generic)
606+
607+-- | Creates a value of 'ClientInfo' with the minimum fields required to make a request.
608+--
609+-- Use one of the following lenses to modify other fields as desired:
610+--
611+-- * 'ciClientId'
612+--
613+-- * 'ciClientVersion'
614+clientInfo
615+ :: ClientInfo
616+clientInfo =
617+ ClientInfo'
618+ { _ciClientId = Nothing
619+ , _ciClientVersion = Nothing
620+ }
621+
622+-- | A client ID that (hopefully) uniquely identifies the client
623+-- implementation of the Safe Browsing API.
624+ciClientId :: Lens' ClientInfo (Maybe Text)
625+ciClientId
626+ = lens _ciClientId (\ s a -> s{_ciClientId = a})
627+
628+-- | The version of the client implementation.
629+ciClientVersion :: Lens' ClientInfo (Maybe Text)
630+ciClientVersion
631+ = lens _ciClientVersion
632+ (\ s a -> s{_ciClientVersion = a})
633+
634+instance FromJSON ClientInfo where
635+ parseJSON
636+ = withObject "ClientInfo"
637+ (\ o ->
638+ ClientInfo' <$>
639+ (o .:? "clientId") <*> (o .:? "clientVersion"))
640+
641+instance ToJSON ClientInfo where
642+ toJSON ClientInfo'{..}
643+ = object
644+ (catMaybes
645+ [("clientId" .=) <$> _ciClientId,
646+ ("clientVersion" .=) <$> _ciClientVersion])
647+
648+-- | Request to check entries against lists.
649+--
650+-- /See:/ 'findThreatMatchesRequest' smart constructor.
651+data FindThreatMatchesRequest = FindThreatMatchesRequest'
652+ { _ftmrThreatInfo :: !(Maybe ThreatInfo)
653+ , _ftmrClient :: !(Maybe ClientInfo)
654+ } deriving (Eq,Show,Data,Typeable,Generic)
655+
656+-- | Creates a value of 'FindThreatMatchesRequest' with the minimum fields required to make a request.
657+--
658+-- Use one of the following lenses to modify other fields as desired:
659+--
660+-- * 'ftmrThreatInfo'
661+--
662+-- * 'ftmrClient'
663+findThreatMatchesRequest
664+ :: FindThreatMatchesRequest
665+findThreatMatchesRequest =
666+ FindThreatMatchesRequest'
667+ { _ftmrThreatInfo = Nothing
668+ , _ftmrClient = Nothing
669+ }
670+
671+-- | The lists and entries to be checked for matches.
672+ftmrThreatInfo :: Lens' FindThreatMatchesRequest (Maybe ThreatInfo)
673+ftmrThreatInfo
674+ = lens _ftmrThreatInfo
675+ (\ s a -> s{_ftmrThreatInfo = a})
676+
677+-- | The client metadata.
678+ftmrClient :: Lens' FindThreatMatchesRequest (Maybe ClientInfo)
679+ftmrClient
680+ = lens _ftmrClient (\ s a -> s{_ftmrClient = a})
681+
682+instance FromJSON FindThreatMatchesRequest where
683+ parseJSON
684+ = withObject "FindThreatMatchesRequest"
685+ (\ o ->
686+ FindThreatMatchesRequest' <$>
687+ (o .:? "threatInfo") <*> (o .:? "client"))
688+
689+instance ToJSON FindThreatMatchesRequest where
690+ toJSON FindThreatMatchesRequest'{..}
691+ = object
692+ (catMaybes
693+ [("threatInfo" .=) <$> _ftmrThreatInfo,
694+ ("client" .=) <$> _ftmrClient])
695+
696+-- | A single list update request.
697+--
698+-- /See:/ 'listUpdateRequest' smart constructor.
699+data ListUpdateRequest = ListUpdateRequest'
700+ { _lurState :: !(Maybe Base64)
701+ , _lurThreatEntryType :: !(Maybe Text)
702+ , _lurConstraints :: !(Maybe Constraints)
703+ , _lurThreatType :: !(Maybe Text)
704+ , _lurPlatformType :: !(Maybe Text)
705+ } deriving (Eq,Show,Data,Typeable,Generic)
706+
707+-- | Creates a value of 'ListUpdateRequest' with the minimum fields required to make a request.
708+--
709+-- Use one of the following lenses to modify other fields as desired:
710+--
711+-- * 'lurState'
712+--
713+-- * 'lurThreatEntryType'
714+--
715+-- * 'lurConstraints'
716+--
717+-- * 'lurThreatType'
718+--
719+-- * 'lurPlatformType'
720+listUpdateRequest
721+ :: ListUpdateRequest
722+listUpdateRequest =
723+ ListUpdateRequest'
724+ { _lurState = Nothing
725+ , _lurThreatEntryType = Nothing
726+ , _lurConstraints = Nothing
727+ , _lurThreatType = Nothing
728+ , _lurPlatformType = Nothing
729+ }
730+
731+-- | The current state of the client for the requested list (the encrypted
732+-- client state that was received from the last successful list update).
733+lurState :: Lens' ListUpdateRequest (Maybe ByteString)
734+lurState
735+ = lens _lurState (\ s a -> s{_lurState = a}) .
736+ mapping _Base64
737+
738+-- | The types of entries present in the list.
739+lurThreatEntryType :: Lens' ListUpdateRequest (Maybe Text)
740+lurThreatEntryType
741+ = lens _lurThreatEntryType
742+ (\ s a -> s{_lurThreatEntryType = a})
743+
744+-- | The constraints associated with this request.
745+lurConstraints :: Lens' ListUpdateRequest (Maybe Constraints)
746+lurConstraints
747+ = lens _lurConstraints
748+ (\ s a -> s{_lurConstraints = a})
749+
750+-- | The type of threat posed by entries present in the list.
751+lurThreatType :: Lens' ListUpdateRequest (Maybe Text)
752+lurThreatType
753+ = lens _lurThreatType
754+ (\ s a -> s{_lurThreatType = a})
755+
756+-- | The type of platform at risk by entries present in the list.
757+lurPlatformType :: Lens' ListUpdateRequest (Maybe Text)
758+lurPlatformType
759+ = lens _lurPlatformType
760+ (\ s a -> s{_lurPlatformType = a})
761+
762+instance FromJSON ListUpdateRequest where
763+ parseJSON
764+ = withObject "ListUpdateRequest"
765+ (\ o ->
766+ ListUpdateRequest' <$>
767+ (o .:? "state") <*> (o .:? "threatEntryType") <*>
768+ (o .:? "constraints")
769+ <*> (o .:? "threatType")
770+ <*> (o .:? "platformType"))
771+
772+instance ToJSON ListUpdateRequest where
773+ toJSON ListUpdateRequest'{..}
774+ = object
775+ (catMaybes
776+ [("state" .=) <$> _lurState,
777+ ("threatEntryType" .=) <$> _lurThreatEntryType,
778+ ("constraints" .=) <$> _lurConstraints,
779+ ("threatType" .=) <$> _lurThreatType,
780+ ("platformType" .=) <$> _lurPlatformType])
781+
782+-- | An individual threat; for example, a malicious URL or its hash
783+-- representation. Only one of these fields should be set.
784+--
785+-- /See:/ 'threatEntry' smart constructor.
786+data ThreatEntry = ThreatEntry'
787+ { _teHash :: !(Maybe Base64)
788+ , _teURL :: !(Maybe Text)
789+ , _teDigest :: !(Maybe Base64)
790+ } deriving (Eq,Show,Data,Typeable,Generic)
791+
792+-- | Creates a value of 'ThreatEntry' with the minimum fields required to make a request.
793+--
794+-- Use one of the following lenses to modify other fields as desired:
795+--
796+-- * 'teHash'
797+--
798+-- * 'teURL'
799+--
800+-- * 'teDigest'
801+threatEntry
802+ :: ThreatEntry
803+threatEntry =
804+ ThreatEntry'
805+ { _teHash = Nothing
806+ , _teURL = Nothing
807+ , _teDigest = Nothing
808+ }
809+
810+-- | A hash prefix, consisting of the most significant 4-32 bytes of a SHA256
811+-- hash. This field is in binary format.
812+teHash :: Lens' ThreatEntry (Maybe ByteString)
813+teHash
814+ = lens _teHash (\ s a -> s{_teHash = a}) .
815+ mapping _Base64
816+
817+-- | A URL.
818+teURL :: Lens' ThreatEntry (Maybe Text)
819+teURL = lens _teURL (\ s a -> s{_teURL = a})
820+
821+-- | The digest of an executable in SHA256 format. The API supports both
822+-- binary and hex digests.
823+teDigest :: Lens' ThreatEntry (Maybe ByteString)
824+teDigest
825+ = lens _teDigest (\ s a -> s{_teDigest = a}) .
826+ mapping _Base64
827+
828+instance FromJSON ThreatEntry where
829+ parseJSON
830+ = withObject "ThreatEntry"
831+ (\ o ->
832+ ThreatEntry' <$>
833+ (o .:? "hash") <*> (o .:? "url") <*>
834+ (o .:? "digest"))
835+
836+instance ToJSON ThreatEntry where
837+ toJSON ThreatEntry'{..}
838+ = object
839+ (catMaybes
840+ [("hash" .=) <$> _teHash, ("url" .=) <$> _teURL,
841+ ("digest" .=) <$> _teDigest])
842+
843+-- | A match when checking a threat entry in the Safe Browsing threat lists.
844+--
845+-- /See:/ 'threatMatch' smart constructor.
846+data ThreatMatch = ThreatMatch'
847+ { _tmThreatEntryMetadata :: !(Maybe ThreatEntryMetadata)
848+ , _tmThreatEntryType :: !(Maybe Text)
849+ , _tmThreatType :: !(Maybe Text)
850+ , _tmPlatformType :: !(Maybe Text)
851+ , _tmCacheDuration :: !(Maybe Text)
852+ , _tmThreat :: !(Maybe ThreatEntry)
853+ } deriving (Eq,Show,Data,Typeable,Generic)
854+
855+-- | Creates a value of 'ThreatMatch' with the minimum fields required to make a request.
856+--
857+-- Use one of the following lenses to modify other fields as desired:
858+--
859+-- * 'tmThreatEntryMetadata'
860+--
861+-- * 'tmThreatEntryType'
862+--
863+-- * 'tmThreatType'
864+--
865+-- * 'tmPlatformType'
866+--
867+-- * 'tmCacheDuration'
868+--
869+-- * 'tmThreat'
870+threatMatch
871+ :: ThreatMatch
872+threatMatch =
873+ ThreatMatch'
874+ { _tmThreatEntryMetadata = Nothing
875+ , _tmThreatEntryType = Nothing
876+ , _tmThreatType = Nothing
877+ , _tmPlatformType = Nothing
878+ , _tmCacheDuration = Nothing
879+ , _tmThreat = Nothing
880+ }
881+
882+-- | Optional metadata associated with this threat.
883+tmThreatEntryMetadata :: Lens' ThreatMatch (Maybe ThreatEntryMetadata)
884+tmThreatEntryMetadata
885+ = lens _tmThreatEntryMetadata
886+ (\ s a -> s{_tmThreatEntryMetadata = a})
887+
888+-- | The threat entry type matching this threat.
889+tmThreatEntryType :: Lens' ThreatMatch (Maybe Text)
890+tmThreatEntryType
891+ = lens _tmThreatEntryType
892+ (\ s a -> s{_tmThreatEntryType = a})
893+
894+-- | The threat type matching this threat.
895+tmThreatType :: Lens' ThreatMatch (Maybe Text)
896+tmThreatType
897+ = lens _tmThreatType (\ s a -> s{_tmThreatType = a})
898+
899+-- | The platform type matching this threat.
900+tmPlatformType :: Lens' ThreatMatch (Maybe Text)
901+tmPlatformType
902+ = lens _tmPlatformType
903+ (\ s a -> s{_tmPlatformType = a})
904+
905+-- | The cache lifetime for the returned match. Clients must not cache this
906+-- response for more than this duration to avoid false positives.
907+tmCacheDuration :: Lens' ThreatMatch (Maybe Text)
908+tmCacheDuration
909+ = lens _tmCacheDuration
910+ (\ s a -> s{_tmCacheDuration = a})
911+
912+-- | The threat matching this threat.
913+tmThreat :: Lens' ThreatMatch (Maybe ThreatEntry)
914+tmThreat = lens _tmThreat (\ s a -> s{_tmThreat = a})
915+
916+instance FromJSON ThreatMatch where
917+ parseJSON
918+ = withObject "ThreatMatch"
919+ (\ o ->
920+ ThreatMatch' <$>
921+ (o .:? "threatEntryMetadata") <*>
922+ (o .:? "threatEntryType")
923+ <*> (o .:? "threatType")
924+ <*> (o .:? "platformType")
925+ <*> (o .:? "cacheDuration")
926+ <*> (o .:? "threat"))
927+
928+instance ToJSON ThreatMatch where
929+ toJSON ThreatMatch'{..}
930+ = object
931+ (catMaybes
932+ [("threatEntryMetadata" .=) <$>
933+ _tmThreatEntryMetadata,
934+ ("threatEntryType" .=) <$> _tmThreatEntryType,
935+ ("threatType" .=) <$> _tmThreatType,
936+ ("platformType" .=) <$> _tmPlatformType,
937+ ("cacheDuration" .=) <$> _tmCacheDuration,
938+ ("threat" .=) <$> _tmThreat])
939+
940+-- | The uncompressed threat entries in hash format of a particular prefix
941+-- length. Hashes can be anywhere from 4 to 32 bytes in size. A large
942+-- majority are 4 bytes, but some hashes are lengthened if they collide
943+-- with the hash of a popular URL. Used for sending ThreatEntrySet to
944+-- clients that do not support compression, or when sending non-4-byte
945+-- hashes to clients that do support compression.
946+--
947+-- /See:/ 'rawHashes' smart constructor.
948+data RawHashes = RawHashes'
949+ { _rhPrefixSize :: !(Maybe (Textual Int32))
950+ , _rhRawHashes :: !(Maybe Base64)
951+ } deriving (Eq,Show,Data,Typeable,Generic)
952+
953+-- | Creates a value of 'RawHashes' with the minimum fields required to make a request.
954+--
955+-- Use one of the following lenses to modify other fields as desired:
956+--
957+-- * 'rhPrefixSize'
958+--
959+-- * 'rhRawHashes'
960+rawHashes
961+ :: RawHashes
962+rawHashes =
963+ RawHashes'
964+ { _rhPrefixSize = Nothing
965+ , _rhRawHashes = Nothing
966+ }
967+
968+-- | The number of bytes for each prefix encoded below. This field can be
969+-- anywhere from 4 (shortest prefix) to 32 (full SHA256 hash).
970+rhPrefixSize :: Lens' RawHashes (Maybe Int32)
971+rhPrefixSize
972+ = lens _rhPrefixSize (\ s a -> s{_rhPrefixSize = a})
973+ . mapping _Coerce
974+
975+-- | The hashes, all concatenated into one long string. Each hash has a
976+-- prefix size of |prefix_size| above. Hashes are sorted in lexicographic
977+-- order.
978+rhRawHashes :: Lens' RawHashes (Maybe ByteString)
979+rhRawHashes
980+ = lens _rhRawHashes (\ s a -> s{_rhRawHashes = a}) .
981+ mapping _Base64
982+
983+instance FromJSON RawHashes where
984+ parseJSON
985+ = withObject "RawHashes"
986+ (\ o ->
987+ RawHashes' <$>
988+ (o .:? "prefixSize") <*> (o .:? "rawHashes"))
989+
990+instance ToJSON RawHashes where
991+ toJSON RawHashes'{..}
992+ = object
993+ (catMaybes
994+ [("prefixSize" .=) <$> _rhPrefixSize,
995+ ("rawHashes" .=) <$> _rhRawHashes])
996+
997+-- | An update to an individual list.
998+--
999+-- /See:/ 'listUpdateResponse' smart constructor.
1000+data ListUpdateResponse = ListUpdateResponse'
1001+ { _lAdditions :: !(Maybe [ThreatEntrySet])
1002+ , _lThreatEntryType :: !(Maybe Text)
1003+ , _lChecksum :: !(Maybe Checksum)
1004+ , _lThreatType :: !(Maybe Text)
1005+ , _lPlatformType :: !(Maybe Text)
1006+ , _lNewClientState :: !(Maybe Base64)
1007+ , _lRemovals :: !(Maybe [ThreatEntrySet])
1008+ , _lResponseType :: !(Maybe Text)
1009+ } deriving (Eq,Show,Data,Typeable,Generic)
1010+
1011+-- | Creates a value of 'ListUpdateResponse' with the minimum fields required to make a request.
1012+--
1013+-- Use one of the following lenses to modify other fields as desired:
1014+--
1015+-- * 'lAdditions'
1016+--
1017+-- * 'lThreatEntryType'
1018+--
1019+-- * 'lChecksum'
1020+--
1021+-- * 'lThreatType'
1022+--
1023+-- * 'lPlatformType'
1024+--
1025+-- * 'lNewClientState'
1026+--
1027+-- * 'lRemovals'
1028+--
1029+-- * 'lResponseType'
1030+listUpdateResponse
1031+ :: ListUpdateResponse
1032+listUpdateResponse =
1033+ ListUpdateResponse'
1034+ { _lAdditions = Nothing
1035+ , _lThreatEntryType = Nothing
1036+ , _lChecksum = Nothing
1037+ , _lThreatType = Nothing
1038+ , _lPlatformType = Nothing
1039+ , _lNewClientState = Nothing
1040+ , _lRemovals = Nothing
1041+ , _lResponseType = Nothing
1042+ }
1043+
1044+-- | A set of entries to add to a local threat type\'s list. Repeated to
1045+-- allow for a combination of compressed and raw data to be sent in a
1046+-- single response.
1047+lAdditions :: Lens' ListUpdateResponse [ThreatEntrySet]
1048+lAdditions
1049+ = lens _lAdditions (\ s a -> s{_lAdditions = a}) .
1050+ _Default
1051+ . _Coerce
1052+
1053+-- | The format of the threats.
1054+lThreatEntryType :: Lens' ListUpdateResponse (Maybe Text)
1055+lThreatEntryType
1056+ = lens _lThreatEntryType
1057+ (\ s a -> s{_lThreatEntryType = a})
1058+
1059+-- | The expected SHA256 hash of the client state; that is, of the sorted
1060+-- list of all hashes present in the database after applying the provided
1061+-- update. If the client state doesn\'t match the expected state, the
1062+-- client must disregard this update and retry later.
1063+lChecksum :: Lens' ListUpdateResponse (Maybe Checksum)
1064+lChecksum
1065+ = lens _lChecksum (\ s a -> s{_lChecksum = a})
1066+
1067+-- | The threat type for which data is returned.
1068+lThreatType :: Lens' ListUpdateResponse (Maybe Text)
1069+lThreatType
1070+ = lens _lThreatType (\ s a -> s{_lThreatType = a})
1071+
1072+-- | The platform type for which data is returned.
1073+lPlatformType :: Lens' ListUpdateResponse (Maybe Text)
1074+lPlatformType
1075+ = lens _lPlatformType
1076+ (\ s a -> s{_lPlatformType = a})
1077+
1078+-- | The new client state, in encrypted format. Opaque to clients.
1079+lNewClientState :: Lens' ListUpdateResponse (Maybe ByteString)
1080+lNewClientState
1081+ = lens _lNewClientState
1082+ (\ s a -> s{_lNewClientState = a})
1083+ . mapping _Base64
1084+
1085+-- | A set of entries to remove from a local threat type\'s list. Repeated
1086+-- for the same reason as above.
1087+lRemovals :: Lens' ListUpdateResponse [ThreatEntrySet]
1088+lRemovals
1089+ = lens _lRemovals (\ s a -> s{_lRemovals = a}) .
1090+ _Default
1091+ . _Coerce
1092+
1093+-- | The type of response. This may indicate that an action is required by
1094+-- the client when the response is received.
1095+lResponseType :: Lens' ListUpdateResponse (Maybe Text)
1096+lResponseType
1097+ = lens _lResponseType
1098+ (\ s a -> s{_lResponseType = a})
1099+
1100+instance FromJSON ListUpdateResponse where
1101+ parseJSON
1102+ = withObject "ListUpdateResponse"
1103+ (\ o ->
1104+ ListUpdateResponse' <$>
1105+ (o .:? "additions" .!= mempty) <*>
1106+ (o .:? "threatEntryType")
1107+ <*> (o .:? "checksum")
1108+ <*> (o .:? "threatType")
1109+ <*> (o .:? "platformType")
1110+ <*> (o .:? "newClientState")
1111+ <*> (o .:? "removals" .!= mempty)
1112+ <*> (o .:? "responseType"))
1113+
1114+instance ToJSON ListUpdateResponse where
1115+ toJSON ListUpdateResponse'{..}
1116+ = object
1117+ (catMaybes
1118+ [("additions" .=) <$> _lAdditions,
1119+ ("threatEntryType" .=) <$> _lThreatEntryType,
1120+ ("checksum" .=) <$> _lChecksum,
1121+ ("threatType" .=) <$> _lThreatType,
1122+ ("platformType" .=) <$> _lPlatformType,
1123+ ("newClientState" .=) <$> _lNewClientState,
1124+ ("removals" .=) <$> _lRemovals,
1125+ ("responseType" .=) <$> _lResponseType])
1126+
1127+-- | A set of threats that should be added or removed from a client\'s local
1128+-- database.
1129+--
1130+-- /See:/ 'threatEntrySet' smart constructor.
1131+data ThreatEntrySet = ThreatEntrySet'
1132+ { _tesRiceHashes :: !(Maybe RiceDeltaEncoding)
1133+ , _tesRiceIndices :: !(Maybe RiceDeltaEncoding)
1134+ , _tesRawHashes :: !(Maybe RawHashes)
1135+ , _tesRawIndices :: !(Maybe RawIndices)
1136+ , _tesCompressionType :: !(Maybe Text)
1137+ } deriving (Eq,Show,Data,Typeable,Generic)
1138+
1139+-- | Creates a value of 'ThreatEntrySet' with the minimum fields required to make a request.
1140+--
1141+-- Use one of the following lenses to modify other fields as desired:
1142+--
1143+-- * 'tesRiceHashes'
1144+--
1145+-- * 'tesRiceIndices'
1146+--
1147+-- * 'tesRawHashes'
1148+--
1149+-- * 'tesRawIndices'
1150+--
1151+-- * 'tesCompressionType'
1152+threatEntrySet
1153+ :: ThreatEntrySet
1154+threatEntrySet =
1155+ ThreatEntrySet'
1156+ { _tesRiceHashes = Nothing
1157+ , _tesRiceIndices = Nothing
1158+ , _tesRawHashes = Nothing
1159+ , _tesRawIndices = Nothing
1160+ , _tesCompressionType = Nothing
1161+ }
1162+
1163+-- | The encoded 4-byte prefixes of SHA256-formatted entries, using a
1164+-- Golomb-Rice encoding.
1165+tesRiceHashes :: Lens' ThreatEntrySet (Maybe RiceDeltaEncoding)
1166+tesRiceHashes
1167+ = lens _tesRiceHashes
1168+ (\ s a -> s{_tesRiceHashes = a})
1169+
1170+-- | The encoded local, lexicographically-sorted list indices, using a
1171+-- Golomb-Rice encoding. Used for sending compressed removal indices.
1172+tesRiceIndices :: Lens' ThreatEntrySet (Maybe RiceDeltaEncoding)
1173+tesRiceIndices
1174+ = lens _tesRiceIndices
1175+ (\ s a -> s{_tesRiceIndices = a})
1176+
1177+-- | The raw SHA256-formatted entries.
1178+tesRawHashes :: Lens' ThreatEntrySet (Maybe RawHashes)
1179+tesRawHashes
1180+ = lens _tesRawHashes (\ s a -> s{_tesRawHashes = a})
1181+
1182+-- | The raw removal indices for a local list.
1183+tesRawIndices :: Lens' ThreatEntrySet (Maybe RawIndices)
1184+tesRawIndices
1185+ = lens _tesRawIndices
1186+ (\ s a -> s{_tesRawIndices = a})
1187+
1188+-- | The compression type for the entries in this set.
1189+tesCompressionType :: Lens' ThreatEntrySet (Maybe Text)
1190+tesCompressionType
1191+ = lens _tesCompressionType
1192+ (\ s a -> s{_tesCompressionType = a})
1193+
1194+instance FromJSON ThreatEntrySet where
1195+ parseJSON
1196+ = withObject "ThreatEntrySet"
1197+ (\ o ->
1198+ ThreatEntrySet' <$>
1199+ (o .:? "riceHashes") <*> (o .:? "riceIndices") <*>
1200+ (o .:? "rawHashes")
1201+ <*> (o .:? "rawIndices")
1202+ <*> (o .:? "compressionType"))
1203+
1204+instance ToJSON ThreatEntrySet where
1205+ toJSON ThreatEntrySet'{..}
1206+ = object
1207+ (catMaybes
1208+ [("riceHashes" .=) <$> _tesRiceHashes,
1209+ ("riceIndices" .=) <$> _tesRiceIndices,
1210+ ("rawHashes" .=) <$> _tesRawHashes,
1211+ ("rawIndices" .=) <$> _tesRawIndices,
1212+ ("compressionType" .=) <$> _tesCompressionType])
1213+
1214+-- | A set of raw indices to remove from a local list.
1215+--
1216+-- /See:/ 'rawIndices' smart constructor.
1217+newtype RawIndices = RawIndices'
1218+ { _riIndices :: Maybe [Textual Int32]
1219+ } deriving (Eq,Show,Data,Typeable,Generic)
1220+
1221+-- | Creates a value of 'RawIndices' with the minimum fields required to make a request.
1222+--
1223+-- Use one of the following lenses to modify other fields as desired:
1224+--
1225+-- * 'riIndices'
1226+rawIndices
1227+ :: RawIndices
1228+rawIndices =
1229+ RawIndices'
1230+ { _riIndices = Nothing
1231+ }
1232+
1233+-- | The indices to remove from a lexicographically-sorted local list.
1234+riIndices :: Lens' RawIndices [Int32]
1235+riIndices
1236+ = lens _riIndices (\ s a -> s{_riIndices = a}) .
1237+ _Default
1238+ . _Coerce
1239+
1240+instance FromJSON RawIndices where
1241+ parseJSON
1242+ = withObject "RawIndices"
1243+ (\ o -> RawIndices' <$> (o .:? "indices" .!= mempty))
1244+
1245+instance ToJSON RawIndices where
1246+ toJSON RawIndices'{..}
1247+ = object (catMaybes [("indices" .=) <$> _riIndices])
1248+
1249+--
1250+-- /See:/ 'findFullHashesResponse' smart constructor.
1251+data FindFullHashesResponse = FindFullHashesResponse'
1252+ { _ffhrMatches :: !(Maybe [ThreatMatch])
1253+ , _ffhrNegativeCacheDuration :: !(Maybe Text)
1254+ , _ffhrMinimumWaitDuration :: !(Maybe Text)
1255+ } deriving (Eq,Show,Data,Typeable,Generic)
1256+
1257+-- | Creates a value of 'FindFullHashesResponse' with the minimum fields required to make a request.
1258+--
1259+-- Use one of the following lenses to modify other fields as desired:
1260+--
1261+-- * 'ffhrMatches'
1262+--
1263+-- * 'ffhrNegativeCacheDuration'
1264+--
1265+-- * 'ffhrMinimumWaitDuration'
1266+findFullHashesResponse
1267+ :: FindFullHashesResponse
1268+findFullHashesResponse =
1269+ FindFullHashesResponse'
1270+ { _ffhrMatches = Nothing
1271+ , _ffhrNegativeCacheDuration = Nothing
1272+ , _ffhrMinimumWaitDuration = Nothing
1273+ }
1274+
1275+-- | The full hashes that matched the requested prefixes.
1276+ffhrMatches :: Lens' FindFullHashesResponse [ThreatMatch]
1277+ffhrMatches
1278+ = lens _ffhrMatches (\ s a -> s{_ffhrMatches = a}) .
1279+ _Default
1280+ . _Coerce
1281+
1282+-- | For requested entities that did not match the threat list, how long to
1283+-- cache the response.
1284+ffhrNegativeCacheDuration :: Lens' FindFullHashesResponse (Maybe Text)
1285+ffhrNegativeCacheDuration
1286+ = lens _ffhrNegativeCacheDuration
1287+ (\ s a -> s{_ffhrNegativeCacheDuration = a})
1288+
1289+-- | The minimum duration the client must wait before issuing any find hashes
1290+-- request. If this field is not set, clients can issue a request as soon
1291+-- as they want.
1292+ffhrMinimumWaitDuration :: Lens' FindFullHashesResponse (Maybe Text)
1293+ffhrMinimumWaitDuration
1294+ = lens _ffhrMinimumWaitDuration
1295+ (\ s a -> s{_ffhrMinimumWaitDuration = a})
1296+
1297+instance FromJSON FindFullHashesResponse where
1298+ parseJSON
1299+ = withObject "FindFullHashesResponse"
1300+ (\ o ->
1301+ FindFullHashesResponse' <$>
1302+ (o .:? "matches" .!= mempty) <*>
1303+ (o .:? "negativeCacheDuration")
1304+ <*> (o .:? "minimumWaitDuration"))
1305+
1306+instance ToJSON FindFullHashesResponse where
1307+ toJSON FindFullHashesResponse'{..}
1308+ = object
1309+ (catMaybes
1310+ [("matches" .=) <$> _ffhrMatches,
1311+ ("negativeCacheDuration" .=) <$>
1312+ _ffhrNegativeCacheDuration,
1313+ ("minimumWaitDuration" .=) <$>
1314+ _ffhrMinimumWaitDuration])
1315+
1316+-- | A single metadata entry.
1317+--
1318+-- /See:/ 'metadataEntry' smart constructor.
1319+data MetadataEntry = MetadataEntry'
1320+ { _meValue :: !(Maybe Base64)
1321+ , _meKey :: !(Maybe Base64)
1322+ } deriving (Eq,Show,Data,Typeable,Generic)
1323+
1324+-- | Creates a value of 'MetadataEntry' with the minimum fields required to make a request.
1325+--
1326+-- Use one of the following lenses to modify other fields as desired:
1327+--
1328+-- * 'meValue'
1329+--
1330+-- * 'meKey'
1331+metadataEntry
1332+ :: MetadataEntry
1333+metadataEntry =
1334+ MetadataEntry'
1335+ { _meValue = Nothing
1336+ , _meKey = Nothing
1337+ }
1338+
1339+-- | The metadata entry value.
1340+meValue :: Lens' MetadataEntry (Maybe ByteString)
1341+meValue
1342+ = lens _meValue (\ s a -> s{_meValue = a}) .
1343+ mapping _Base64
1344+
1345+-- | The metadata entry key.
1346+meKey :: Lens' MetadataEntry (Maybe ByteString)
1347+meKey
1348+ = lens _meKey (\ s a -> s{_meKey = a}) .
1349+ mapping _Base64
1350+
1351+instance FromJSON MetadataEntry where
1352+ parseJSON
1353+ = withObject "MetadataEntry"
1354+ (\ o ->
1355+ MetadataEntry' <$> (o .:? "value") <*> (o .:? "key"))
1356+
1357+instance ToJSON MetadataEntry where
1358+ toJSON MetadataEntry'{..}
1359+ = object
1360+ (catMaybes
1361+ [("value" .=) <$> _meValue, ("key" .=) <$> _meKey])
1362+
1363+--
1364+-- /See:/ 'fetchThreatListUpdatesResponse' smart constructor.
1365+data FetchThreatListUpdatesResponse = FetchThreatListUpdatesResponse'
1366+ { _ftlurListUpdateResponses :: !(Maybe [ListUpdateResponse])
1367+ , _ftlurMinimumWaitDuration :: !(Maybe Text)
1368+ } deriving (Eq,Show,Data,Typeable,Generic)
1369+
1370+-- | Creates a value of 'FetchThreatListUpdatesResponse' with the minimum fields required to make a request.
1371+--
1372+-- Use one of the following lenses to modify other fields as desired:
1373+--
1374+-- * 'ftlurListUpdateResponses'
1375+--
1376+-- * 'ftlurMinimumWaitDuration'
1377+fetchThreatListUpdatesResponse
1378+ :: FetchThreatListUpdatesResponse
1379+fetchThreatListUpdatesResponse =
1380+ FetchThreatListUpdatesResponse'
1381+ { _ftlurListUpdateResponses = Nothing
1382+ , _ftlurMinimumWaitDuration = Nothing
1383+ }
1384+
1385+-- | The list updates requested by the clients.
1386+ftlurListUpdateResponses :: Lens' FetchThreatListUpdatesResponse [ListUpdateResponse]
1387+ftlurListUpdateResponses
1388+ = lens _ftlurListUpdateResponses
1389+ (\ s a -> s{_ftlurListUpdateResponses = a})
1390+ . _Default
1391+ . _Coerce
1392+
1393+-- | The minimum duration the client must wait before issuing any update
1394+-- request. If this field is not set clients may update as soon as they
1395+-- want.
1396+ftlurMinimumWaitDuration :: Lens' FetchThreatListUpdatesResponse (Maybe Text)
1397+ftlurMinimumWaitDuration
1398+ = lens _ftlurMinimumWaitDuration
1399+ (\ s a -> s{_ftlurMinimumWaitDuration = a})
1400+
1401+instance FromJSON FetchThreatListUpdatesResponse
1402+ where
1403+ parseJSON
1404+ = withObject "FetchThreatListUpdatesResponse"
1405+ (\ o ->
1406+ FetchThreatListUpdatesResponse' <$>
1407+ (o .:? "listUpdateResponses" .!= mempty) <*>
1408+ (o .:? "minimumWaitDuration"))
1409+
1410+instance ToJSON FetchThreatListUpdatesResponse where
1411+ toJSON FetchThreatListUpdatesResponse'{..}
1412+ = object
1413+ (catMaybes
1414+ [("listUpdateResponses" .=) <$>
1415+ _ftlurListUpdateResponses,
1416+ ("minimumWaitDuration" .=) <$>
1417+ _ftlurMinimumWaitDuration])
gogol-safebrowsing/gen/Network/Google/SafeBrowsing/Types/Sum.hsnew file+19
@@ -0,0 +1,19 @@
1+{-# LANGUAGE DeriveDataTypeable #-}
2+{-# LANGUAGE DeriveGeneric #-}
3+{-# LANGUAGE LambdaCase #-}
4+{-# LANGUAGE NoImplicitPrelude #-}
5+{-# LANGUAGE OverloadedStrings #-}
6+
7+{-# OPTIONS_GHC -fno-warn-unused-imports #-}
8+
9+-- |
10+-- Module : Network.Google.SafeBrowsing.Types.Sum
11+-- Copyright : (c) 2015-2016 Brendan Hay
12+-- License : Mozilla Public License, v. 2.0.
13+-- Maintainer : Brendan Hay <brendan.g.hay@gmail.com>
14+-- Stability : auto-generated
15+-- Portability : non-portable (GHC extensions)
16+--
17+module Network.Google.SafeBrowsing.Types.Sum where
18+
19+import Network.Google.Prelude
gogol-safebrowsing/gogol-safebrowsing.cabalnew file+50
@@ -0,0 +1,50 @@
1+name: gogol-safebrowsing
2+version: 0.1.0
3+synopsis: Google Safe Browsing APIs SDK.
4+homepage: https://github.com/brendanhay/gogol
5+bug-reports: https://github.com/brendanhay/gogol/issues
6+license: OtherLicense
7+license-file: LICENSE
8+author: Brendan Hay
9+maintainer: Brendan Hay <brendan.g.hay@gmail.com>
10+copyright: Copyright (c) 2015-2016 Brendan Hay
11+category: Network, Google, Cloud
12+build-type: Simple
13+cabal-version: >= 1.10
14+extra-source-files: README.md
15+
16+description:
17+ Enables client applications to check web resources (most commonly URLs)
18+ against Google-generated lists of unsafe web resources.
19+ .
20+ /Warning:/ This is an experimental prototype/preview release which is still
21+ under exploratory development and not intended for public use, caveat emptor!
22+ .
23+ This library is compatible with version @v4@
24+ of the API.
25+
26+source-repository head
27+ type: git
28+ location: git://github.com/brendanhay/gogol.git
29+
30+library
31+ default-language: Haskell2010
32+ hs-source-dirs: src gen
33+
34+ ghc-options: -Wall
35+
36+ exposed-modules:
37+ Network.Google.Resource.SafeBrowsing.FullHashes.Find
38+ , Network.Google.Resource.SafeBrowsing.ThreatListUpdates.Fetch
39+ , Network.Google.Resource.SafeBrowsing.ThreatLists.List
40+ , Network.Google.Resource.SafeBrowsing.ThreatMatches.Find
41+ , Network.Google.SafeBrowsing
42+ , Network.Google.SafeBrowsing.Types
43+
44+ other-modules:
45+ Network.Google.SafeBrowsing.Types.Product
46+ , Network.Google.SafeBrowsing.Types.Sum
47+
48+ build-depends:
49+ gogol-core == 0.1.0.*
50+ , base >= 4.7 && < 5
gogol-safebrowsing/src/.gitkeepnew file

No changes to the content.