@@ -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])