{-# 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.Manufacturers.Types.Product where
import Network.Google.Manufacturers.Types.Sum
import Network.Google.Prelude
data Image = Image'
{ _iStatus :: !(Maybe ImageStatus)
, _iImageURL :: !(Maybe Text)
, _iType :: !(Maybe ImageType)
} deriving (Eq,Show,Data,Typeable,Generic)
image
:: Image
image =
Image'
{ _iStatus = Nothing
, _iImageURL = Nothing
, _iType = Nothing
}
iStatus :: Lens' Image (Maybe ImageStatus)
iStatus = lens _iStatus (\ s a -> s{_iStatus = a})
iImageURL :: Lens' Image (Maybe Text)
iImageURL
= lens _iImageURL (\ s a -> s{_iImageURL = a})
iType :: Lens' Image (Maybe ImageType)
iType = lens _iType (\ s a -> s{_iType = a})
instance FromJSON Image where
parseJSON
= withObject "Image"
(\ o ->
Image' <$>
(o .:? "status") <*> (o .:? "imageUrl") <*>
(o .:? "type"))
instance ToJSON Image where
toJSON Image'{..}
= object
(catMaybes
[("status" .=) <$> _iStatus,
("imageUrl" .=) <$> _iImageURL,
("type" .=) <$> _iType])
data FeatureDescription = FeatureDescription'
{ _fdImage :: !(Maybe Image)
, _fdText :: !(Maybe Text)
, _fdHeadline :: !(Maybe Text)
} deriving (Eq,Show,Data,Typeable,Generic)
featureDescription
:: FeatureDescription
featureDescription =
FeatureDescription'
{ _fdImage = Nothing
, _fdText = Nothing
, _fdHeadline = Nothing
}
fdImage :: Lens' FeatureDescription (Maybe Image)
fdImage = lens _fdImage (\ s a -> s{_fdImage = a})
fdText :: Lens' FeatureDescription (Maybe Text)
fdText = lens _fdText (\ s a -> s{_fdText = a})
fdHeadline :: Lens' FeatureDescription (Maybe Text)
fdHeadline
= lens _fdHeadline (\ s a -> s{_fdHeadline = a})
instance FromJSON FeatureDescription where
parseJSON
= withObject "FeatureDescription"
(\ o ->
FeatureDescription' <$>
(o .:? "image") <*> (o .:? "text") <*>
(o .:? "headline"))
instance ToJSON FeatureDescription where
toJSON FeatureDescription'{..}
= object
(catMaybes
[("image" .=) <$> _fdImage, ("text" .=) <$> _fdText,
("headline" .=) <$> _fdHeadline])
data ProductDetail = ProductDetail'
{ _pdAttributeValue :: !(Maybe Text)
, _pdAttributeName :: !(Maybe Text)
, _pdSectionName :: !(Maybe Text)
} deriving (Eq,Show,Data,Typeable,Generic)
productDetail
:: ProductDetail
productDetail =
ProductDetail'
{ _pdAttributeValue = Nothing
, _pdAttributeName = Nothing
, _pdSectionName = Nothing
}
pdAttributeValue :: Lens' ProductDetail (Maybe Text)
pdAttributeValue
= lens _pdAttributeValue
(\ s a -> s{_pdAttributeValue = a})
pdAttributeName :: Lens' ProductDetail (Maybe Text)
pdAttributeName
= lens _pdAttributeName
(\ s a -> s{_pdAttributeName = a})
pdSectionName :: Lens' ProductDetail (Maybe Text)
pdSectionName
= lens _pdSectionName
(\ s a -> s{_pdSectionName = a})
instance FromJSON ProductDetail where
parseJSON
= withObject "ProductDetail"
(\ o ->
ProductDetail' <$>
(o .:? "attributeValue") <*> (o .:? "attributeName")
<*> (o .:? "sectionName"))
instance ToJSON ProductDetail where
toJSON ProductDetail'{..}
= object
(catMaybes
[("attributeValue" .=) <$> _pdAttributeValue,
("attributeName" .=) <$> _pdAttributeName,
("sectionName" .=) <$> _pdSectionName])
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
data DestinationStatus = DestinationStatus'
{ _dsDestination :: !(Maybe Text)
, _dsStatus :: !(Maybe DestinationStatusStatus)
} deriving (Eq,Show,Data,Typeable,Generic)
destinationStatus
:: DestinationStatus
destinationStatus =
DestinationStatus'
{ _dsDestination = Nothing
, _dsStatus = Nothing
}
dsDestination :: Lens' DestinationStatus (Maybe Text)
dsDestination
= lens _dsDestination
(\ s a -> s{_dsDestination = a})
dsStatus :: Lens' DestinationStatus (Maybe DestinationStatusStatus)
dsStatus = lens _dsStatus (\ s a -> s{_dsStatus = a})
instance FromJSON DestinationStatus where
parseJSON
= withObject "DestinationStatus"
(\ o ->
DestinationStatus' <$>
(o .:? "destination") <*> (o .:? "status"))
instance ToJSON DestinationStatus where
toJSON DestinationStatus'{..}
= object
(catMaybes
[("destination" .=) <$> _dsDestination,
("status" .=) <$> _dsStatus])
data Count = Count'
{ _cValue :: !(Maybe (Textual Int64))
, _cUnit :: !(Maybe Text)
} deriving (Eq,Show,Data,Typeable,Generic)
count
:: Count
count =
Count'
{ _cValue = Nothing
, _cUnit = Nothing
}
cValue :: Lens' Count (Maybe Int64)
cValue
= lens _cValue (\ s a -> s{_cValue = a}) .
mapping _Coerce
cUnit :: Lens' Count (Maybe Text)
cUnit = lens _cUnit (\ s a -> s{_cUnit = a})
instance FromJSON Count where
parseJSON
= withObject "Count"
(\ o ->
Count' <$> (o .:? "value") <*> (o .:? "unit"))
instance ToJSON Count where
toJSON Count'{..}
= object
(catMaybes
[("value" .=) <$> _cValue, ("unit" .=) <$> _cUnit])
data Capacity = Capacity'
{ _capValue :: !(Maybe (Textual Int64))
, _capUnit :: !(Maybe Text)
} deriving (Eq,Show,Data,Typeable,Generic)
capacity
:: Capacity
capacity =
Capacity'
{ _capValue = Nothing
, _capUnit = Nothing
}
capValue :: Lens' Capacity (Maybe Int64)
capValue
= lens _capValue (\ s a -> s{_capValue = a}) .
mapping _Coerce
capUnit :: Lens' Capacity (Maybe Text)
capUnit = lens _capUnit (\ s a -> s{_capUnit = a})
instance FromJSON Capacity where
parseJSON
= withObject "Capacity"
(\ o ->
Capacity' <$> (o .:? "value") <*> (o .:? "unit"))
instance ToJSON Capacity where
toJSON Capacity'{..}
= object
(catMaybes
[("value" .=) <$> _capValue,
("unit" .=) <$> _capUnit])
data Attributes = Attributes'
{ _aProductName :: !(Maybe Text)
, _aScent :: !(Maybe Text)
, _aImageLink :: !(Maybe Image)
, _aFeatureDescription :: !(Maybe [FeatureDescription])
, _aProductDetail :: !(Maybe [ProductDetail])
, _aProductLine :: !(Maybe Text)
, _aColor :: !(Maybe Text)
, _aSize :: !(Maybe Text)
, _aFlavor :: !(Maybe Text)
, _aPattern :: !(Maybe Text)
, _aSizeSystem :: !(Maybe Text)
, _aMaterial :: !(Maybe Text)
, _aFormat :: !(Maybe Text)
, _aProductType :: !(Maybe [Text])
, _aCount :: !(Maybe Count)
, _aDisclosureDate :: !(Maybe Text)
, _aBrand :: !(Maybe Text)
, _aAdditionalImageLink :: !(Maybe [Image])
, _aExcludedDestination :: !(Maybe [Text])
, _aVideoLink :: !(Maybe [Text])
, _aCapacity :: !(Maybe Capacity)
, _aGtin :: !(Maybe [Text])
, _aAgeGroup :: !(Maybe Text)
, _aIncludedDestination :: !(Maybe [Text])
, _aGender :: !(Maybe Text)
, _aSuggestedRetailPrice :: !(Maybe Price)
, _aItemGroupId :: !(Maybe Text)
, _aTargetClientId :: !(Maybe Text)
, _aSizeType :: !(Maybe Text)
, _aReleaseDate :: !(Maybe Text)
, _aTitle :: !(Maybe Text)
, _aMpn :: !(Maybe Text)
, _aProductPageURL :: !(Maybe Text)
, _aDescription :: !(Maybe Text)
, _aTheme :: !(Maybe Text)
} deriving (Eq,Show,Data,Typeable,Generic)
attributes
:: Attributes
attributes =
Attributes'
{ _aProductName = Nothing
, _aScent = Nothing
, _aImageLink = Nothing
, _aFeatureDescription = Nothing
, _aProductDetail = Nothing
, _aProductLine = Nothing
, _aColor = Nothing
, _aSize = Nothing
, _aFlavor = Nothing
, _aPattern = Nothing
, _aSizeSystem = Nothing
, _aMaterial = Nothing
, _aFormat = Nothing
, _aProductType = Nothing
, _aCount = Nothing
, _aDisclosureDate = Nothing
, _aBrand = Nothing
, _aAdditionalImageLink = Nothing
, _aExcludedDestination = Nothing
, _aVideoLink = Nothing
, _aCapacity = Nothing
, _aGtin = Nothing
, _aAgeGroup = Nothing
, _aIncludedDestination = Nothing
, _aGender = Nothing
, _aSuggestedRetailPrice = Nothing
, _aItemGroupId = Nothing
, _aTargetClientId = Nothing
, _aSizeType = Nothing
, _aReleaseDate = Nothing
, _aTitle = Nothing
, _aMpn = Nothing
, _aProductPageURL = Nothing
, _aDescription = Nothing
, _aTheme = Nothing
}
aProductName :: Lens' Attributes (Maybe Text)
aProductName
= lens _aProductName (\ s a -> s{_aProductName = a})
aScent :: Lens' Attributes (Maybe Text)
aScent = lens _aScent (\ s a -> s{_aScent = a})
aImageLink :: Lens' Attributes (Maybe Image)
aImageLink
= lens _aImageLink (\ s a -> s{_aImageLink = a})
aFeatureDescription :: Lens' Attributes [FeatureDescription]
aFeatureDescription
= lens _aFeatureDescription
(\ s a -> s{_aFeatureDescription = a})
. _Default
. _Coerce
aProductDetail :: Lens' Attributes [ProductDetail]
aProductDetail
= lens _aProductDetail
(\ s a -> s{_aProductDetail = a})
. _Default
. _Coerce
aProductLine :: Lens' Attributes (Maybe Text)
aProductLine
= lens _aProductLine (\ s a -> s{_aProductLine = a})
aColor :: Lens' Attributes (Maybe Text)
aColor = lens _aColor (\ s a -> s{_aColor = a})
aSize :: Lens' Attributes (Maybe Text)
aSize = lens _aSize (\ s a -> s{_aSize = a})
aFlavor :: Lens' Attributes (Maybe Text)
aFlavor = lens _aFlavor (\ s a -> s{_aFlavor = a})
aPattern :: Lens' Attributes (Maybe Text)
aPattern = lens _aPattern (\ s a -> s{_aPattern = a})
aSizeSystem :: Lens' Attributes (Maybe Text)
aSizeSystem
= lens _aSizeSystem (\ s a -> s{_aSizeSystem = a})
aMaterial :: Lens' Attributes (Maybe Text)
aMaterial
= lens _aMaterial (\ s a -> s{_aMaterial = a})
aFormat :: Lens' Attributes (Maybe Text)
aFormat = lens _aFormat (\ s a -> s{_aFormat = a})
aProductType :: Lens' Attributes [Text]
aProductType
= lens _aProductType (\ s a -> s{_aProductType = a})
. _Default
. _Coerce
aCount :: Lens' Attributes (Maybe Count)
aCount = lens _aCount (\ s a -> s{_aCount = a})
aDisclosureDate :: Lens' Attributes (Maybe Text)
aDisclosureDate
= lens _aDisclosureDate
(\ s a -> s{_aDisclosureDate = a})
aBrand :: Lens' Attributes (Maybe Text)
aBrand = lens _aBrand (\ s a -> s{_aBrand = a})
aAdditionalImageLink :: Lens' Attributes [Image]
aAdditionalImageLink
= lens _aAdditionalImageLink
(\ s a -> s{_aAdditionalImageLink = a})
. _Default
. _Coerce
aExcludedDestination :: Lens' Attributes [Text]
aExcludedDestination
= lens _aExcludedDestination
(\ s a -> s{_aExcludedDestination = a})
. _Default
. _Coerce
aVideoLink :: Lens' Attributes [Text]
aVideoLink
= lens _aVideoLink (\ s a -> s{_aVideoLink = a}) .
_Default
. _Coerce
aCapacity :: Lens' Attributes (Maybe Capacity)
aCapacity
= lens _aCapacity (\ s a -> s{_aCapacity = a})
aGtin :: Lens' Attributes [Text]
aGtin
= lens _aGtin (\ s a -> s{_aGtin = a}) . _Default .
_Coerce
aAgeGroup :: Lens' Attributes (Maybe Text)
aAgeGroup
= lens _aAgeGroup (\ s a -> s{_aAgeGroup = a})
aIncludedDestination :: Lens' Attributes [Text]
aIncludedDestination
= lens _aIncludedDestination
(\ s a -> s{_aIncludedDestination = a})
. _Default
. _Coerce
aGender :: Lens' Attributes (Maybe Text)
aGender = lens _aGender (\ s a -> s{_aGender = a})
aSuggestedRetailPrice :: Lens' Attributes (Maybe Price)
aSuggestedRetailPrice
= lens _aSuggestedRetailPrice
(\ s a -> s{_aSuggestedRetailPrice = a})
aItemGroupId :: Lens' Attributes (Maybe Text)
aItemGroupId
= lens _aItemGroupId (\ s a -> s{_aItemGroupId = a})
aTargetClientId :: Lens' Attributes (Maybe Text)
aTargetClientId
= lens _aTargetClientId
(\ s a -> s{_aTargetClientId = a})
aSizeType :: Lens' Attributes (Maybe Text)
aSizeType
= lens _aSizeType (\ s a -> s{_aSizeType = a})
aReleaseDate :: Lens' Attributes (Maybe Text)
aReleaseDate
= lens _aReleaseDate (\ s a -> s{_aReleaseDate = a})
aTitle :: Lens' Attributes (Maybe Text)
aTitle = lens _aTitle (\ s a -> s{_aTitle = a})
aMpn :: Lens' Attributes (Maybe Text)
aMpn = lens _aMpn (\ s a -> s{_aMpn = a})
aProductPageURL :: Lens' Attributes (Maybe Text)
aProductPageURL
= lens _aProductPageURL
(\ s a -> s{_aProductPageURL = a})
aDescription :: Lens' Attributes (Maybe Text)
aDescription
= lens _aDescription (\ s a -> s{_aDescription = a})
aTheme :: Lens' Attributes (Maybe Text)
aTheme = lens _aTheme (\ s a -> s{_aTheme = a})
instance FromJSON Attributes where
parseJSON
= withObject "Attributes"
(\ o ->
Attributes' <$>
(o .:? "productName") <*> (o .:? "scent") <*>
(o .:? "imageLink")
<*> (o .:? "featureDescription" .!= mempty)
<*> (o .:? "productDetail" .!= mempty)
<*> (o .:? "productLine")
<*> (o .:? "color")
<*> (o .:? "size")
<*> (o .:? "flavor")
<*> (o .:? "pattern")
<*> (o .:? "sizeSystem")
<*> (o .:? "material")
<*> (o .:? "format")
<*> (o .:? "productType" .!= mempty)
<*> (o .:? "count")
<*> (o .:? "disclosureDate")
<*> (o .:? "brand")
<*> (o .:? "additionalImageLink" .!= mempty)
<*> (o .:? "excludedDestination" .!= mempty)
<*> (o .:? "videoLink" .!= mempty)
<*> (o .:? "capacity")
<*> (o .:? "gtin" .!= mempty)
<*> (o .:? "ageGroup")
<*> (o .:? "includedDestination" .!= mempty)
<*> (o .:? "gender")
<*> (o .:? "suggestedRetailPrice")
<*> (o .:? "itemGroupId")
<*> (o .:? "targetClientId")
<*> (o .:? "sizeType")
<*> (o .:? "releaseDate")
<*> (o .:? "title")
<*> (o .:? "mpn")
<*> (o .:? "productPageUrl")
<*> (o .:? "description")
<*> (o .:? "theme"))
instance ToJSON Attributes where
toJSON Attributes'{..}
= object
(catMaybes
[("productName" .=) <$> _aProductName,
("scent" .=) <$> _aScent,
("imageLink" .=) <$> _aImageLink,
("featureDescription" .=) <$> _aFeatureDescription,
("productDetail" .=) <$> _aProductDetail,
("productLine" .=) <$> _aProductLine,
("color" .=) <$> _aColor, ("size" .=) <$> _aSize,
("flavor" .=) <$> _aFlavor,
("pattern" .=) <$> _aPattern,
("sizeSystem" .=) <$> _aSizeSystem,
("material" .=) <$> _aMaterial,
("format" .=) <$> _aFormat,
("productType" .=) <$> _aProductType,
("count" .=) <$> _aCount,
("disclosureDate" .=) <$> _aDisclosureDate,
("brand" .=) <$> _aBrand,
("additionalImageLink" .=) <$> _aAdditionalImageLink,
("excludedDestination" .=) <$> _aExcludedDestination,
("videoLink" .=) <$> _aVideoLink,
("capacity" .=) <$> _aCapacity,
("gtin" .=) <$> _aGtin,
("ageGroup" .=) <$> _aAgeGroup,
("includedDestination" .=) <$> _aIncludedDestination,
("gender" .=) <$> _aGender,
("suggestedRetailPrice" .=) <$>
_aSuggestedRetailPrice,
("itemGroupId" .=) <$> _aItemGroupId,
("targetClientId" .=) <$> _aTargetClientId,
("sizeType" .=) <$> _aSizeType,
("releaseDate" .=) <$> _aReleaseDate,
("title" .=) <$> _aTitle, ("mpn" .=) <$> _aMpn,
("productPageUrl" .=) <$> _aProductPageURL,
("description" .=) <$> _aDescription,
("theme" .=) <$> _aTheme])
data Price = Price'
{ _pAmount :: !(Maybe Text)
, _pCurrency :: !(Maybe Text)
} deriving (Eq,Show,Data,Typeable,Generic)
price
:: Price
price =
Price'
{ _pAmount = Nothing
, _pCurrency = Nothing
}
pAmount :: Lens' Price (Maybe Text)
pAmount = lens _pAmount (\ s a -> s{_pAmount = a})
pCurrency :: Lens' Price (Maybe Text)
pCurrency
= lens _pCurrency (\ s a -> s{_pCurrency = a})
instance FromJSON Price where
parseJSON
= withObject "Price"
(\ o ->
Price' <$> (o .:? "amount") <*> (o .:? "currency"))
instance ToJSON Price where
toJSON Price'{..}
= object
(catMaybes
[("amount" .=) <$> _pAmount,
("currency" .=) <$> _pCurrency])
data Product = Product'
{ _pParent :: !(Maybe Text)
, _pDestinationStatuses :: !(Maybe [DestinationStatus])
, _pTargetCountry :: !(Maybe Text)
, _pName :: !(Maybe Text)
, _pAttributes :: !(Maybe Attributes)
, _pIssues :: !(Maybe [Issue])
, _pContentLanguage :: !(Maybe Text)
, _pProductId :: !(Maybe Text)
} deriving (Eq,Show,Data,Typeable,Generic)
product
:: Product
product =
Product'
{ _pParent = Nothing
, _pDestinationStatuses = Nothing
, _pTargetCountry = Nothing
, _pName = Nothing
, _pAttributes = Nothing
, _pIssues = Nothing
, _pContentLanguage = Nothing
, _pProductId = Nothing
}
pParent :: Lens' Product (Maybe Text)
pParent = lens _pParent (\ s a -> s{_pParent = a})
pDestinationStatuses :: Lens' Product [DestinationStatus]
pDestinationStatuses
= lens _pDestinationStatuses
(\ s a -> s{_pDestinationStatuses = a})
. _Default
. _Coerce
pTargetCountry :: Lens' Product (Maybe Text)
pTargetCountry
= lens _pTargetCountry
(\ s a -> s{_pTargetCountry = a})
pName :: Lens' Product (Maybe Text)
pName = lens _pName (\ s a -> s{_pName = a})
pAttributes :: Lens' Product (Maybe Attributes)
pAttributes
= lens _pAttributes (\ s a -> s{_pAttributes = a})
pIssues :: Lens' Product [Issue]
pIssues
= lens _pIssues (\ s a -> s{_pIssues = a}) . _Default
. _Coerce
pContentLanguage :: Lens' Product (Maybe Text)
pContentLanguage
= lens _pContentLanguage
(\ s a -> s{_pContentLanguage = a})
pProductId :: Lens' Product (Maybe Text)
pProductId
= lens _pProductId (\ s a -> s{_pProductId = a})
instance FromJSON Product where
parseJSON
= withObject "Product"
(\ o ->
Product' <$>
(o .:? "parent") <*>
(o .:? "destinationStatuses" .!= mempty)
<*> (o .:? "targetCountry")
<*> (o .:? "name")
<*> (o .:? "attributes")
<*> (o .:? "issues" .!= mempty)
<*> (o .:? "contentLanguage")
<*> (o .:? "productId"))
instance ToJSON Product where
toJSON Product'{..}
= object
(catMaybes
[("parent" .=) <$> _pParent,
("destinationStatuses" .=) <$> _pDestinationStatuses,
("targetCountry" .=) <$> _pTargetCountry,
("name" .=) <$> _pName,
("attributes" .=) <$> _pAttributes,
("issues" .=) <$> _pIssues,
("contentLanguage" .=) <$> _pContentLanguage,
("productId" .=) <$> _pProductId])
data Issue = Issue'
{ _issAttribute :: !(Maybe Text)
, _issDestination :: !(Maybe Text)
, _issSeverity :: !(Maybe IssueSeverity)
, _issResolution :: !(Maybe IssueResolution)
, _issTitle :: !(Maybe Text)
, _issType :: !(Maybe Text)
, _issTimestamp :: !(Maybe DateTime')
, _issDescription :: !(Maybe Text)
} deriving (Eq,Show,Data,Typeable,Generic)
issue
:: Issue
issue =
Issue'
{ _issAttribute = Nothing
, _issDestination = Nothing
, _issSeverity = Nothing
, _issResolution = Nothing
, _issTitle = Nothing
, _issType = Nothing
, _issTimestamp = Nothing
, _issDescription = Nothing
}
issAttribute :: Lens' Issue (Maybe Text)
issAttribute
= lens _issAttribute (\ s a -> s{_issAttribute = a})
issDestination :: Lens' Issue (Maybe Text)
issDestination
= lens _issDestination
(\ s a -> s{_issDestination = a})
issSeverity :: Lens' Issue (Maybe IssueSeverity)
issSeverity
= lens _issSeverity (\ s a -> s{_issSeverity = a})
issResolution :: Lens' Issue (Maybe IssueResolution)
issResolution
= lens _issResolution
(\ s a -> s{_issResolution = a})
issTitle :: Lens' Issue (Maybe Text)
issTitle = lens _issTitle (\ s a -> s{_issTitle = a})
issType :: Lens' Issue (Maybe Text)
issType = lens _issType (\ s a -> s{_issType = a})
issTimestamp :: Lens' Issue (Maybe UTCTime)
issTimestamp
= lens _issTimestamp (\ s a -> s{_issTimestamp = a})
. mapping _DateTime
issDescription :: Lens' Issue (Maybe Text)
issDescription
= lens _issDescription
(\ s a -> s{_issDescription = a})
instance FromJSON Issue where
parseJSON
= withObject "Issue"
(\ o ->
Issue' <$>
(o .:? "attribute") <*> (o .:? "destination") <*>
(o .:? "severity")
<*> (o .:? "resolution")
<*> (o .:? "title")
<*> (o .:? "type")
<*> (o .:? "timestamp")
<*> (o .:? "description"))
instance ToJSON Issue where
toJSON Issue'{..}
= object
(catMaybes
[("attribute" .=) <$> _issAttribute,
("destination" .=) <$> _issDestination,
("severity" .=) <$> _issSeverity,
("resolution" .=) <$> _issResolution,
("title" .=) <$> _issTitle, ("type" .=) <$> _issType,
("timestamp" .=) <$> _issTimestamp,
("description" .=) <$> _issDescription])
data ListProductsResponse = ListProductsResponse'
{ _lprNextPageToken :: !(Maybe Text)
, _lprProducts :: !(Maybe [Product])
} deriving (Eq,Show,Data,Typeable,Generic)
listProductsResponse
:: ListProductsResponse
listProductsResponse =
ListProductsResponse'
{ _lprNextPageToken = Nothing
, _lprProducts = Nothing
}
lprNextPageToken :: Lens' ListProductsResponse (Maybe Text)
lprNextPageToken
= lens _lprNextPageToken
(\ s a -> s{_lprNextPageToken = a})
lprProducts :: Lens' ListProductsResponse [Product]
lprProducts
= lens _lprProducts (\ s a -> s{_lprProducts = a}) .
_Default
. _Coerce
instance FromJSON ListProductsResponse where
parseJSON
= withObject "ListProductsResponse"
(\ o ->
ListProductsResponse' <$>
(o .:? "nextPageToken") <*>
(o .:? "products" .!= mempty))
instance ToJSON ListProductsResponse where
toJSON ListProductsResponse'{..}
= object
(catMaybes
[("nextPageToken" .=) <$> _lprNextPageToken,
("products" .=) <$> _lprProducts])