@@ -0,0 +1,1696 @@
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.Vision.Types.Product
12+-- Copyright : (c) 2015 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.Vision.Types.Product where
19+
20+import Network.Google.Prelude
21+import Network.Google.Vision.Types.Sum
22+
23+-- | An object representing a latitude\/longitude pair. This is expressed as
24+-- a pair of doubles representing degrees latitude and degrees longitude.
25+-- Unless specified otherwise, this must conform to the
26+-- <http://www.unoosa.org/pdf/icg/2012/template/WGS_84.pdf WGS84 standard>.
27+-- Values must be within normalized ranges. Example of normalization code
28+-- in Python: def NormalizeLongitude(longitude): \"\"\"Wraps decimal
29+-- degrees longitude to [-180.0, 180.0].\"\"\" q, r = divmod(longitude,
30+-- 360.0) if r > 180.0 or (r == 180.0 and q \<= -1.0): return r - 360.0
31+-- return r def NormalizeLatLng(latitude, longitude): \"\"\"Wraps decimal
32+-- degrees latitude and longitude to [-180.0, 180.0] and [-90.0, 90.0],
33+-- respectively.\"\"\" r = latitude % 360.0 if r \<= 90.0: return r,
34+-- NormalizeLongitude(longitude) elif r >= 270.0: return r - 360,
35+-- NormalizeLongitude(longitude) else: return 180 - r,
36+-- NormalizeLongitude(longitude + 180.0) assert 180.0 ==
37+-- NormalizeLongitude(180.0) assert -180.0 == NormalizeLongitude(-180.0)
38+-- assert -179.0 == NormalizeLongitude(181.0) assert (0.0, 0.0) ==
39+-- NormalizeLatLng(360.0, 0.0) assert (0.0, 0.0) == NormalizeLatLng(-360.0,
40+-- 0.0) assert (85.0, 180.0) == NormalizeLatLng(95.0, 0.0) assert (-85.0,
41+-- -170.0) == NormalizeLatLng(-95.0, 10.0) assert (90.0, 10.0) ==
42+-- NormalizeLatLng(90.0, 10.0) assert (-90.0, -10.0) ==
43+-- NormalizeLatLng(-90.0, -10.0) assert (0.0, -170.0) ==
44+-- NormalizeLatLng(-180.0, 10.0) assert (0.0, -170.0) ==
45+-- NormalizeLatLng(180.0, 10.0) assert (-90.0, 10.0) ==
46+-- NormalizeLatLng(270.0, 10.0) assert (90.0, 10.0) ==
47+-- NormalizeLatLng(-270.0, 10.0)
48+--
49+-- /See:/ 'latLng' smart constructor.
50+data LatLng = LatLng
51+ { _llLatitude :: !(Maybe (Textual Double))
52+ , _llLongitude :: !(Maybe (Textual Double))
53+ } deriving (Eq,Show,Data,Typeable,Generic)
54+
55+-- | Creates a value of 'LatLng' with the minimum fields required to make a request.
56+--
57+-- Use one of the following lenses to modify other fields as desired:
58+--
59+-- * 'llLatitude'
60+--
61+-- * 'llLongitude'
62+latLng
63+ :: LatLng
64+latLng =
65+ LatLng
66+ { _llLatitude = Nothing
67+ , _llLongitude = Nothing
68+ }
69+
70+-- | The latitude in degrees. It must be in the range [-90.0, +90.0].
71+llLatitude :: Lens' LatLng (Maybe Double)
72+llLatitude
73+ = lens _llLatitude (\ s a -> s{_llLatitude = a}) .
74+ mapping _Coerce
75+
76+-- | The longitude in degrees. It must be in the range [-180.0, +180.0].
77+llLongitude :: Lens' LatLng (Maybe Double)
78+llLongitude
79+ = lens _llLongitude (\ s a -> s{_llLongitude = a}) .
80+ mapping _Coerce
81+
82+instance FromJSON LatLng where
83+ parseJSON
84+ = withObject "LatLng"
85+ (\ o ->
86+ LatLng <$>
87+ (o .:? "latitude") <*> (o .:? "longitude"))
88+
89+instance ToJSON LatLng where
90+ toJSON LatLng{..}
91+ = object
92+ (catMaybes
93+ [("latitude" .=) <$> _llLatitude,
94+ ("longitude" .=) <$> _llLongitude])
95+
96+-- | The /Feature/ indicates what type of image detection task to perform.
97+-- Users describe the type of Vision tasks to perform over images by using
98+-- /Feature/s. Features encode the Vision vertical to operate on and the
99+-- number of top-scoring results to return.
100+--
101+-- /See:/ 'feature' smart constructor.
102+data Feature = Feature
103+ { _fType :: !(Maybe FeatureType)
104+ , _fMaxResults :: !(Maybe (Textual Int32))
105+ } deriving (Eq,Show,Data,Typeable,Generic)
106+
107+-- | Creates a value of 'Feature' with the minimum fields required to make a request.
108+--
109+-- Use one of the following lenses to modify other fields as desired:
110+--
111+-- * 'fType'
112+--
113+-- * 'fMaxResults'
114+feature
115+ :: Feature
116+feature =
117+ Feature
118+ { _fType = Nothing
119+ , _fMaxResults = Nothing
120+ }
121+
122+-- | The feature type.
123+fType :: Lens' Feature (Maybe FeatureType)
124+fType = lens _fType (\ s a -> s{_fType = a})
125+
126+-- | Maximum number of results of this type.
127+fMaxResults :: Lens' Feature (Maybe Int32)
128+fMaxResults
129+ = lens _fMaxResults (\ s a -> s{_fMaxResults = a}) .
130+ mapping _Coerce
131+
132+instance FromJSON Feature where
133+ parseJSON
134+ = withObject "Feature"
135+ (\ o ->
136+ Feature <$> (o .:? "type") <*> (o .:? "maxResults"))
137+
138+instance ToJSON Feature where
139+ toJSON Feature{..}
140+ = object
141+ (catMaybes
142+ [("type" .=) <$> _fType,
143+ ("maxResults" .=) <$> _fMaxResults])
144+
145+-- | The \`Status\` type defines a logical error model that is suitable for
146+-- different programming environments, including REST APIs and RPC APIs. It
147+-- is used by [gRPC](https:\/\/github.com\/grpc). The error model is
148+-- designed to be: - Simple to use and understand for most users - Flexible
149+-- enough to meet unexpected needs # Overview The \`Status\` message
150+-- contains three pieces of data: error code, error message, and error
151+-- details. The error code should be an enum value of google.rpc.Code, but
152+-- it may accept additional error codes if needed. The error message should
153+-- be a developer-facing English message that helps developers *understand*
154+-- and *resolve* the error. If a localized user-facing error message is
155+-- needed, put the localized message in the error details or localize it in
156+-- the client. The optional error details may contain arbitrary information
157+-- about the error. There is a predefined set of error detail types in the
158+-- package \`google.rpc\` which can be used for common error conditions. #
159+-- Language mapping The \`Status\` message is the logical representation of
160+-- the error model, but it is not necessarily the actual wire format. When
161+-- the \`Status\` message is exposed in different client libraries and
162+-- different wire protocols, it can be mapped differently. For example, it
163+-- will likely be mapped to some exceptions in Java, but more likely mapped
164+-- to some error codes in C. # Other uses The error model and the
165+-- \`Status\` message can be used in a variety of environments, either with
166+-- or without APIs, to provide a consistent developer experience across
167+-- different environments. Example uses of this error model include: -
168+-- Partial errors. If a service needs to return partial errors to the
169+-- client, it may embed the \`Status\` in the normal response to indicate
170+-- the partial errors. - Workflow errors. A typical workflow has multiple
171+-- steps. Each step may have a \`Status\` message for error reporting
172+-- purpose. - Batch operations. If a client uses batch request and batch
173+-- response, the \`Status\` message should be used directly inside batch
174+-- response, one for each error sub-response. - Asynchronous operations. If
175+-- an API call embeds asynchronous operation results in its response, the
176+-- status of those operations should be represented directly using the
177+-- \`Status\` message. - Logging. If some API errors are stored in logs,
178+-- the message \`Status\` could be used directly after any stripping needed
179+-- for security\/privacy reasons.
180+--
181+-- /See:/ 'status' smart constructor.
182+data Status = Status
183+ { _sDetails :: !(Maybe [StatusDetailsItem])
184+ , _sCode :: !(Maybe (Textual Int32))
185+ , _sMessage :: !(Maybe Text)
186+ } deriving (Eq,Show,Data,Typeable,Generic)
187+
188+-- | Creates a value of 'Status' with the minimum fields required to make a request.
189+--
190+-- Use one of the following lenses to modify other fields as desired:
191+--
192+-- * 'sDetails'
193+--
194+-- * 'sCode'
195+--
196+-- * 'sMessage'
197+status
198+ :: Status
199+status =
200+ Status
201+ { _sDetails = Nothing
202+ , _sCode = Nothing
203+ , _sMessage = Nothing
204+ }
205+
206+-- | A list of messages that carry the error details. There will be a common
207+-- set of message types for APIs to use.
208+sDetails :: Lens' Status [StatusDetailsItem]
209+sDetails
210+ = lens _sDetails (\ s a -> s{_sDetails = a}) .
211+ _Default
212+ . _Coerce
213+
214+-- | The status code, which should be an enum value of google.rpc.Code.
215+sCode :: Lens' Status (Maybe Int32)
216+sCode
217+ = lens _sCode (\ s a -> s{_sCode = a}) .
218+ mapping _Coerce
219+
220+-- | A developer-facing error message, which should be in English. Any
221+-- user-facing error message should be localized and sent in the
222+-- google.rpc.Status.details field, or localized by the client.
223+sMessage :: Lens' Status (Maybe Text)
224+sMessage = lens _sMessage (\ s a -> s{_sMessage = a})
225+
226+instance FromJSON Status where
227+ parseJSON
228+ = withObject "Status"
229+ (\ o ->
230+ Status <$>
231+ (o .:? "details" .!= mempty) <*> (o .:? "code") <*>
232+ (o .:? "message"))
233+
234+instance ToJSON Status where
235+ toJSON Status{..}
236+ = object
237+ (catMaybes
238+ [("details" .=) <$> _sDetails,
239+ ("code" .=) <$> _sCode,
240+ ("message" .=) <$> _sMessage])
241+
242+-- | Arbitrary name\/value pair.
243+--
244+-- /See:/ 'property' smart constructor.
245+data Property = Property
246+ { _pValue :: !(Maybe Text)
247+ , _pName :: !(Maybe Text)
248+ } deriving (Eq,Show,Data,Typeable,Generic)
249+
250+-- | Creates a value of 'Property' with the minimum fields required to make a request.
251+--
252+-- Use one of the following lenses to modify other fields as desired:
253+--
254+-- * 'pValue'
255+--
256+-- * 'pName'
257+property
258+ :: Property
259+property =
260+ Property
261+ { _pValue = Nothing
262+ , _pName = Nothing
263+ }
264+
265+-- | Value of the property.
266+pValue :: Lens' Property (Maybe Text)
267+pValue = lens _pValue (\ s a -> s{_pValue = a})
268+
269+-- | Name of the property.
270+pName :: Lens' Property (Maybe Text)
271+pName = lens _pName (\ s a -> s{_pName = a})
272+
273+instance FromJSON Property where
274+ parseJSON
275+ = withObject "Property"
276+ (\ o ->
277+ Property <$> (o .:? "value") <*> (o .:? "name"))
278+
279+instance ToJSON Property where
280+ toJSON Property{..}
281+ = object
282+ (catMaybes
283+ [("value" .=) <$> _pValue, ("name" .=) <$> _pName])
284+
285+-- | Client image to perform Vision tasks over.
286+--
287+-- /See:/ 'image' smart constructor.
288+data Image = Image
289+ { _iContent :: !(Maybe (Textual Word8))
290+ , _iSource :: !(Maybe ImageSource)
291+ } deriving (Eq,Show,Data,Typeable,Generic)
292+
293+-- | Creates a value of 'Image' with the minimum fields required to make a request.
294+--
295+-- Use one of the following lenses to modify other fields as desired:
296+--
297+-- * 'iContent'
298+--
299+-- * 'iSource'
300+image
301+ :: Image
302+image =
303+ Image
304+ { _iContent = Nothing
305+ , _iSource = Nothing
306+ }
307+
308+-- | Image content, represented as a stream of bytes.
309+iContent :: Lens' Image (Maybe Word8)
310+iContent
311+ = lens _iContent (\ s a -> s{_iContent = a}) .
312+ mapping _Coerce
313+
314+-- | Google Cloud Storage image location. If both \'content\' and \'source\'
315+-- are filled for an image, \'content\' takes precedence and it will be
316+-- used for performing the image annotation request.
317+iSource :: Lens' Image (Maybe ImageSource)
318+iSource = lens _iSource (\ s a -> s{_iSource = a})
319+
320+instance FromJSON Image where
321+ parseJSON
322+ = withObject "Image"
323+ (\ o ->
324+ Image <$> (o .:? "content") <*> (o .:? "source"))
325+
326+instance ToJSON Image where
327+ toJSON Image{..}
328+ = object
329+ (catMaybes
330+ [("content" .=) <$> _iContent,
331+ ("source" .=) <$> _iSource])
332+
333+-- | A face-specific landmark (for example, a face feature). Landmark
334+-- positions may fall outside the bounds of the image when the face is near
335+-- one or more edges of the image. Therefore it is NOT guaranteed that 0
336+-- \<= x \< width or 0 \<= y \< height.
337+--
338+-- /See:/ 'landmark' smart constructor.
339+data Landmark = Landmark
340+ { _lType :: !(Maybe LandmarkType)
341+ , _lPosition :: !(Maybe Position)
342+ } deriving (Eq,Show,Data,Typeable,Generic)
343+
344+-- | Creates a value of 'Landmark' 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+-- * 'lType'
349+--
350+-- * 'lPosition'
351+landmark
352+ :: Landmark
353+landmark =
354+ Landmark
355+ { _lType = Nothing
356+ , _lPosition = Nothing
357+ }
358+
359+-- | Face landmark type.
360+lType :: Lens' Landmark (Maybe LandmarkType)
361+lType = lens _lType (\ s a -> s{_lType = a})
362+
363+-- | Face landmark position.
364+lPosition :: Lens' Landmark (Maybe Position)
365+lPosition
366+ = lens _lPosition (\ s a -> s{_lPosition = a})
367+
368+instance FromJSON Landmark where
369+ parseJSON
370+ = withObject "Landmark"
371+ (\ o ->
372+ Landmark <$> (o .:? "type") <*> (o .:? "position"))
373+
374+instance ToJSON Landmark where
375+ toJSON Landmark{..}
376+ = object
377+ (catMaybes
378+ [("type" .=) <$> _lType,
379+ ("position" .=) <$> _lPosition])
380+
381+-- | Represents a color in the RGBA color space. This representation is
382+-- designed for simplicity of conversion to\/from color representations in
383+-- various languages over compactness; for example, the fields of this
384+-- representation can be trivially provided to the constructor of
385+-- \"java.awt.Color\" in Java; it can also be trivially provided to
386+-- UIColor\'s \"+colorWithRed:green:blue:alpha\" method in iOS; and, with
387+-- just a little work, it can be easily formatted into a CSS \"rgba()\"
388+-- string in JavaScript, as well. Here are some examples: Example (Java):
389+-- import com.google.type.Color; \/\/ ... public static java.awt.Color
390+-- fromProto(Color protocolor) { float alpha = protocolor.hasAlpha() ?
391+-- protocolor.getAlpha().getValue() : 1.0; return new java.awt.Color(
392+-- protocolor.getRed(), protocolor.getGreen(), protocolor.getBlue(),
393+-- alpha); } public static Color toProto(java.awt.Color color) { float red
394+-- = (float) color.getRed(); float green = (float) color.getGreen(); float
395+-- blue = (float) color.getBlue(); float denominator = 255.0; Color.Builder
396+-- resultBuilder = Color .newBuilder() .setRed(red \/ denominator)
397+-- .setGreen(green \/ denominator) .setBlue(blue \/ denominator); int alpha
398+-- = color.getAlpha(); if (alpha != 255) { result.setAlpha( FloatValue
399+-- .newBuilder() .setValue(((float) alpha) \/ denominator) .build()); }
400+-- return resultBuilder.build(); } \/\/ ... Example (iOS \/ Obj-C): \/\/
401+-- ... static UIColor* fromProto(Color* protocolor) { float red =
402+-- [protocolor red]; float green = [protocolor green]; float blue =
403+-- [protocolor blue]; FloatValue* alpha_wrapper = [protocolor alpha]; float
404+-- alpha = 1.0; if (alpha_wrapper != nil) { alpha = [alpha_wrapper value];
405+-- } return [UIColor colorWithRed:red green:green blue:blue alpha:alpha]; }
406+-- static Color* toProto(UIColor* color) { CGFloat red, green, blue, alpha;
407+-- if (![color getRed:&red green:&green blue:&blue alpha:&alpha]) { return
408+-- nil; } Color* result = [Color alloc] init]; [result setRed:red]; [result
409+-- setGreen:green]; [result setBlue:blue]; if (alpha \<= 0.9999) { [result
410+-- setAlpha:floatWrapperWithValue(alpha)]; } [result autorelease]; return
411+-- result; } \/\/ ... Example (JavaScript): \/\/ ... var protoToCssColor =
412+-- function(rgb_color) { var redFrac = rgb_color.red || 0.0; var greenFrac
413+-- = rgb_color.green || 0.0; var blueFrac = rgb_color.blue || 0.0; var red
414+-- = Math.floor(redFrac * 255); var green = Math.floor(greenFrac * 255);
415+-- var blue = Math.floor(blueFrac * 255); if (!(\'alpha\' in rgb_color)) {
416+-- return rgbToCssColor_(red, green, blue); } var alphaFrac =
417+-- rgb_color.alpha.value || 0.0; var rgbParams = [red, green,
418+-- blue].join(\',\'); return [\'rgba(\', rgbParams, \',\', alphaFrac,
419+-- \')\'].join(\'\'); }; var rgbToCssColor_ = function(red, green, blue) {
420+-- var rgbNumber = new Number((red \<\< 16) | (green \<\< 8) | blue); var
421+-- hexString = rgbNumber.toString(16); var missingZeros = 6 -
422+-- hexString.length; var resultBuilder = [\'#\']; for (var i = 0; i \<
423+-- missingZeros; i++) { resultBuilder.push(\'0\'); }
424+-- resultBuilder.push(hexString); return resultBuilder.join(\'\'); }; \/\/
425+-- ...
426+--
427+-- /See:/ 'color' smart constructor.
428+data Color = Color
429+ { _cRed :: !(Maybe (Textual Double))
430+ , _cAlpha :: !(Maybe (Textual Double))
431+ , _cGreen :: !(Maybe (Textual Double))
432+ , _cBlue :: !(Maybe (Textual Double))
433+ } deriving (Eq,Show,Data,Typeable,Generic)
434+
435+-- | Creates a value of 'Color' with the minimum fields required to make a request.
436+--
437+-- Use one of the following lenses to modify other fields as desired:
438+--
439+-- * 'cRed'
440+--
441+-- * 'cAlpha'
442+--
443+-- * 'cGreen'
444+--
445+-- * 'cBlue'
446+color
447+ :: Color
448+color =
449+ Color
450+ { _cRed = Nothing
451+ , _cAlpha = Nothing
452+ , _cGreen = Nothing
453+ , _cBlue = Nothing
454+ }
455+
456+-- | The amount of red in the color as a value in the interval [0, 1].
457+cRed :: Lens' Color (Maybe Double)
458+cRed
459+ = lens _cRed (\ s a -> s{_cRed = a}) .
460+ mapping _Coerce
461+
462+-- | The fraction of this color that should be applied to the pixel. That is,
463+-- the final pixel color is defined by the equation: pixel color = alpha *
464+-- (this color) + (1.0 - alpha) * (background color) This means that a
465+-- value of 1.0 corresponds to a solid color, whereas a value of 0.0
466+-- corresponds to a completely transparent color. This uses a wrapper
467+-- message rather than a simple float scalar so that it is possible to
468+-- distinguish between a default value and the value being unset. If
469+-- omitted, this color object is to be rendered as a solid color (as if the
470+-- alpha value had been explicitly given with a value of 1.0).
471+cAlpha :: Lens' Color (Maybe Double)
472+cAlpha
473+ = lens _cAlpha (\ s a -> s{_cAlpha = a}) .
474+ mapping _Coerce
475+
476+-- | The amount of green in the color as a value in the interval [0, 1].
477+cGreen :: Lens' Color (Maybe Double)
478+cGreen
479+ = lens _cGreen (\ s a -> s{_cGreen = a}) .
480+ mapping _Coerce
481+
482+-- | The amount of blue in the color as a value in the interval [0, 1].
483+cBlue :: Lens' Color (Maybe Double)
484+cBlue
485+ = lens _cBlue (\ s a -> s{_cBlue = a}) .
486+ mapping _Coerce
487+
488+instance FromJSON Color where
489+ parseJSON
490+ = withObject "Color"
491+ (\ o ->
492+ Color <$>
493+ (o .:? "red") <*> (o .:? "alpha") <*> (o .:? "green")
494+ <*> (o .:? "blue"))
495+
496+instance ToJSON Color where
497+ toJSON Color{..}
498+ = object
499+ (catMaybes
500+ [("red" .=) <$> _cRed, ("alpha" .=) <$> _cAlpha,
501+ ("green" .=) <$> _cGreen, ("blue" .=) <$> _cBlue])
502+
503+-- | A bounding polygon for the detected image annotation.
504+--
505+-- /See:/ 'boundingPoly' smart constructor.
506+newtype BoundingPoly = BoundingPoly
507+ { _bpVertices :: Maybe [Vertex]
508+ } deriving (Eq,Show,Data,Typeable,Generic)
509+
510+-- | Creates a value of 'BoundingPoly' with the minimum fields required to make a request.
511+--
512+-- Use one of the following lenses to modify other fields as desired:
513+--
514+-- * 'bpVertices'
515+boundingPoly
516+ :: BoundingPoly
517+boundingPoly =
518+ BoundingPoly
519+ { _bpVertices = Nothing
520+ }
521+
522+-- | The bounding polygon vertices.
523+bpVertices :: Lens' BoundingPoly [Vertex]
524+bpVertices
525+ = lens _bpVertices (\ s a -> s{_bpVertices = a}) .
526+ _Default
527+ . _Coerce
528+
529+instance FromJSON BoundingPoly where
530+ parseJSON
531+ = withObject "BoundingPoly"
532+ (\ o ->
533+ BoundingPoly <$> (o .:? "vertices" .!= mempty))
534+
535+instance ToJSON BoundingPoly where
536+ toJSON BoundingPoly{..}
537+ = object
538+ (catMaybes [("vertices" .=) <$> _bpVertices])
539+
540+-- | A vertex represents a 2D point in the image. NOTE: the vertex
541+-- coordinates are in the same scale as the original image.
542+--
543+-- /See:/ 'vertex' smart constructor.
544+data Vertex = Vertex
545+ { _vX :: !(Maybe (Textual Int32))
546+ , _vY :: !(Maybe (Textual Int32))
547+ } deriving (Eq,Show,Data,Typeable,Generic)
548+
549+-- | Creates a value of 'Vertex' with the minimum fields required to make a request.
550+--
551+-- Use one of the following lenses to modify other fields as desired:
552+--
553+-- * 'vX'
554+--
555+-- * 'vY'
556+vertex
557+ :: Vertex
558+vertex =
559+ Vertex
560+ { _vX = Nothing
561+ , _vY = Nothing
562+ }
563+
564+-- | X coordinate.
565+vX :: Lens' Vertex (Maybe Int32)
566+vX = lens _vX (\ s a -> s{_vX = a}) . mapping _Coerce
567+
568+-- | Y coordinate.
569+vY :: Lens' Vertex (Maybe Int32)
570+vY = lens _vY (\ s a -> s{_vY = a}) . mapping _Coerce
571+
572+instance FromJSON Vertex where
573+ parseJSON
574+ = withObject "Vertex"
575+ (\ o -> Vertex <$> (o .:? "x") <*> (o .:? "y"))
576+
577+instance ToJSON Vertex where
578+ toJSON Vertex{..}
579+ = object
580+ (catMaybes [("x" .=) <$> _vX, ("y" .=) <$> _vY])
581+
582+-- | Detected entity location information.
583+--
584+-- /See:/ 'locationInfo' smart constructor.
585+newtype LocationInfo = LocationInfo
586+ { _liLatLng :: Maybe LatLng
587+ } deriving (Eq,Show,Data,Typeable,Generic)
588+
589+-- | Creates a value of 'LocationInfo' with the minimum fields required to make a request.
590+--
591+-- Use one of the following lenses to modify other fields as desired:
592+--
593+-- * 'liLatLng'
594+locationInfo
595+ :: LocationInfo
596+locationInfo =
597+ LocationInfo
598+ { _liLatLng = Nothing
599+ }
600+
601+-- | Lat - long location coordinates.
602+liLatLng :: Lens' LocationInfo (Maybe LatLng)
603+liLatLng = lens _liLatLng (\ s a -> s{_liLatLng = a})
604+
605+instance FromJSON LocationInfo where
606+ parseJSON
607+ = withObject "LocationInfo"
608+ (\ o -> LocationInfo <$> (o .:? "latLng"))
609+
610+instance ToJSON LocationInfo where
611+ toJSON LocationInfo{..}
612+ = object (catMaybes [("latLng" .=) <$> _liLatLng])
613+
614+--
615+-- /See:/ 'statusDetailsItem' smart constructor.
616+newtype StatusDetailsItem = StatusDetailsItem
617+ { _sdiAddtional :: HashMap Text JSONValue
618+ } deriving (Eq,Show,Data,Typeable,Generic)
619+
620+-- | Creates a value of 'StatusDetailsItem' with the minimum fields required to make a request.
621+--
622+-- Use one of the following lenses to modify other fields as desired:
623+--
624+-- * 'sdiAddtional'
625+statusDetailsItem
626+ :: HashMap Text JSONValue -- ^ 'sdiAddtional'
627+ -> StatusDetailsItem
628+statusDetailsItem pSdiAddtional_ =
629+ StatusDetailsItem
630+ { _sdiAddtional = _Coerce # pSdiAddtional_
631+ }
632+
633+-- | Properties of the object. Contains field \'ype with type URL.
634+sdiAddtional :: Lens' StatusDetailsItem (HashMap Text JSONValue)
635+sdiAddtional
636+ = lens _sdiAddtional (\ s a -> s{_sdiAddtional = a})
637+ . _Coerce
638+
639+instance FromJSON StatusDetailsItem where
640+ parseJSON
641+ = withObject "StatusDetailsItem"
642+ (\ o -> StatusDetailsItem <$> (parseJSONObject o))
643+
644+instance ToJSON StatusDetailsItem where
645+ toJSON = toJSON . _sdiAddtional
646+
647+-- | Multiple image annotation requests are batched into a single service
648+-- call.
649+--
650+-- /See:/ 'batchAnnotateImagesRequest' smart constructor.
651+newtype BatchAnnotateImagesRequest = BatchAnnotateImagesRequest
652+ { _bairRequests :: Maybe [AnnotateImageRequest]
653+ } deriving (Eq,Show,Data,Typeable,Generic)
654+
655+-- | Creates a value of 'BatchAnnotateImagesRequest' with the minimum fields required to make a request.
656+--
657+-- Use one of the following lenses to modify other fields as desired:
658+--
659+-- * 'bairRequests'
660+batchAnnotateImagesRequest
661+ :: BatchAnnotateImagesRequest
662+batchAnnotateImagesRequest =
663+ BatchAnnotateImagesRequest
664+ { _bairRequests = Nothing
665+ }
666+
667+-- | Individual image annotation requests for this batch.
668+bairRequests :: Lens' BatchAnnotateImagesRequest [AnnotateImageRequest]
669+bairRequests
670+ = lens _bairRequests (\ s a -> s{_bairRequests = a})
671+ . _Default
672+ . _Coerce
673+
674+instance FromJSON BatchAnnotateImagesRequest where
675+ parseJSON
676+ = withObject "BatchAnnotateImagesRequest"
677+ (\ o ->
678+ BatchAnnotateImagesRequest <$>
679+ (o .:? "requests" .!= mempty))
680+
681+instance ToJSON BatchAnnotateImagesRequest where
682+ toJSON BatchAnnotateImagesRequest{..}
683+ = object
684+ (catMaybes [("requests" .=) <$> _bairRequests])
685+
686+-- | Color information consists of RGB channels, score and fraction of image
687+-- the color occupies in the image.
688+--
689+-- /See:/ 'colorInfo' smart constructor.
690+data ColorInfo = ColorInfo
691+ { _ciColor :: !(Maybe Color)
692+ , _ciScore :: !(Maybe (Textual Double))
693+ , _ciPixelFraction :: !(Maybe (Textual Double))
694+ } deriving (Eq,Show,Data,Typeable,Generic)
695+
696+-- | Creates a value of 'ColorInfo' with the minimum fields required to make a request.
697+--
698+-- Use one of the following lenses to modify other fields as desired:
699+--
700+-- * 'ciColor'
701+--
702+-- * 'ciScore'
703+--
704+-- * 'ciPixelFraction'
705+colorInfo
706+ :: ColorInfo
707+colorInfo =
708+ ColorInfo
709+ { _ciColor = Nothing
710+ , _ciScore = Nothing
711+ , _ciPixelFraction = Nothing
712+ }
713+
714+-- | RGB components of the color.
715+ciColor :: Lens' ColorInfo (Maybe Color)
716+ciColor = lens _ciColor (\ s a -> s{_ciColor = a})
717+
718+-- | Image-specific score for this color. Value in range [0, 1].
719+ciScore :: Lens' ColorInfo (Maybe Double)
720+ciScore
721+ = lens _ciScore (\ s a -> s{_ciScore = a}) .
722+ mapping _Coerce
723+
724+-- | Stores the fraction of pixels the color occupies in the image. Value in
725+-- range [0, 1].
726+ciPixelFraction :: Lens' ColorInfo (Maybe Double)
727+ciPixelFraction
728+ = lens _ciPixelFraction
729+ (\ s a -> s{_ciPixelFraction = a})
730+ . mapping _Coerce
731+
732+instance FromJSON ColorInfo where
733+ parseJSON
734+ = withObject "ColorInfo"
735+ (\ o ->
736+ ColorInfo <$>
737+ (o .:? "color") <*> (o .:? "score") <*>
738+ (o .:? "pixelFraction"))
739+
740+instance ToJSON ColorInfo where
741+ toJSON ColorInfo{..}
742+ = object
743+ (catMaybes
744+ [("color" .=) <$> _ciColor,
745+ ("score" .=) <$> _ciScore,
746+ ("pixelFraction" .=) <$> _ciPixelFraction])
747+
748+-- | Response to an image annotation request.
749+--
750+-- /See:/ 'annotateImageResponse' smart constructor.
751+data AnnotateImageResponse = AnnotateImageResponse
752+ { _airLogoAnnotations :: !(Maybe [EntityAnnotation])
753+ , _airLabelAnnotations :: !(Maybe [EntityAnnotation])
754+ , _airFaceAnnotations :: !(Maybe [FaceAnnotation])
755+ , _airError :: !(Maybe Status)
756+ , _airSafeSearchAnnotation :: !(Maybe SafeSearchAnnotation)
757+ , _airLandmarkAnnotations :: !(Maybe [EntityAnnotation])
758+ , _airTextAnnotations :: !(Maybe [EntityAnnotation])
759+ , _airImagePropertiesAnnotation :: !(Maybe ImageProperties)
760+ } deriving (Eq,Show,Data,Typeable,Generic)
761+
762+-- | Creates a value of 'AnnotateImageResponse' with the minimum fields required to make a request.
763+--
764+-- Use one of the following lenses to modify other fields as desired:
765+--
766+-- * 'airLogoAnnotations'
767+--
768+-- * 'airLabelAnnotations'
769+--
770+-- * 'airFaceAnnotations'
771+--
772+-- * 'airError'
773+--
774+-- * 'airSafeSearchAnnotation'
775+--
776+-- * 'airLandmarkAnnotations'
777+--
778+-- * 'airTextAnnotations'
779+--
780+-- * 'airImagePropertiesAnnotation'
781+annotateImageResponse
782+ :: AnnotateImageResponse
783+annotateImageResponse =
784+ AnnotateImageResponse
785+ { _airLogoAnnotations = Nothing
786+ , _airLabelAnnotations = Nothing
787+ , _airFaceAnnotations = Nothing
788+ , _airError = Nothing
789+ , _airSafeSearchAnnotation = Nothing
790+ , _airLandmarkAnnotations = Nothing
791+ , _airTextAnnotations = Nothing
792+ , _airImagePropertiesAnnotation = Nothing
793+ }
794+
795+-- | If present, logo detection completed successfully.
796+airLogoAnnotations :: Lens' AnnotateImageResponse [EntityAnnotation]
797+airLogoAnnotations
798+ = lens _airLogoAnnotations
799+ (\ s a -> s{_airLogoAnnotations = a})
800+ . _Default
801+ . _Coerce
802+
803+-- | If present, label detection completed successfully.
804+airLabelAnnotations :: Lens' AnnotateImageResponse [EntityAnnotation]
805+airLabelAnnotations
806+ = lens _airLabelAnnotations
807+ (\ s a -> s{_airLabelAnnotations = a})
808+ . _Default
809+ . _Coerce
810+
811+-- | If present, face detection completed successfully.
812+airFaceAnnotations :: Lens' AnnotateImageResponse [FaceAnnotation]
813+airFaceAnnotations
814+ = lens _airFaceAnnotations
815+ (\ s a -> s{_airFaceAnnotations = a})
816+ . _Default
817+ . _Coerce
818+
819+-- | If set, represents the error message for the operation. Note that
820+-- filled-in mage annotations are guaranteed to be correct, even when
821+-- 'error' is non-empty.
822+airError :: Lens' AnnotateImageResponse (Maybe Status)
823+airError = lens _airError (\ s a -> s{_airError = a})
824+
825+-- | If present, safe-search annotation completed successfully.
826+airSafeSearchAnnotation :: Lens' AnnotateImageResponse (Maybe SafeSearchAnnotation)
827+airSafeSearchAnnotation
828+ = lens _airSafeSearchAnnotation
829+ (\ s a -> s{_airSafeSearchAnnotation = a})
830+
831+-- | If present, landmark detection completed successfully.
832+airLandmarkAnnotations :: Lens' AnnotateImageResponse [EntityAnnotation]
833+airLandmarkAnnotations
834+ = lens _airLandmarkAnnotations
835+ (\ s a -> s{_airLandmarkAnnotations = a})
836+ . _Default
837+ . _Coerce
838+
839+-- | If present, text (OCR) detection completed successfully.
840+airTextAnnotations :: Lens' AnnotateImageResponse [EntityAnnotation]
841+airTextAnnotations
842+ = lens _airTextAnnotations
843+ (\ s a -> s{_airTextAnnotations = a})
844+ . _Default
845+ . _Coerce
846+
847+-- | If present, image properties were extracted successfully.
848+airImagePropertiesAnnotation :: Lens' AnnotateImageResponse (Maybe ImageProperties)
849+airImagePropertiesAnnotation
850+ = lens _airImagePropertiesAnnotation
851+ (\ s a -> s{_airImagePropertiesAnnotation = a})
852+
853+instance FromJSON AnnotateImageResponse where
854+ parseJSON
855+ = withObject "AnnotateImageResponse"
856+ (\ o ->
857+ AnnotateImageResponse <$>
858+ (o .:? "logoAnnotations" .!= mempty) <*>
859+ (o .:? "labelAnnotations" .!= mempty)
860+ <*> (o .:? "faceAnnotations" .!= mempty)
861+ <*> (o .:? "error")
862+ <*> (o .:? "safeSearchAnnotation")
863+ <*> (o .:? "landmarkAnnotations" .!= mempty)
864+ <*> (o .:? "textAnnotations" .!= mempty)
865+ <*> (o .:? "imagePropertiesAnnotation"))
866+
867+instance ToJSON AnnotateImageResponse where
868+ toJSON AnnotateImageResponse{..}
869+ = object
870+ (catMaybes
871+ [("logoAnnotations" .=) <$> _airLogoAnnotations,
872+ ("labelAnnotations" .=) <$> _airLabelAnnotations,
873+ ("faceAnnotations" .=) <$> _airFaceAnnotations,
874+ ("error" .=) <$> _airError,
875+ ("safeSearchAnnotation" .=) <$>
876+ _airSafeSearchAnnotation,
877+ ("landmarkAnnotations" .=) <$>
878+ _airLandmarkAnnotations,
879+ ("textAnnotations" .=) <$> _airTextAnnotations,
880+ ("imagePropertiesAnnotation" .=) <$>
881+ _airImagePropertiesAnnotation])
882+
883+-- | Stores image properties (e.g. dominant colors).
884+--
885+-- /See:/ 'imageProperties' smart constructor.
886+newtype ImageProperties = ImageProperties
887+ { _ipDominantColors :: Maybe DominantColorsAnnotation
888+ } deriving (Eq,Show,Data,Typeable,Generic)
889+
890+-- | Creates a value of 'ImageProperties' with the minimum fields required to make a request.
891+--
892+-- Use one of the following lenses to modify other fields as desired:
893+--
894+-- * 'ipDominantColors'
895+imageProperties
896+ :: ImageProperties
897+imageProperties =
898+ ImageProperties
899+ { _ipDominantColors = Nothing
900+ }
901+
902+-- | If present, dominant colors completed successfully.
903+ipDominantColors :: Lens' ImageProperties (Maybe DominantColorsAnnotation)
904+ipDominantColors
905+ = lens _ipDominantColors
906+ (\ s a -> s{_ipDominantColors = a})
907+
908+instance FromJSON ImageProperties where
909+ parseJSON
910+ = withObject "ImageProperties"
911+ (\ o -> ImageProperties <$> (o .:? "dominantColors"))
912+
913+instance ToJSON ImageProperties where
914+ toJSON ImageProperties{..}
915+ = object
916+ (catMaybes
917+ [("dominantColors" .=) <$> _ipDominantColors])
918+
919+-- | A face annotation contains the results of face detection.
920+--
921+-- /See:/ 'faceAnnotation' smart constructor.
922+data FaceAnnotation = FaceAnnotation
923+ { _faTiltAngle :: !(Maybe (Textual Double))
924+ , _faBlurredLikelihood :: !(Maybe FaceAnnotationBlurredLikelihood)
925+ , _faBoundingPoly :: !(Maybe BoundingPoly)
926+ , _faSurpriseLikelihood :: !(Maybe FaceAnnotationSurpriseLikelihood)
927+ , _faLandmarkingConfidence :: !(Maybe (Textual Double))
928+ , _faPanAngle :: !(Maybe (Textual Double))
929+ , _faRollAngle :: !(Maybe (Textual Double))
930+ , _faUnderExposedLikelihood :: !(Maybe FaceAnnotationUnderExposedLikelihood)
931+ , _faFdBoundingPoly :: !(Maybe BoundingPoly)
932+ , _faAngerLikelihood :: !(Maybe FaceAnnotationAngerLikelihood)
933+ , _faDetectionConfidence :: !(Maybe (Textual Double))
934+ , _faHeadwearLikelihood :: !(Maybe FaceAnnotationHeadwearLikelihood)
935+ , _faSorrowLikelihood :: !(Maybe FaceAnnotationSorrowLikelihood)
936+ , _faJoyLikelihood :: !(Maybe FaceAnnotationJoyLikelihood)
937+ , _faLandmarks :: !(Maybe [Landmark])
938+ } deriving (Eq,Show,Data,Typeable,Generic)
939+
940+-- | Creates a value of 'FaceAnnotation' with the minimum fields required to make a request.
941+--
942+-- Use one of the following lenses to modify other fields as desired:
943+--
944+-- * 'faTiltAngle'
945+--
946+-- * 'faBlurredLikelihood'
947+--
948+-- * 'faBoundingPoly'
949+--
950+-- * 'faSurpriseLikelihood'
951+--
952+-- * 'faLandmarkingConfidence'
953+--
954+-- * 'faPanAngle'
955+--
956+-- * 'faRollAngle'
957+--
958+-- * 'faUnderExposedLikelihood'
959+--
960+-- * 'faFdBoundingPoly'
961+--
962+-- * 'faAngerLikelihood'
963+--
964+-- * 'faDetectionConfidence'
965+--
966+-- * 'faHeadwearLikelihood'
967+--
968+-- * 'faSorrowLikelihood'
969+--
970+-- * 'faJoyLikelihood'
971+--
972+-- * 'faLandmarks'
973+faceAnnotation
974+ :: FaceAnnotation
975+faceAnnotation =
976+ FaceAnnotation
977+ { _faTiltAngle = Nothing
978+ , _faBlurredLikelihood = Nothing
979+ , _faBoundingPoly = Nothing
980+ , _faSurpriseLikelihood = Nothing
981+ , _faLandmarkingConfidence = Nothing
982+ , _faPanAngle = Nothing
983+ , _faRollAngle = Nothing
984+ , _faUnderExposedLikelihood = Nothing
985+ , _faFdBoundingPoly = Nothing
986+ , _faAngerLikelihood = Nothing
987+ , _faDetectionConfidence = Nothing
988+ , _faHeadwearLikelihood = Nothing
989+ , _faSorrowLikelihood = Nothing
990+ , _faJoyLikelihood = Nothing
991+ , _faLandmarks = Nothing
992+ }
993+
994+-- | Pitch angle. Indicates the upwards\/downwards angle that the face is
995+-- pointing relative to the image\'s horizontal plane. Range [-180,180].
996+faTiltAngle :: Lens' FaceAnnotation (Maybe Double)
997+faTiltAngle
998+ = lens _faTiltAngle (\ s a -> s{_faTiltAngle = a}) .
999+ mapping _Coerce
1000+
1001+-- | Blurred likelihood.
1002+faBlurredLikelihood :: Lens' FaceAnnotation (Maybe FaceAnnotationBlurredLikelihood)
1003+faBlurredLikelihood
1004+ = lens _faBlurredLikelihood
1005+ (\ s a -> s{_faBlurredLikelihood = a})
1006+
1007+-- | The bounding polygon around the face. The coordinates of the bounding
1008+-- box are in the original image\'s scale, as returned in ImageParams. The
1009+-- bounding box is computed to \"frame\" the face in accordance with human
1010+-- expectations. It is based on the landmarker results. Note that one or
1011+-- more x and\/or y coordinates may not be generated in the BoundingPoly
1012+-- (the polygon will be unbounded) if only a partial face appears in the
1013+-- image to be annotated.
1014+faBoundingPoly :: Lens' FaceAnnotation (Maybe BoundingPoly)
1015+faBoundingPoly
1016+ = lens _faBoundingPoly
1017+ (\ s a -> s{_faBoundingPoly = a})
1018+
1019+-- | Surprise likelihood.
1020+faSurpriseLikelihood :: Lens' FaceAnnotation (Maybe FaceAnnotationSurpriseLikelihood)
1021+faSurpriseLikelihood
1022+ = lens _faSurpriseLikelihood
1023+ (\ s a -> s{_faSurpriseLikelihood = a})
1024+
1025+-- | Face landmarking confidence. Range [0, 1].
1026+faLandmarkingConfidence :: Lens' FaceAnnotation (Maybe Double)
1027+faLandmarkingConfidence
1028+ = lens _faLandmarkingConfidence
1029+ (\ s a -> s{_faLandmarkingConfidence = a})
1030+ . mapping _Coerce
1031+
1032+-- | Yaw angle. Indicates the leftward\/rightward angle that the face is
1033+-- pointing, relative to the vertical plane perpendicular to the image.
1034+-- Range [-180,180].
1035+faPanAngle :: Lens' FaceAnnotation (Maybe Double)
1036+faPanAngle
1037+ = lens _faPanAngle (\ s a -> s{_faPanAngle = a}) .
1038+ mapping _Coerce
1039+
1040+-- | Roll angle. Indicates the amount of clockwise\/anti-clockwise rotation
1041+-- of the face relative to the image vertical, about the axis perpendicular
1042+-- to the face. Range [-180,180].
1043+faRollAngle :: Lens' FaceAnnotation (Maybe Double)
1044+faRollAngle
1045+ = lens _faRollAngle (\ s a -> s{_faRollAngle = a}) .
1046+ mapping _Coerce
1047+
1048+-- | Under-exposed likelihood.
1049+faUnderExposedLikelihood :: Lens' FaceAnnotation (Maybe FaceAnnotationUnderExposedLikelihood)
1050+faUnderExposedLikelihood
1051+ = lens _faUnderExposedLikelihood
1052+ (\ s a -> s{_faUnderExposedLikelihood = a})
1053+
1054+-- | This bounding polygon is tighter than the previous 'boundingPoly', and
1055+-- encloses only the skin part of the face. Typically, it is used to
1056+-- eliminate the face from any image analysis that detects the \"amount of
1057+-- skin\" visible in an image. It is not based on the landmarker results,
1058+-- only on the initial face detection, hence the 'fd' (face detection)
1059+-- prefix.
1060+faFdBoundingPoly :: Lens' FaceAnnotation (Maybe BoundingPoly)
1061+faFdBoundingPoly
1062+ = lens _faFdBoundingPoly
1063+ (\ s a -> s{_faFdBoundingPoly = a})
1064+
1065+-- | Anger likelihood.
1066+faAngerLikelihood :: Lens' FaceAnnotation (Maybe FaceAnnotationAngerLikelihood)
1067+faAngerLikelihood
1068+ = lens _faAngerLikelihood
1069+ (\ s a -> s{_faAngerLikelihood = a})
1070+
1071+-- | Detection confidence. Range [0, 1].
1072+faDetectionConfidence :: Lens' FaceAnnotation (Maybe Double)
1073+faDetectionConfidence
1074+ = lens _faDetectionConfidence
1075+ (\ s a -> s{_faDetectionConfidence = a})
1076+ . mapping _Coerce
1077+
1078+-- | Headwear likelihood.
1079+faHeadwearLikelihood :: Lens' FaceAnnotation (Maybe FaceAnnotationHeadwearLikelihood)
1080+faHeadwearLikelihood
1081+ = lens _faHeadwearLikelihood
1082+ (\ s a -> s{_faHeadwearLikelihood = a})
1083+
1084+-- | Sorrow likelihood.
1085+faSorrowLikelihood :: Lens' FaceAnnotation (Maybe FaceAnnotationSorrowLikelihood)
1086+faSorrowLikelihood
1087+ = lens _faSorrowLikelihood
1088+ (\ s a -> s{_faSorrowLikelihood = a})
1089+
1090+-- | Joy likelihood.
1091+faJoyLikelihood :: Lens' FaceAnnotation (Maybe FaceAnnotationJoyLikelihood)
1092+faJoyLikelihood
1093+ = lens _faJoyLikelihood
1094+ (\ s a -> s{_faJoyLikelihood = a})
1095+
1096+-- | Detected face landmarks.
1097+faLandmarks :: Lens' FaceAnnotation [Landmark]
1098+faLandmarks
1099+ = lens _faLandmarks (\ s a -> s{_faLandmarks = a}) .
1100+ _Default
1101+ . _Coerce
1102+
1103+instance FromJSON FaceAnnotation where
1104+ parseJSON
1105+ = withObject "FaceAnnotation"
1106+ (\ o ->
1107+ FaceAnnotation <$>
1108+ (o .:? "tiltAngle") <*> (o .:? "blurredLikelihood")
1109+ <*> (o .:? "boundingPoly")
1110+ <*> (o .:? "surpriseLikelihood")
1111+ <*> (o .:? "landmarkingConfidence")
1112+ <*> (o .:? "panAngle")
1113+ <*> (o .:? "rollAngle")
1114+ <*> (o .:? "underExposedLikelihood")
1115+ <*> (o .:? "fdBoundingPoly")
1116+ <*> (o .:? "angerLikelihood")
1117+ <*> (o .:? "detectionConfidence")
1118+ <*> (o .:? "headwearLikelihood")
1119+ <*> (o .:? "sorrowLikelihood")
1120+ <*> (o .:? "joyLikelihood")
1121+ <*> (o .:? "landmarks" .!= mempty))
1122+
1123+instance ToJSON FaceAnnotation where
1124+ toJSON FaceAnnotation{..}
1125+ = object
1126+ (catMaybes
1127+ [("tiltAngle" .=) <$> _faTiltAngle,
1128+ ("blurredLikelihood" .=) <$> _faBlurredLikelihood,
1129+ ("boundingPoly" .=) <$> _faBoundingPoly,
1130+ ("surpriseLikelihood" .=) <$> _faSurpriseLikelihood,
1131+ ("landmarkingConfidence" .=) <$>
1132+ _faLandmarkingConfidence,
1133+ ("panAngle" .=) <$> _faPanAngle,
1134+ ("rollAngle" .=) <$> _faRollAngle,
1135+ ("underExposedLikelihood" .=) <$>
1136+ _faUnderExposedLikelihood,
1137+ ("fdBoundingPoly" .=) <$> _faFdBoundingPoly,
1138+ ("angerLikelihood" .=) <$> _faAngerLikelihood,
1139+ ("detectionConfidence" .=) <$>
1140+ _faDetectionConfidence,
1141+ ("headwearLikelihood" .=) <$> _faHeadwearLikelihood,
1142+ ("sorrowLikelihood" .=) <$> _faSorrowLikelihood,
1143+ ("joyLikelihood" .=) <$> _faJoyLikelihood,
1144+ ("landmarks" .=) <$> _faLandmarks])
1145+
1146+-- | Set of detected entity features.
1147+--
1148+-- /See:/ 'entityAnnotation' smart constructor.
1149+data EntityAnnotation = EntityAnnotation
1150+ { _eaScore :: !(Maybe (Textual Double))
1151+ , _eaTopicality :: !(Maybe (Textual Double))
1152+ , _eaLocale :: !(Maybe Text)
1153+ , _eaBoundingPoly :: !(Maybe BoundingPoly)
1154+ , _eaConfidence :: !(Maybe (Textual Double))
1155+ , _eaMid :: !(Maybe Text)
1156+ , _eaLocations :: !(Maybe [LocationInfo])
1157+ , _eaDescription :: !(Maybe Text)
1158+ , _eaProperties :: !(Maybe [Property])
1159+ } deriving (Eq,Show,Data,Typeable,Generic)
1160+
1161+-- | Creates a value of 'EntityAnnotation' with the minimum fields required to make a request.
1162+--
1163+-- Use one of the following lenses to modify other fields as desired:
1164+--
1165+-- * 'eaScore'
1166+--
1167+-- * 'eaTopicality'
1168+--
1169+-- * 'eaLocale'
1170+--
1171+-- * 'eaBoundingPoly'
1172+--
1173+-- * 'eaConfidence'
1174+--
1175+-- * 'eaMid'
1176+--
1177+-- * 'eaLocations'
1178+--
1179+-- * 'eaDescription'
1180+--
1181+-- * 'eaProperties'
1182+entityAnnotation
1183+ :: EntityAnnotation
1184+entityAnnotation =
1185+ EntityAnnotation
1186+ { _eaScore = Nothing
1187+ , _eaTopicality = Nothing
1188+ , _eaLocale = Nothing
1189+ , _eaBoundingPoly = Nothing
1190+ , _eaConfidence = Nothing
1191+ , _eaMid = Nothing
1192+ , _eaLocations = Nothing
1193+ , _eaDescription = Nothing
1194+ , _eaProperties = Nothing
1195+ }
1196+
1197+-- | Overall score of the result. Range [0, 1].
1198+eaScore :: Lens' EntityAnnotation (Maybe Double)
1199+eaScore
1200+ = lens _eaScore (\ s a -> s{_eaScore = a}) .
1201+ mapping _Coerce
1202+
1203+-- | The relevancy of the ICA (Image Content Annotation) label to the image.
1204+-- For example, the relevancy of \'tower\' to an image containing \'Eiffel
1205+-- Tower\' is likely higher than an image containing a distant towering
1206+-- building, though the confidence that there is a tower may be the same.
1207+-- Range [0, 1].
1208+eaTopicality :: Lens' EntityAnnotation (Maybe Double)
1209+eaTopicality
1210+ = lens _eaTopicality (\ s a -> s{_eaTopicality = a})
1211+ . mapping _Coerce
1212+
1213+-- | The language code for the locale in which the entity textual
1214+-- 'description' (next field) is expressed.
1215+eaLocale :: Lens' EntityAnnotation (Maybe Text)
1216+eaLocale = lens _eaLocale (\ s a -> s{_eaLocale = a})
1217+
1218+-- | Image region to which this entity belongs.
1219+eaBoundingPoly :: Lens' EntityAnnotation (Maybe BoundingPoly)
1220+eaBoundingPoly
1221+ = lens _eaBoundingPoly
1222+ (\ s a -> s{_eaBoundingPoly = a})
1223+
1224+-- | The accuracy of the entity detection in an image. For example, for an
1225+-- image containing \'Eiffel Tower,\' this field represents the confidence
1226+-- that there is a tower in the query image. Range [0, 1].
1227+eaConfidence :: Lens' EntityAnnotation (Maybe Double)
1228+eaConfidence
1229+ = lens _eaConfidence (\ s a -> s{_eaConfidence = a})
1230+ . mapping _Coerce
1231+
1232+-- | Knowledge Graph entity ID. Maps to a freebase entity ID. (for example,
1233+-- \"Google\" maps to: mid \/m\/045c7b).
1234+eaMid :: Lens' EntityAnnotation (Maybe Text)
1235+eaMid = lens _eaMid (\ s a -> s{_eaMid = a})
1236+
1237+-- | The location information for the detected entity. Multiple
1238+-- 'LocationInfo' elements can be present since one location may indicate
1239+-- the location of the scene in the query image, and another the location
1240+-- of the place where the query image was taken. Location information is
1241+-- usually present for landmarks.
1242+eaLocations :: Lens' EntityAnnotation [LocationInfo]
1243+eaLocations
1244+ = lens _eaLocations (\ s a -> s{_eaLocations = a}) .
1245+ _Default
1246+ . _Coerce
1247+
1248+-- | Entity textual description, expressed in its 'locale' language.
1249+eaDescription :: Lens' EntityAnnotation (Maybe Text)
1250+eaDescription
1251+ = lens _eaDescription
1252+ (\ s a -> s{_eaDescription = a})
1253+
1254+-- | Some entities can have additional optional 'Property' fields. For
1255+-- example a different kind of score or string that qualifies the entity.
1256+eaProperties :: Lens' EntityAnnotation [Property]
1257+eaProperties
1258+ = lens _eaProperties (\ s a -> s{_eaProperties = a})
1259+ . _Default
1260+ . _Coerce
1261+
1262+instance FromJSON EntityAnnotation where
1263+ parseJSON
1264+ = withObject "EntityAnnotation"
1265+ (\ o ->
1266+ EntityAnnotation <$>
1267+ (o .:? "score") <*> (o .:? "topicality") <*>
1268+ (o .:? "locale")
1269+ <*> (o .:? "boundingPoly")
1270+ <*> (o .:? "confidence")
1271+ <*> (o .:? "mid")
1272+ <*> (o .:? "locations" .!= mempty)
1273+ <*> (o .:? "description")
1274+ <*> (o .:? "properties" .!= mempty))
1275+
1276+instance ToJSON EntityAnnotation where
1277+ toJSON EntityAnnotation{..}
1278+ = object
1279+ (catMaybes
1280+ [("score" .=) <$> _eaScore,
1281+ ("topicality" .=) <$> _eaTopicality,
1282+ ("locale" .=) <$> _eaLocale,
1283+ ("boundingPoly" .=) <$> _eaBoundingPoly,
1284+ ("confidence" .=) <$> _eaConfidence,
1285+ ("mid" .=) <$> _eaMid,
1286+ ("locations" .=) <$> _eaLocations,
1287+ ("description" .=) <$> _eaDescription,
1288+ ("properties" .=) <$> _eaProperties])
1289+
1290+-- | Request for performing Vision tasks over a user-provided image, with
1291+-- user-requested features.
1292+--
1293+-- /See:/ 'annotateImageRequest' smart constructor.
1294+data AnnotateImageRequest = AnnotateImageRequest
1295+ { _airImage :: !(Maybe Image)
1296+ , _airFeatures :: !(Maybe [Feature])
1297+ , _airImageContext :: !(Maybe ImageContext)
1298+ } deriving (Eq,Show,Data,Typeable,Generic)
1299+
1300+-- | Creates a value of 'AnnotateImageRequest' with the minimum fields required to make a request.
1301+--
1302+-- Use one of the following lenses to modify other fields as desired:
1303+--
1304+-- * 'airImage'
1305+--
1306+-- * 'airFeatures'
1307+--
1308+-- * 'airImageContext'
1309+annotateImageRequest
1310+ :: AnnotateImageRequest
1311+annotateImageRequest =
1312+ AnnotateImageRequest
1313+ { _airImage = Nothing
1314+ , _airFeatures = Nothing
1315+ , _airImageContext = Nothing
1316+ }
1317+
1318+-- | The image to be processed.
1319+airImage :: Lens' AnnotateImageRequest (Maybe Image)
1320+airImage = lens _airImage (\ s a -> s{_airImage = a})
1321+
1322+-- | Requested features.
1323+airFeatures :: Lens' AnnotateImageRequest [Feature]
1324+airFeatures
1325+ = lens _airFeatures (\ s a -> s{_airFeatures = a}) .
1326+ _Default
1327+ . _Coerce
1328+
1329+-- | Additional context that may accompany the image.
1330+airImageContext :: Lens' AnnotateImageRequest (Maybe ImageContext)
1331+airImageContext
1332+ = lens _airImageContext
1333+ (\ s a -> s{_airImageContext = a})
1334+
1335+instance FromJSON AnnotateImageRequest where
1336+ parseJSON
1337+ = withObject "AnnotateImageRequest"
1338+ (\ o ->
1339+ AnnotateImageRequest <$>
1340+ (o .:? "image") <*> (o .:? "features" .!= mempty) <*>
1341+ (o .:? "imageContext"))
1342+
1343+instance ToJSON AnnotateImageRequest where
1344+ toJSON AnnotateImageRequest{..}
1345+ = object
1346+ (catMaybes
1347+ [("image" .=) <$> _airImage,
1348+ ("features" .=) <$> _airFeatures,
1349+ ("imageContext" .=) <$> _airImageContext])
1350+
1351+-- | External image source (i.e. Google Cloud Storage image location).
1352+--
1353+-- /See:/ 'imageSource' smart constructor.
1354+newtype ImageSource = ImageSource
1355+ { _isGcsImageURI :: Maybe Text
1356+ } deriving (Eq,Show,Data,Typeable,Generic)
1357+
1358+-- | Creates a value of 'ImageSource' with the minimum fields required to make a request.
1359+--
1360+-- Use one of the following lenses to modify other fields as desired:
1361+--
1362+-- * 'isGcsImageURI'
1363+imageSource
1364+ :: ImageSource
1365+imageSource =
1366+ ImageSource
1367+ { _isGcsImageURI = Nothing
1368+ }
1369+
1370+-- | Google Cloud Storage image URI. It must be in the following form:
1371+-- \"gs:\/\/bucket_name\/object_name\". For more details, please see:
1372+-- https:\/\/cloud.google.com\/storage\/docs\/reference-uris. NOTE: Cloud
1373+-- Storage object versioning is not supported!
1374+isGcsImageURI :: Lens' ImageSource (Maybe Text)
1375+isGcsImageURI
1376+ = lens _isGcsImageURI
1377+ (\ s a -> s{_isGcsImageURI = a})
1378+
1379+instance FromJSON ImageSource where
1380+ parseJSON
1381+ = withObject "ImageSource"
1382+ (\ o -> ImageSource <$> (o .:? "gcsImageUri"))
1383+
1384+instance ToJSON ImageSource where
1385+ toJSON ImageSource{..}
1386+ = object
1387+ (catMaybes [("gcsImageUri" .=) <$> _isGcsImageURI])
1388+
1389+-- | Set of features pertaining to the image, computed by various computer
1390+-- vision methods over safe-search verticals (for example, adult, spoof,
1391+-- medical, violence).
1392+--
1393+-- /See:/ 'safeSearchAnnotation' smart constructor.
1394+data SafeSearchAnnotation = SafeSearchAnnotation
1395+ { _ssaSpoof :: !(Maybe SafeSearchAnnotationSpoof)
1396+ , _ssaAdult :: !(Maybe SafeSearchAnnotationAdult)
1397+ , _ssaMedical :: !(Maybe SafeSearchAnnotationMedical)
1398+ , _ssaViolence :: !(Maybe SafeSearchAnnotationViolence)
1399+ } deriving (Eq,Show,Data,Typeable,Generic)
1400+
1401+-- | Creates a value of 'SafeSearchAnnotation' with the minimum fields required to make a request.
1402+--
1403+-- Use one of the following lenses to modify other fields as desired:
1404+--
1405+-- * 'ssaSpoof'
1406+--
1407+-- * 'ssaAdult'
1408+--
1409+-- * 'ssaMedical'
1410+--
1411+-- * 'ssaViolence'
1412+safeSearchAnnotation
1413+ :: SafeSearchAnnotation
1414+safeSearchAnnotation =
1415+ SafeSearchAnnotation
1416+ { _ssaSpoof = Nothing
1417+ , _ssaAdult = Nothing
1418+ , _ssaMedical = Nothing
1419+ , _ssaViolence = Nothing
1420+ }
1421+
1422+-- | Spoof likelihood. The likelihood that an obvious modification was made
1423+-- to the image\'s canonical version to make it appear funny or offensive.
1424+ssaSpoof :: Lens' SafeSearchAnnotation (Maybe SafeSearchAnnotationSpoof)
1425+ssaSpoof = lens _ssaSpoof (\ s a -> s{_ssaSpoof = a})
1426+
1427+-- | Represents the adult contents likelihood for the image.
1428+ssaAdult :: Lens' SafeSearchAnnotation (Maybe SafeSearchAnnotationAdult)
1429+ssaAdult = lens _ssaAdult (\ s a -> s{_ssaAdult = a})
1430+
1431+-- | Likelihood this is a medical image.
1432+ssaMedical :: Lens' SafeSearchAnnotation (Maybe SafeSearchAnnotationMedical)
1433+ssaMedical
1434+ = lens _ssaMedical (\ s a -> s{_ssaMedical = a})
1435+
1436+-- | Violence likelihood.
1437+ssaViolence :: Lens' SafeSearchAnnotation (Maybe SafeSearchAnnotationViolence)
1438+ssaViolence
1439+ = lens _ssaViolence (\ s a -> s{_ssaViolence = a})
1440+
1441+instance FromJSON SafeSearchAnnotation where
1442+ parseJSON
1443+ = withObject "SafeSearchAnnotation"
1444+ (\ o ->
1445+ SafeSearchAnnotation <$>
1446+ (o .:? "spoof") <*> (o .:? "adult") <*>
1447+ (o .:? "medical")
1448+ <*> (o .:? "violence"))
1449+
1450+instance ToJSON SafeSearchAnnotation where
1451+ toJSON SafeSearchAnnotation{..}
1452+ = object
1453+ (catMaybes
1454+ [("spoof" .=) <$> _ssaSpoof,
1455+ ("adult" .=) <$> _ssaAdult,
1456+ ("medical" .=) <$> _ssaMedical,
1457+ ("violence" .=) <$> _ssaViolence])
1458+
1459+-- | Image context.
1460+--
1461+-- /See:/ 'imageContext' smart constructor.
1462+data ImageContext = ImageContext
1463+ { _icLanguageHints :: !(Maybe [Text])
1464+ , _icLatLongRect :: !(Maybe LatLongRect)
1465+ } deriving (Eq,Show,Data,Typeable,Generic)
1466+
1467+-- | Creates a value of 'ImageContext' with the minimum fields required to make a request.
1468+--
1469+-- Use one of the following lenses to modify other fields as desired:
1470+--
1471+-- * 'icLanguageHints'
1472+--
1473+-- * 'icLatLongRect'
1474+imageContext
1475+ :: ImageContext
1476+imageContext =
1477+ ImageContext
1478+ { _icLanguageHints = Nothing
1479+ , _icLatLongRect = Nothing
1480+ }
1481+
1482+-- | List of languages to use for TEXT_DETECTION. In most cases, an empty
1483+-- value will yield the best results as it will allow text detection to
1484+-- automatically detect the text language. For languages based on the latin
1485+-- alphabet a hint is not needed. In rare cases, when the language of the
1486+-- text in the image is known in advance, setting this hint will help get
1487+-- better results (although it will hurt a great deal if the hint is
1488+-- wrong). Text detection will return an error if one or more of the
1489+-- languages specified here are not supported. The exact list of supported
1490+-- languages are specified here:
1491+-- https:\/\/cloud.google.com\/translate\/v2\/using_rest#language-params
1492+icLanguageHints :: Lens' ImageContext [Text]
1493+icLanguageHints
1494+ = lens _icLanguageHints
1495+ (\ s a -> s{_icLanguageHints = a})
1496+ . _Default
1497+ . _Coerce
1498+
1499+-- | Lat\/long rectangle that specifies the location of the image.
1500+icLatLongRect :: Lens' ImageContext (Maybe LatLongRect)
1501+icLatLongRect
1502+ = lens _icLatLongRect
1503+ (\ s a -> s{_icLatLongRect = a})
1504+
1505+instance FromJSON ImageContext where
1506+ parseJSON
1507+ = withObject "ImageContext"
1508+ (\ o ->
1509+ ImageContext <$>
1510+ (o .:? "languageHints" .!= mempty) <*>
1511+ (o .:? "latLongRect"))
1512+
1513+instance ToJSON ImageContext where
1514+ toJSON ImageContext{..}
1515+ = object
1516+ (catMaybes
1517+ [("languageHints" .=) <$> _icLanguageHints,
1518+ ("latLongRect" .=) <$> _icLatLongRect])
1519+
1520+-- | Set of dominant colors and their corresponding scores.
1521+--
1522+-- /See:/ 'dominantColorsAnnotation' smart constructor.
1523+newtype DominantColorsAnnotation = DominantColorsAnnotation
1524+ { _dcaColors :: Maybe [ColorInfo]
1525+ } deriving (Eq,Show,Data,Typeable,Generic)
1526+
1527+-- | Creates a value of 'DominantColorsAnnotation' with the minimum fields required to make a request.
1528+--
1529+-- Use one of the following lenses to modify other fields as desired:
1530+--
1531+-- * 'dcaColors'
1532+dominantColorsAnnotation
1533+ :: DominantColorsAnnotation
1534+dominantColorsAnnotation =
1535+ DominantColorsAnnotation
1536+ { _dcaColors = Nothing
1537+ }
1538+
1539+-- | RGB color values, with their score and pixel fraction.
1540+dcaColors :: Lens' DominantColorsAnnotation [ColorInfo]
1541+dcaColors
1542+ = lens _dcaColors (\ s a -> s{_dcaColors = a}) .
1543+ _Default
1544+ . _Coerce
1545+
1546+instance FromJSON DominantColorsAnnotation where
1547+ parseJSON
1548+ = withObject "DominantColorsAnnotation"
1549+ (\ o ->
1550+ DominantColorsAnnotation <$>
1551+ (o .:? "colors" .!= mempty))
1552+
1553+instance ToJSON DominantColorsAnnotation where
1554+ toJSON DominantColorsAnnotation{..}
1555+ = object (catMaybes [("colors" .=) <$> _dcaColors])
1556+
1557+-- | Rectangle determined by min and max LatLng pairs.
1558+--
1559+-- /See:/ 'latLongRect' smart constructor.
1560+data LatLongRect = LatLongRect
1561+ { _llrMaxLatLng :: !(Maybe LatLng)
1562+ , _llrMinLatLng :: !(Maybe LatLng)
1563+ } deriving (Eq,Show,Data,Typeable,Generic)
1564+
1565+-- | Creates a value of 'LatLongRect' with the minimum fields required to make a request.
1566+--
1567+-- Use one of the following lenses to modify other fields as desired:
1568+--
1569+-- * 'llrMaxLatLng'
1570+--
1571+-- * 'llrMinLatLng'
1572+latLongRect
1573+ :: LatLongRect
1574+latLongRect =
1575+ LatLongRect
1576+ { _llrMaxLatLng = Nothing
1577+ , _llrMinLatLng = Nothing
1578+ }
1579+
1580+-- | Max lat\/long pair.
1581+llrMaxLatLng :: Lens' LatLongRect (Maybe LatLng)
1582+llrMaxLatLng
1583+ = lens _llrMaxLatLng (\ s a -> s{_llrMaxLatLng = a})
1584+
1585+-- | Min lat\/long pair.
1586+llrMinLatLng :: Lens' LatLongRect (Maybe LatLng)
1587+llrMinLatLng
1588+ = lens _llrMinLatLng (\ s a -> s{_llrMinLatLng = a})
1589+
1590+instance FromJSON LatLongRect where
1591+ parseJSON
1592+ = withObject "LatLongRect"
1593+ (\ o ->
1594+ LatLongRect <$>
1595+ (o .:? "maxLatLng") <*> (o .:? "minLatLng"))
1596+
1597+instance ToJSON LatLongRect where
1598+ toJSON LatLongRect{..}
1599+ = object
1600+ (catMaybes
1601+ [("maxLatLng" .=) <$> _llrMaxLatLng,
1602+ ("minLatLng" .=) <$> _llrMinLatLng])
1603+
1604+-- | Response to a batch image annotation request.
1605+--
1606+-- /See:/ 'batchAnnotateImagesResponse' smart constructor.
1607+newtype BatchAnnotateImagesResponse = BatchAnnotateImagesResponse
1608+ { _bairResponses :: Maybe [AnnotateImageResponse]
1609+ } deriving (Eq,Show,Data,Typeable,Generic)
1610+
1611+-- | Creates a value of 'BatchAnnotateImagesResponse' with the minimum fields required to make a request.
1612+--
1613+-- Use one of the following lenses to modify other fields as desired:
1614+--
1615+-- * 'bairResponses'
1616+batchAnnotateImagesResponse
1617+ :: BatchAnnotateImagesResponse
1618+batchAnnotateImagesResponse =
1619+ BatchAnnotateImagesResponse
1620+ { _bairResponses = Nothing
1621+ }
1622+
1623+-- | Individual responses to image annotation requests within the batch.
1624+bairResponses :: Lens' BatchAnnotateImagesResponse [AnnotateImageResponse]
1625+bairResponses
1626+ = lens _bairResponses
1627+ (\ s a -> s{_bairResponses = a})
1628+ . _Default
1629+ . _Coerce
1630+
1631+instance FromJSON BatchAnnotateImagesResponse where
1632+ parseJSON
1633+ = withObject "BatchAnnotateImagesResponse"
1634+ (\ o ->
1635+ BatchAnnotateImagesResponse <$>
1636+ (o .:? "responses" .!= mempty))
1637+
1638+instance ToJSON BatchAnnotateImagesResponse where
1639+ toJSON BatchAnnotateImagesResponse{..}
1640+ = object
1641+ (catMaybes [("responses" .=) <$> _bairResponses])
1642+
1643+-- | A 3D position in the image, used primarily for Face detection landmarks.
1644+-- A valid Position must have both x and y coordinates. The position
1645+-- coordinates are in the same scale as the original image.
1646+--
1647+-- /See:/ 'position' smart constructor.
1648+data Position = Position
1649+ { _pZ :: !(Maybe (Textual Double))
1650+ , _pX :: !(Maybe (Textual Double))
1651+ , _pY :: !(Maybe (Textual Double))
1652+ } deriving (Eq,Show,Data,Typeable,Generic)
1653+
1654+-- | Creates a value of 'Position' with the minimum fields required to make a request.
1655+--
1656+-- Use one of the following lenses to modify other fields as desired:
1657+--
1658+-- * 'pZ'
1659+--
1660+-- * 'pX'
1661+--
1662+-- * 'pY'
1663+position
1664+ :: Position
1665+position =
1666+ Position
1667+ { _pZ = Nothing
1668+ , _pX = Nothing
1669+ , _pY = Nothing
1670+ }
1671+
1672+-- | Z coordinate (or depth).
1673+pZ :: Lens' Position (Maybe Double)
1674+pZ = lens _pZ (\ s a -> s{_pZ = a}) . mapping _Coerce
1675+
1676+-- | X coordinate.
1677+pX :: Lens' Position (Maybe Double)
1678+pX = lens _pX (\ s a -> s{_pX = a}) . mapping _Coerce
1679+
1680+-- | Y coordinate.
1681+pY :: Lens' Position (Maybe Double)
1682+pY = lens _pY (\ s a -> s{_pY = a}) . mapping _Coerce
1683+
1684+instance FromJSON Position where
1685+ parseJSON
1686+ = withObject "Position"
1687+ (\ o ->
1688+ Position <$>
1689+ (o .:? "z") <*> (o .:? "x") <*> (o .:? "y"))
1690+
1691+instance ToJSON Position where
1692+ toJSON Position{..}
1693+ = object
1694+ (catMaybes
1695+ [("z" .=) <$> _pZ, ("x" .=) <$> _pX,
1696+ ("y" .=) <$> _pY])