{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
module Network.Google.StreetViewPublish.Types.Product where
import Network.Google.Prelude
import Network.Google.StreetViewPublish.Types.Sum
data LatLng =
LatLng'
{ _llLatitude :: !(Maybe (Textual Double))
, _llLongitude :: !(Maybe (Textual Double))
}
deriving (Eq, Show, Data, Typeable, Generic)
latLng
:: LatLng
latLng = LatLng' {_llLatitude = Nothing, _llLongitude = Nothing}
llLatitude :: Lens' LatLng (Maybe Double)
llLatitude
= lens _llLatitude (\ s a -> s{_llLatitude = a}) .
mapping _Coerce
llLongitude :: Lens' LatLng (Maybe Double)
llLongitude
= lens _llLongitude (\ s a -> s{_llLongitude = a}) .
mapping _Coerce
instance FromJSON LatLng where
parseJSON
= withObject "LatLng"
(\ o ->
LatLng' <$>
(o .:? "latitude") <*> (o .:? "longitude"))
instance ToJSON LatLng where
toJSON LatLng'{..}
= object
(catMaybes
[("latitude" .=) <$> _llLatitude,
("longitude" .=) <$> _llLongitude])
data Photo =
Photo'
{ _pThumbnailURL :: !(Maybe Text)
, _pMapsPublishStatus :: !(Maybe PhotoMapsPublishStatus)
, _pConnections :: !(Maybe [Connection])
, _pShareLink :: !(Maybe Text)
, _pUploadReference :: !(Maybe UploadRef)
, _pCaptureTime :: !(Maybe DateTime')
, _pPose :: !(Maybe Pose)
, _pDownloadURL :: !(Maybe Text)
, _pTransferStatus :: !(Maybe PhotoTransferStatus)
, _pPlaces :: !(Maybe [Place])
, _pViewCount :: !(Maybe (Textual Int64))
, _pPhotoId :: !(Maybe PhotoId)
}
deriving (Eq, Show, Data, Typeable, Generic)
photo
:: Photo
photo =
Photo'
{ _pThumbnailURL = Nothing
, _pMapsPublishStatus = Nothing
, _pConnections = Nothing
, _pShareLink = Nothing
, _pUploadReference = Nothing
, _pCaptureTime = Nothing
, _pPose = Nothing
, _pDownloadURL = Nothing
, _pTransferStatus = Nothing
, _pPlaces = Nothing
, _pViewCount = Nothing
, _pPhotoId = Nothing
}
pThumbnailURL :: Lens' Photo (Maybe Text)
pThumbnailURL
= lens _pThumbnailURL
(\ s a -> s{_pThumbnailURL = a})
pMapsPublishStatus :: Lens' Photo (Maybe PhotoMapsPublishStatus)
pMapsPublishStatus
= lens _pMapsPublishStatus
(\ s a -> s{_pMapsPublishStatus = a})
pConnections :: Lens' Photo [Connection]
pConnections
= lens _pConnections (\ s a -> s{_pConnections = a})
. _Default
. _Coerce
pShareLink :: Lens' Photo (Maybe Text)
pShareLink
= lens _pShareLink (\ s a -> s{_pShareLink = a})
pUploadReference :: Lens' Photo (Maybe UploadRef)
pUploadReference
= lens _pUploadReference
(\ s a -> s{_pUploadReference = a})
pCaptureTime :: Lens' Photo (Maybe UTCTime)
pCaptureTime
= lens _pCaptureTime (\ s a -> s{_pCaptureTime = a})
. mapping _DateTime
pPose :: Lens' Photo (Maybe Pose)
pPose = lens _pPose (\ s a -> s{_pPose = a})
pDownloadURL :: Lens' Photo (Maybe Text)
pDownloadURL
= lens _pDownloadURL (\ s a -> s{_pDownloadURL = a})
pTransferStatus :: Lens' Photo (Maybe PhotoTransferStatus)
pTransferStatus
= lens _pTransferStatus
(\ s a -> s{_pTransferStatus = a})
pPlaces :: Lens' Photo [Place]
pPlaces
= lens _pPlaces (\ s a -> s{_pPlaces = a}) . _Default
. _Coerce
pViewCount :: Lens' Photo (Maybe Int64)
pViewCount
= lens _pViewCount (\ s a -> s{_pViewCount = a}) .
mapping _Coerce
pPhotoId :: Lens' Photo (Maybe PhotoId)
pPhotoId = lens _pPhotoId (\ s a -> s{_pPhotoId = a})
instance FromJSON Photo where
parseJSON
= withObject "Photo"
(\ o ->
Photo' <$>
(o .:? "thumbnailUrl") <*>
(o .:? "mapsPublishStatus")
<*> (o .:? "connections" .!= mempty)
<*> (o .:? "shareLink")
<*> (o .:? "uploadReference")
<*> (o .:? "captureTime")
<*> (o .:? "pose")
<*> (o .:? "downloadUrl")
<*> (o .:? "transferStatus")
<*> (o .:? "places" .!= mempty)
<*> (o .:? "viewCount")
<*> (o .:? "photoId"))
instance ToJSON Photo where
toJSON Photo'{..}
= object
(catMaybes
[("thumbnailUrl" .=) <$> _pThumbnailURL,
("mapsPublishStatus" .=) <$> _pMapsPublishStatus,
("connections" .=) <$> _pConnections,
("shareLink" .=) <$> _pShareLink,
("uploadReference" .=) <$> _pUploadReference,
("captureTime" .=) <$> _pCaptureTime,
("pose" .=) <$> _pPose,
("downloadUrl" .=) <$> _pDownloadURL,
("transferStatus" .=) <$> _pTransferStatus,
("places" .=) <$> _pPlaces,
("viewCount" .=) <$> _pViewCount,
("photoId" .=) <$> _pPhotoId])
data UpdatePhotoRequest =
UpdatePhotoRequest'
{ _uprPhoto :: !(Maybe Photo)
, _uprUpdateMask :: !(Maybe GFieldMask)
}
deriving (Eq, Show, Data, Typeable, Generic)
updatePhotoRequest
:: UpdatePhotoRequest
updatePhotoRequest =
UpdatePhotoRequest' {_uprPhoto = Nothing, _uprUpdateMask = Nothing}
uprPhoto :: Lens' UpdatePhotoRequest (Maybe Photo)
uprPhoto = lens _uprPhoto (\ s a -> s{_uprPhoto = a})
uprUpdateMask :: Lens' UpdatePhotoRequest (Maybe GFieldMask)
uprUpdateMask
= lens _uprUpdateMask
(\ s a -> s{_uprUpdateMask = a})
instance FromJSON UpdatePhotoRequest where
parseJSON
= withObject "UpdatePhotoRequest"
(\ o ->
UpdatePhotoRequest' <$>
(o .:? "photo") <*> (o .:? "updateMask"))
instance ToJSON UpdatePhotoRequest where
toJSON UpdatePhotoRequest'{..}
= object
(catMaybes
[("photo" .=) <$> _uprPhoto,
("updateMask" .=) <$> _uprUpdateMask])
data Status =
Status'
{ _sDetails :: !(Maybe [StatusDetailsItem])
, _sCode :: !(Maybe (Textual Int32))
, _sMessage :: !(Maybe Text)
}
deriving (Eq, Show, Data, Typeable, Generic)
status
:: Status
status = Status' {_sDetails = Nothing, _sCode = Nothing, _sMessage = Nothing}
sDetails :: Lens' Status [StatusDetailsItem]
sDetails
= lens _sDetails (\ s a -> s{_sDetails = a}) .
_Default
. _Coerce
sCode :: Lens' Status (Maybe Int32)
sCode
= lens _sCode (\ s a -> s{_sCode = a}) .
mapping _Coerce
sMessage :: Lens' Status (Maybe Text)
sMessage = lens _sMessage (\ s a -> s{_sMessage = a})
instance FromJSON Status where
parseJSON
= withObject "Status"
(\ o ->
Status' <$>
(o .:? "details" .!= mempty) <*> (o .:? "code") <*>
(o .:? "message"))
instance ToJSON Status where
toJSON Status'{..}
= object
(catMaybes
[("details" .=) <$> _sDetails,
("code" .=) <$> _sCode,
("message" .=) <$> _sMessage])
data PhotoResponse =
PhotoResponse'
{ _prPhoto :: !(Maybe Photo)
, _prStatus :: !(Maybe Status)
}
deriving (Eq, Show, Data, Typeable, Generic)
photoResponse
:: PhotoResponse
photoResponse = PhotoResponse' {_prPhoto = Nothing, _prStatus = Nothing}
prPhoto :: Lens' PhotoResponse (Maybe Photo)
prPhoto = lens _prPhoto (\ s a -> s{_prPhoto = a})
prStatus :: Lens' PhotoResponse (Maybe Status)
prStatus = lens _prStatus (\ s a -> s{_prStatus = a})
instance FromJSON PhotoResponse where
parseJSON
= withObject "PhotoResponse"
(\ o ->
PhotoResponse' <$>
(o .:? "photo") <*> (o .:? "status"))
instance ToJSON PhotoResponse where
toJSON PhotoResponse'{..}
= object
(catMaybes
[("photo" .=) <$> _prPhoto,
("status" .=) <$> _prStatus])
data Operation =
Operation'
{ _oDone :: !(Maybe Bool)
, _oError :: !(Maybe Status)
, _oResponse :: !(Maybe OperationResponse)
, _oName :: !(Maybe Text)
, _oMetadata :: !(Maybe OperationMetadata)
}
deriving (Eq, Show, Data, Typeable, Generic)
operation
:: Operation
operation =
Operation'
{ _oDone = Nothing
, _oError = Nothing
, _oResponse = Nothing
, _oName = Nothing
, _oMetadata = Nothing
}
oDone :: Lens' Operation (Maybe Bool)
oDone = lens _oDone (\ s a -> s{_oDone = a})
oError :: Lens' Operation (Maybe Status)
oError = lens _oError (\ s a -> s{_oError = a})
oResponse :: Lens' Operation (Maybe OperationResponse)
oResponse
= lens _oResponse (\ s a -> s{_oResponse = a})
oName :: Lens' Operation (Maybe Text)
oName = lens _oName (\ s a -> s{_oName = a})
oMetadata :: Lens' Operation (Maybe OperationMetadata)
oMetadata
= lens _oMetadata (\ s a -> s{_oMetadata = a})
instance FromJSON Operation where
parseJSON
= withObject "Operation"
(\ o ->
Operation' <$>
(o .:? "done") <*> (o .:? "error") <*>
(o .:? "response")
<*> (o .:? "name")
<*> (o .:? "metadata"))
instance ToJSON Operation where
toJSON Operation'{..}
= object
(catMaybes
[("done" .=) <$> _oDone, ("error" .=) <$> _oError,
("response" .=) <$> _oResponse,
("name" .=) <$> _oName,
("metadata" .=) <$> _oMetadata])
data Empty =
Empty'
deriving (Eq, Show, Data, Typeable, Generic)
empty
:: Empty
empty = Empty'
instance FromJSON Empty where
parseJSON = withObject "Empty" (\ o -> pure Empty')
instance ToJSON Empty where
toJSON = const emptyObject
newtype StatusDetailsItem =
StatusDetailsItem'
{ _sdiAddtional :: HashMap Text JSONValue
}
deriving (Eq, Show, Data, Typeable, Generic)
statusDetailsItem
:: HashMap Text JSONValue
-> StatusDetailsItem
statusDetailsItem pSdiAddtional_ =
StatusDetailsItem' {_sdiAddtional = _Coerce # pSdiAddtional_}
sdiAddtional :: Lens' StatusDetailsItem (HashMap Text JSONValue)
sdiAddtional
= lens _sdiAddtional (\ s a -> s{_sdiAddtional = a})
. _Coerce
instance FromJSON StatusDetailsItem where
parseJSON
= withObject "StatusDetailsItem"
(\ o -> StatusDetailsItem' <$> (parseJSONObject o))
instance ToJSON StatusDetailsItem where
toJSON = toJSON . _sdiAddtional
data ListPhotosResponse =
ListPhotosResponse'
{ _lprNextPageToken :: !(Maybe Text)
, _lprPhotos :: !(Maybe [Photo])
}
deriving (Eq, Show, Data, Typeable, Generic)
listPhotosResponse
:: ListPhotosResponse
listPhotosResponse =
ListPhotosResponse' {_lprNextPageToken = Nothing, _lprPhotos = Nothing}
lprNextPageToken :: Lens' ListPhotosResponse (Maybe Text)
lprNextPageToken
= lens _lprNextPageToken
(\ s a -> s{_lprNextPageToken = a})
lprPhotos :: Lens' ListPhotosResponse [Photo]
lprPhotos
= lens _lprPhotos (\ s a -> s{_lprPhotos = a}) .
_Default
. _Coerce
instance FromJSON ListPhotosResponse where
parseJSON
= withObject "ListPhotosResponse"
(\ o ->
ListPhotosResponse' <$>
(o .:? "nextPageToken") <*>
(o .:? "photos" .!= mempty))
instance ToJSON ListPhotosResponse where
toJSON ListPhotosResponse'{..}
= object
(catMaybes
[("nextPageToken" .=) <$> _lprNextPageToken,
("photos" .=) <$> _lprPhotos])
newtype Connection =
Connection'
{ _cTarget :: Maybe PhotoId
}
deriving (Eq, Show, Data, Typeable, Generic)
connection
:: Connection
connection = Connection' {_cTarget = Nothing}
cTarget :: Lens' Connection (Maybe PhotoId)
cTarget = lens _cTarget (\ s a -> s{_cTarget = a})
instance FromJSON Connection where
parseJSON
= withObject "Connection"
(\ o -> Connection' <$> (o .:? "target"))
instance ToJSON Connection where
toJSON Connection'{..}
= object (catMaybes [("target" .=) <$> _cTarget])
newtype BatchUpdatePhotosResponse =
BatchUpdatePhotosResponse'
{ _buprResults :: Maybe [PhotoResponse]
}
deriving (Eq, Show, Data, Typeable, Generic)
batchUpdatePhotosResponse
:: BatchUpdatePhotosResponse
batchUpdatePhotosResponse = BatchUpdatePhotosResponse' {_buprResults = Nothing}
buprResults :: Lens' BatchUpdatePhotosResponse [PhotoResponse]
buprResults
= lens _buprResults (\ s a -> s{_buprResults = a}) .
_Default
. _Coerce
instance FromJSON BatchUpdatePhotosResponse where
parseJSON
= withObject "BatchUpdatePhotosResponse"
(\ o ->
BatchUpdatePhotosResponse' <$>
(o .:? "results" .!= mempty))
instance ToJSON BatchUpdatePhotosResponse where
toJSON BatchUpdatePhotosResponse'{..}
= object
(catMaybes [("results" .=) <$> _buprResults])
newtype BatchDeletePhotosResponse =
BatchDeletePhotosResponse'
{ _bdprStatus :: Maybe [Status]
}
deriving (Eq, Show, Data, Typeable, Generic)
batchDeletePhotosResponse
:: BatchDeletePhotosResponse
batchDeletePhotosResponse = BatchDeletePhotosResponse' {_bdprStatus = Nothing}
bdprStatus :: Lens' BatchDeletePhotosResponse [Status]
bdprStatus
= lens _bdprStatus (\ s a -> s{_bdprStatus = a}) .
_Default
. _Coerce
instance FromJSON BatchDeletePhotosResponse where
parseJSON
= withObject "BatchDeletePhotosResponse"
(\ o ->
BatchDeletePhotosResponse' <$>
(o .:? "status" .!= mempty))
instance ToJSON BatchDeletePhotosResponse where
toJSON BatchDeletePhotosResponse'{..}
= object (catMaybes [("status" .=) <$> _bdprStatus])
data Pose =
Pose'
{ _pRoll :: !(Maybe (Textual Double))
, _pHeading :: !(Maybe (Textual Double))
, _pLatLngPair :: !(Maybe LatLng)
, _pAccuracyMeters :: !(Maybe (Textual Double))
, _pAltitude :: !(Maybe (Textual Double))
, _pLevel :: !(Maybe Level)
, _pPitch :: !(Maybe (Textual Double))
}
deriving (Eq, Show, Data, Typeable, Generic)
pose
:: Pose
pose =
Pose'
{ _pRoll = Nothing
, _pHeading = Nothing
, _pLatLngPair = Nothing
, _pAccuracyMeters = Nothing
, _pAltitude = Nothing
, _pLevel = Nothing
, _pPitch = Nothing
}
pRoll :: Lens' Pose (Maybe Double)
pRoll
= lens _pRoll (\ s a -> s{_pRoll = a}) .
mapping _Coerce
pHeading :: Lens' Pose (Maybe Double)
pHeading
= lens _pHeading (\ s a -> s{_pHeading = a}) .
mapping _Coerce
pLatLngPair :: Lens' Pose (Maybe LatLng)
pLatLngPair
= lens _pLatLngPair (\ s a -> s{_pLatLngPair = a})
pAccuracyMeters :: Lens' Pose (Maybe Double)
pAccuracyMeters
= lens _pAccuracyMeters
(\ s a -> s{_pAccuracyMeters = a})
. mapping _Coerce
pAltitude :: Lens' Pose (Maybe Double)
pAltitude
= lens _pAltitude (\ s a -> s{_pAltitude = a}) .
mapping _Coerce
pLevel :: Lens' Pose (Maybe Level)
pLevel = lens _pLevel (\ s a -> s{_pLevel = a})
pPitch :: Lens' Pose (Maybe Double)
pPitch
= lens _pPitch (\ s a -> s{_pPitch = a}) .
mapping _Coerce
instance FromJSON Pose where
parseJSON
= withObject "Pose"
(\ o ->
Pose' <$>
(o .:? "roll") <*> (o .:? "heading") <*>
(o .:? "latLngPair")
<*> (o .:? "accuracyMeters")
<*> (o .:? "altitude")
<*> (o .:? "level")
<*> (o .:? "pitch"))
instance ToJSON Pose where
toJSON Pose'{..}
= object
(catMaybes
[("roll" .=) <$> _pRoll,
("heading" .=) <$> _pHeading,
("latLngPair" .=) <$> _pLatLngPair,
("accuracyMeters" .=) <$> _pAccuracyMeters,
("altitude" .=) <$> _pAltitude,
("level" .=) <$> _pLevel, ("pitch" .=) <$> _pPitch])
newtype UploadRef =
UploadRef'
{ _urUploadURL :: Maybe Text
}
deriving (Eq, Show, Data, Typeable, Generic)
uploadRef
:: UploadRef
uploadRef = UploadRef' {_urUploadURL = Nothing}
urUploadURL :: Lens' UploadRef (Maybe Text)
urUploadURL
= lens _urUploadURL (\ s a -> s{_urUploadURL = a})
instance FromJSON UploadRef where
parseJSON
= withObject "UploadRef"
(\ o -> UploadRef' <$> (o .:? "uploadUrl"))
instance ToJSON UploadRef where
toJSON UploadRef'{..}
= object
(catMaybes [("uploadUrl" .=) <$> _urUploadURL])
newtype OperationMetadata =
OperationMetadata'
{ _omAddtional :: HashMap Text JSONValue
}
deriving (Eq, Show, Data, Typeable, Generic)
operationMetadata
:: HashMap Text JSONValue
-> OperationMetadata
operationMetadata pOmAddtional_ =
OperationMetadata' {_omAddtional = _Coerce # pOmAddtional_}
omAddtional :: Lens' OperationMetadata (HashMap Text JSONValue)
omAddtional
= lens _omAddtional (\ s a -> s{_omAddtional = a}) .
_Coerce
instance FromJSON OperationMetadata where
parseJSON
= withObject "OperationMetadata"
(\ o -> OperationMetadata' <$> (parseJSONObject o))
instance ToJSON OperationMetadata where
toJSON = toJSON . _omAddtional
newtype BatchUpdatePhotosRequest =
BatchUpdatePhotosRequest'
{ _buprUpdatePhotoRequests :: Maybe [UpdatePhotoRequest]
}
deriving (Eq, Show, Data, Typeable, Generic)
batchUpdatePhotosRequest
:: BatchUpdatePhotosRequest
batchUpdatePhotosRequest =
BatchUpdatePhotosRequest' {_buprUpdatePhotoRequests = Nothing}
buprUpdatePhotoRequests :: Lens' BatchUpdatePhotosRequest [UpdatePhotoRequest]
buprUpdatePhotoRequests
= lens _buprUpdatePhotoRequests
(\ s a -> s{_buprUpdatePhotoRequests = a})
. _Default
. _Coerce
instance FromJSON BatchUpdatePhotosRequest where
parseJSON
= withObject "BatchUpdatePhotosRequest"
(\ o ->
BatchUpdatePhotosRequest' <$>
(o .:? "updatePhotoRequests" .!= mempty))
instance ToJSON BatchUpdatePhotosRequest where
toJSON BatchUpdatePhotosRequest'{..}
= object
(catMaybes
[("updatePhotoRequests" .=) <$>
_buprUpdatePhotoRequests])
newtype BatchDeletePhotosRequest =
BatchDeletePhotosRequest'
{ _bdprPhotoIds :: Maybe [Text]
}
deriving (Eq, Show, Data, Typeable, Generic)
batchDeletePhotosRequest
:: BatchDeletePhotosRequest
batchDeletePhotosRequest = BatchDeletePhotosRequest' {_bdprPhotoIds = Nothing}
bdprPhotoIds :: Lens' BatchDeletePhotosRequest [Text]
bdprPhotoIds
= lens _bdprPhotoIds (\ s a -> s{_bdprPhotoIds = a})
. _Default
. _Coerce
instance FromJSON BatchDeletePhotosRequest where
parseJSON
= withObject "BatchDeletePhotosRequest"
(\ o ->
BatchDeletePhotosRequest' <$>
(o .:? "photoIds" .!= mempty))
instance ToJSON BatchDeletePhotosRequest where
toJSON BatchDeletePhotosRequest'{..}
= object
(catMaybes [("photoIds" .=) <$> _bdprPhotoIds])
data Place =
Place'
{ _pLanguageCode :: !(Maybe Text)
, _pName :: !(Maybe Text)
, _pPlaceId :: !(Maybe Text)
}
deriving (Eq, Show, Data, Typeable, Generic)
place
:: Place
place = Place' {_pLanguageCode = Nothing, _pName = Nothing, _pPlaceId = Nothing}
pLanguageCode :: Lens' Place (Maybe Text)
pLanguageCode
= lens _pLanguageCode
(\ s a -> s{_pLanguageCode = a})
pName :: Lens' Place (Maybe Text)
pName = lens _pName (\ s a -> s{_pName = a})
pPlaceId :: Lens' Place (Maybe Text)
pPlaceId = lens _pPlaceId (\ s a -> s{_pPlaceId = a})
instance FromJSON Place where
parseJSON
= withObject "Place"
(\ o ->
Place' <$>
(o .:? "languageCode") <*> (o .:? "name") <*>
(o .:? "placeId"))
instance ToJSON Place where
toJSON Place'{..}
= object
(catMaybes
[("languageCode" .=) <$> _pLanguageCode,
("name" .=) <$> _pName,
("placeId" .=) <$> _pPlaceId])
data Level =
Level'
{ _lName :: !(Maybe Text)
, _lNumber :: !(Maybe (Textual Double))
}
deriving (Eq, Show, Data, Typeable, Generic)
level
:: Level
level = Level' {_lName = Nothing, _lNumber = Nothing}
lName :: Lens' Level (Maybe Text)
lName = lens _lName (\ s a -> s{_lName = a})
lNumber :: Lens' Level (Maybe Double)
lNumber
= lens _lNumber (\ s a -> s{_lNumber = a}) .
mapping _Coerce
instance FromJSON Level where
parseJSON
= withObject "Level"
(\ o ->
Level' <$> (o .:? "name") <*> (o .:? "number"))
instance ToJSON Level where
toJSON Level'{..}
= object
(catMaybes
[("name" .=) <$> _lName, ("number" .=) <$> _lNumber])
newtype OperationResponse =
OperationResponse'
{ _orAddtional :: HashMap Text JSONValue
}
deriving (Eq, Show, Data, Typeable, Generic)
operationResponse
:: HashMap Text JSONValue
-> OperationResponse
operationResponse pOrAddtional_ =
OperationResponse' {_orAddtional = _Coerce # pOrAddtional_}
orAddtional :: Lens' OperationResponse (HashMap Text JSONValue)
orAddtional
= lens _orAddtional (\ s a -> s{_orAddtional = a}) .
_Coerce
instance FromJSON OperationResponse where
parseJSON
= withObject "OperationResponse"
(\ o -> OperationResponse' <$> (parseJSONObject o))
instance ToJSON OperationResponse where
toJSON = toJSON . _orAddtional
newtype BatchGetPhotosResponse =
BatchGetPhotosResponse'
{ _bgprResults :: Maybe [PhotoResponse]
}
deriving (Eq, Show, Data, Typeable, Generic)
batchGetPhotosResponse
:: BatchGetPhotosResponse
batchGetPhotosResponse = BatchGetPhotosResponse' {_bgprResults = Nothing}
bgprResults :: Lens' BatchGetPhotosResponse [PhotoResponse]
bgprResults
= lens _bgprResults (\ s a -> s{_bgprResults = a}) .
_Default
. _Coerce
instance FromJSON BatchGetPhotosResponse where
parseJSON
= withObject "BatchGetPhotosResponse"
(\ o ->
BatchGetPhotosResponse' <$>
(o .:? "results" .!= mempty))
instance ToJSON BatchGetPhotosResponse where
toJSON BatchGetPhotosResponse'{..}
= object
(catMaybes [("results" .=) <$> _bgprResults])
newtype PhotoId =
PhotoId'
{ _piId :: Maybe Text
}
deriving (Eq, Show, Data, Typeable, Generic)
photoId
:: PhotoId
photoId = PhotoId' {_piId = Nothing}
piId :: Lens' PhotoId (Maybe Text)
piId = lens _piId (\ s a -> s{_piId = a})
instance FromJSON PhotoId where
parseJSON
= withObject "PhotoId"
(\ o -> PhotoId' <$> (o .:? "id"))
instance ToJSON PhotoId where
toJSON PhotoId'{..}
= object (catMaybes [("id" .=) <$> _piId])