{-# 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.Poly.Types.Product where
import Network.Google.Poly.Types.Sum
import Network.Google.Prelude
data ObjParseError = ObjParseError'
{ _opeLineNumber :: !(Maybe (Textual Int32))
, _opeFilePath :: !(Maybe Text)
, _opeLine :: !(Maybe Text)
, _opeEndIndex :: !(Maybe (Textual Int32))
, _opeCode :: !(Maybe ObjParseErrorCode)
, _opeStartIndex :: !(Maybe (Textual Int32))
} deriving (Eq,Show,Data,Typeable,Generic)
objParseError
:: ObjParseError
objParseError =
ObjParseError'
{ _opeLineNumber = Nothing
, _opeFilePath = Nothing
, _opeLine = Nothing
, _opeEndIndex = Nothing
, _opeCode = Nothing
, _opeStartIndex = Nothing
}
opeLineNumber :: Lens' ObjParseError (Maybe Int32)
opeLineNumber
= lens _opeLineNumber
(\ s a -> s{_opeLineNumber = a})
. mapping _Coerce
opeFilePath :: Lens' ObjParseError (Maybe Text)
opeFilePath
= lens _opeFilePath (\ s a -> s{_opeFilePath = a})
opeLine :: Lens' ObjParseError (Maybe Text)
opeLine = lens _opeLine (\ s a -> s{_opeLine = a})
opeEndIndex :: Lens' ObjParseError (Maybe Int32)
opeEndIndex
= lens _opeEndIndex (\ s a -> s{_opeEndIndex = a}) .
mapping _Coerce
opeCode :: Lens' ObjParseError (Maybe ObjParseErrorCode)
opeCode = lens _opeCode (\ s a -> s{_opeCode = a})
opeStartIndex :: Lens' ObjParseError (Maybe Int32)
opeStartIndex
= lens _opeStartIndex
(\ s a -> s{_opeStartIndex = a})
. mapping _Coerce
instance FromJSON ObjParseError where
parseJSON
= withObject "ObjParseError"
(\ o ->
ObjParseError' <$>
(o .:? "lineNumber") <*> (o .:? "filePath") <*>
(o .:? "line")
<*> (o .:? "endIndex")
<*> (o .:? "code")
<*> (o .:? "startIndex"))
instance ToJSON ObjParseError where
toJSON ObjParseError'{..}
= object
(catMaybes
[("lineNumber" .=) <$> _opeLineNumber,
("filePath" .=) <$> _opeFilePath,
("line" .=) <$> _opeLine,
("endIndex" .=) <$> _opeEndIndex,
("code" .=) <$> _opeCode,
("startIndex" .=) <$> _opeStartIndex])
data PresentationParams = PresentationParams'
{ _ppBackgRoundColor :: !(Maybe Text)
, _ppOrientingRotation :: !(Maybe Quaternion)
, _ppColorSpace :: !(Maybe PresentationParamsColorSpace)
} deriving (Eq,Show,Data,Typeable,Generic)
presentationParams
:: PresentationParams
presentationParams =
PresentationParams'
{ _ppBackgRoundColor = Nothing
, _ppOrientingRotation = Nothing
, _ppColorSpace = Nothing
}
ppBackgRoundColor :: Lens' PresentationParams (Maybe Text)
ppBackgRoundColor
= lens _ppBackgRoundColor
(\ s a -> s{_ppBackgRoundColor = a})
ppOrientingRotation :: Lens' PresentationParams (Maybe Quaternion)
ppOrientingRotation
= lens _ppOrientingRotation
(\ s a -> s{_ppOrientingRotation = a})
ppColorSpace :: Lens' PresentationParams (Maybe PresentationParamsColorSpace)
ppColorSpace
= lens _ppColorSpace (\ s a -> s{_ppColorSpace = a})
instance FromJSON PresentationParams where
parseJSON
= withObject "PresentationParams"
(\ o ->
PresentationParams' <$>
(o .:? "backgroundColor") <*>
(o .:? "orientingRotation")
<*> (o .:? "colorSpace"))
instance ToJSON PresentationParams where
toJSON PresentationParams'{..}
= object
(catMaybes
[("backgroundColor" .=) <$> _ppBackgRoundColor,
("orientingRotation" .=) <$> _ppOrientingRotation,
("colorSpace" .=) <$> _ppColorSpace])
data ListLikedAssetsResponse = ListLikedAssetsResponse'
{ _llarNextPageToken :: !(Maybe Text)
, _llarTotalSize :: !(Maybe (Textual Int32))
, _llarAssets :: !(Maybe [Asset])
} deriving (Eq,Show,Data,Typeable,Generic)
listLikedAssetsResponse
:: ListLikedAssetsResponse
listLikedAssetsResponse =
ListLikedAssetsResponse'
{ _llarNextPageToken = Nothing
, _llarTotalSize = Nothing
, _llarAssets = Nothing
}
llarNextPageToken :: Lens' ListLikedAssetsResponse (Maybe Text)
llarNextPageToken
= lens _llarNextPageToken
(\ s a -> s{_llarNextPageToken = a})
llarTotalSize :: Lens' ListLikedAssetsResponse (Maybe Int32)
llarTotalSize
= lens _llarTotalSize
(\ s a -> s{_llarTotalSize = a})
. mapping _Coerce
llarAssets :: Lens' ListLikedAssetsResponse [Asset]
llarAssets
= lens _llarAssets (\ s a -> s{_llarAssets = a}) .
_Default
. _Coerce
instance FromJSON ListLikedAssetsResponse where
parseJSON
= withObject "ListLikedAssetsResponse"
(\ o ->
ListLikedAssetsResponse' <$>
(o .:? "nextPageToken") <*> (o .:? "totalSize") <*>
(o .:? "assets" .!= mempty))
instance ToJSON ListLikedAssetsResponse where
toJSON ListLikedAssetsResponse'{..}
= object
(catMaybes
[("nextPageToken" .=) <$> _llarNextPageToken,
("totalSize" .=) <$> _llarTotalSize,
("assets" .=) <$> _llarAssets])
newtype RemixInfo = RemixInfo'
{ _riSourceAsset :: Maybe [Text]
} deriving (Eq,Show,Data,Typeable,Generic)
remixInfo
:: RemixInfo
remixInfo =
RemixInfo'
{ _riSourceAsset = Nothing
}
riSourceAsset :: Lens' RemixInfo [Text]
riSourceAsset
= lens _riSourceAsset
(\ s a -> s{_riSourceAsset = a})
. _Default
. _Coerce
instance FromJSON RemixInfo where
parseJSON
= withObject "RemixInfo"
(\ o ->
RemixInfo' <$> (o .:? "sourceAsset" .!= mempty))
instance ToJSON RemixInfo where
toJSON RemixInfo'{..}
= object
(catMaybes [("sourceAsset" .=) <$> _riSourceAsset])
data Quaternion = Quaternion'
{ _qW :: !(Maybe (Textual Double))
, _qZ :: !(Maybe (Textual Double))
, _qX :: !(Maybe (Textual Double))
, _qY :: !(Maybe (Textual Double))
} deriving (Eq,Show,Data,Typeable,Generic)
quaternion
:: Quaternion
quaternion =
Quaternion'
{ _qW = Nothing
, _qZ = Nothing
, _qX = Nothing
, _qY = Nothing
}
qW :: Lens' Quaternion (Maybe Double)
qW = lens _qW (\ s a -> s{_qW = a}) . mapping _Coerce
qZ :: Lens' Quaternion (Maybe Double)
qZ = lens _qZ (\ s a -> s{_qZ = a}) . mapping _Coerce
qX :: Lens' Quaternion (Maybe Double)
qX = lens _qX (\ s a -> s{_qX = a}) . mapping _Coerce
qY :: Lens' Quaternion (Maybe Double)
qY = lens _qY (\ s a -> s{_qY = a}) . mapping _Coerce
instance FromJSON Quaternion where
parseJSON
= withObject "Quaternion"
(\ o ->
Quaternion' <$>
(o .:? "w") <*> (o .:? "z") <*> (o .:? "x") <*>
(o .:? "y"))
instance ToJSON Quaternion where
toJSON Quaternion'{..}
= object
(catMaybes
[("w" .=) <$> _qW, ("z" .=) <$> _qZ,
("x" .=) <$> _qX, ("y" .=) <$> _qY])
data Asset = Asset'
{ _aThumbnail :: !(Maybe File)
, _aPresentationParams :: !(Maybe PresentationParams)
, _aIsCurated :: !(Maybe Bool)
, _aAuthorName :: !(Maybe Text)
, _aRemixInfo :: !(Maybe RemixInfo)
, _aFormats :: !(Maybe [Format])
, _aVisibility :: !(Maybe AssetVisibility)
, _aUpdateTime :: !(Maybe DateTime')
, _aName :: !(Maybe Text)
, _aMetadata :: !(Maybe Text)
, _aDisplayName :: !(Maybe Text)
, _aLicense :: !(Maybe AssetLicense)
, _aDescription :: !(Maybe Text)
, _aCreateTime :: !(Maybe DateTime')
} deriving (Eq,Show,Data,Typeable,Generic)
asset
:: Asset
asset =
Asset'
{ _aThumbnail = Nothing
, _aPresentationParams = Nothing
, _aIsCurated = Nothing
, _aAuthorName = Nothing
, _aRemixInfo = Nothing
, _aFormats = Nothing
, _aVisibility = Nothing
, _aUpdateTime = Nothing
, _aName = Nothing
, _aMetadata = Nothing
, _aDisplayName = Nothing
, _aLicense = Nothing
, _aDescription = Nothing
, _aCreateTime = Nothing
}
aThumbnail :: Lens' Asset (Maybe File)
aThumbnail
= lens _aThumbnail (\ s a -> s{_aThumbnail = a})
aPresentationParams :: Lens' Asset (Maybe PresentationParams)
aPresentationParams
= lens _aPresentationParams
(\ s a -> s{_aPresentationParams = a})
aIsCurated :: Lens' Asset (Maybe Bool)
aIsCurated
= lens _aIsCurated (\ s a -> s{_aIsCurated = a})
aAuthorName :: Lens' Asset (Maybe Text)
aAuthorName
= lens _aAuthorName (\ s a -> s{_aAuthorName = a})
aRemixInfo :: Lens' Asset (Maybe RemixInfo)
aRemixInfo
= lens _aRemixInfo (\ s a -> s{_aRemixInfo = a})
aFormats :: Lens' Asset [Format]
aFormats
= lens _aFormats (\ s a -> s{_aFormats = a}) .
_Default
. _Coerce
aVisibility :: Lens' Asset (Maybe AssetVisibility)
aVisibility
= lens _aVisibility (\ s a -> s{_aVisibility = a})
aUpdateTime :: Lens' Asset (Maybe UTCTime)
aUpdateTime
= lens _aUpdateTime (\ s a -> s{_aUpdateTime = a}) .
mapping _DateTime
aName :: Lens' Asset (Maybe Text)
aName = lens _aName (\ s a -> s{_aName = a})
aMetadata :: Lens' Asset (Maybe Text)
aMetadata
= lens _aMetadata (\ s a -> s{_aMetadata = a})
aDisplayName :: Lens' Asset (Maybe Text)
aDisplayName
= lens _aDisplayName (\ s a -> s{_aDisplayName = a})
aLicense :: Lens' Asset (Maybe AssetLicense)
aLicense = lens _aLicense (\ s a -> s{_aLicense = a})
aDescription :: Lens' Asset (Maybe Text)
aDescription
= lens _aDescription (\ s a -> s{_aDescription = a})
aCreateTime :: Lens' Asset (Maybe UTCTime)
aCreateTime
= lens _aCreateTime (\ s a -> s{_aCreateTime = a}) .
mapping _DateTime
instance FromJSON Asset where
parseJSON
= withObject "Asset"
(\ o ->
Asset' <$>
(o .:? "thumbnail") <*> (o .:? "presentationParams")
<*> (o .:? "isCurated")
<*> (o .:? "authorName")
<*> (o .:? "remixInfo")
<*> (o .:? "formats" .!= mempty)
<*> (o .:? "visibility")
<*> (o .:? "updateTime")
<*> (o .:? "name")
<*> (o .:? "metadata")
<*> (o .:? "displayName")
<*> (o .:? "license")
<*> (o .:? "description")
<*> (o .:? "createTime"))
instance ToJSON Asset where
toJSON Asset'{..}
= object
(catMaybes
[("thumbnail" .=) <$> _aThumbnail,
("presentationParams" .=) <$> _aPresentationParams,
("isCurated" .=) <$> _aIsCurated,
("authorName" .=) <$> _aAuthorName,
("remixInfo" .=) <$> _aRemixInfo,
("formats" .=) <$> _aFormats,
("visibility" .=) <$> _aVisibility,
("updateTime" .=) <$> _aUpdateTime,
("name" .=) <$> _aName,
("metadata" .=) <$> _aMetadata,
("displayName" .=) <$> _aDisplayName,
("license" .=) <$> _aLicense,
("description" .=) <$> _aDescription,
("createTime" .=) <$> _aCreateTime])
data Format = Format'
{ _fRoot :: !(Maybe File)
, _fResources :: !(Maybe [File])
, _fFormatComplexity :: !(Maybe FormatComplexity)
, _fFormatType :: !(Maybe Text)
} deriving (Eq,Show,Data,Typeable,Generic)
format
:: Format
format =
Format'
{ _fRoot = Nothing
, _fResources = Nothing
, _fFormatComplexity = Nothing
, _fFormatType = Nothing
}
fRoot :: Lens' Format (Maybe File)
fRoot = lens _fRoot (\ s a -> s{_fRoot = a})
fResources :: Lens' Format [File]
fResources
= lens _fResources (\ s a -> s{_fResources = a}) .
_Default
. _Coerce
fFormatComplexity :: Lens' Format (Maybe FormatComplexity)
fFormatComplexity
= lens _fFormatComplexity
(\ s a -> s{_fFormatComplexity = a})
fFormatType :: Lens' Format (Maybe Text)
fFormatType
= lens _fFormatType (\ s a -> s{_fFormatType = a})
instance FromJSON Format where
parseJSON
= withObject "Format"
(\ o ->
Format' <$>
(o .:? "root") <*> (o .:? "resources" .!= mempty) <*>
(o .:? "formatComplexity")
<*> (o .:? "formatType"))
instance ToJSON Format where
toJSON Format'{..}
= object
(catMaybes
[("root" .=) <$> _fRoot,
("resources" .=) <$> _fResources,
("formatComplexity" .=) <$> _fFormatComplexity,
("formatType" .=) <$> _fFormatType])
data AssetImportMessage = AssetImportMessage'
{ _aimObjParseError :: !(Maybe ObjParseError)
, _aimFilePath :: !(Maybe Text)
, _aimImageError :: !(Maybe ImageError)
, _aimCode :: !(Maybe AssetImportMessageCode)
} deriving (Eq,Show,Data,Typeable,Generic)
assetImportMessage
:: AssetImportMessage
assetImportMessage =
AssetImportMessage'
{ _aimObjParseError = Nothing
, _aimFilePath = Nothing
, _aimImageError = Nothing
, _aimCode = Nothing
}
aimObjParseError :: Lens' AssetImportMessage (Maybe ObjParseError)
aimObjParseError
= lens _aimObjParseError
(\ s a -> s{_aimObjParseError = a})
aimFilePath :: Lens' AssetImportMessage (Maybe Text)
aimFilePath
= lens _aimFilePath (\ s a -> s{_aimFilePath = a})
aimImageError :: Lens' AssetImportMessage (Maybe ImageError)
aimImageError
= lens _aimImageError
(\ s a -> s{_aimImageError = a})
aimCode :: Lens' AssetImportMessage (Maybe AssetImportMessageCode)
aimCode = lens _aimCode (\ s a -> s{_aimCode = a})
instance FromJSON AssetImportMessage where
parseJSON
= withObject "AssetImportMessage"
(\ o ->
AssetImportMessage' <$>
(o .:? "objParseError") <*> (o .:? "filePath") <*>
(o .:? "imageError")
<*> (o .:? "code"))
instance ToJSON AssetImportMessage where
toJSON AssetImportMessage'{..}
= object
(catMaybes
[("objParseError" .=) <$> _aimObjParseError,
("filePath" .=) <$> _aimFilePath,
("imageError" .=) <$> _aimImageError,
("code" .=) <$> _aimCode])
data StartAssetImportResponse = StartAssetImportResponse'
{ _sairPublishURL :: !(Maybe Text)
, _sairAssetImportMessages :: !(Maybe [AssetImportMessage])
, _sairAssetImportId :: !(Maybe Text)
, _sairAssetId :: !(Maybe Text)
} deriving (Eq,Show,Data,Typeable,Generic)
startAssetImportResponse
:: StartAssetImportResponse
startAssetImportResponse =
StartAssetImportResponse'
{ _sairPublishURL = Nothing
, _sairAssetImportMessages = Nothing
, _sairAssetImportId = Nothing
, _sairAssetId = Nothing
}
sairPublishURL :: Lens' StartAssetImportResponse (Maybe Text)
sairPublishURL
= lens _sairPublishURL
(\ s a -> s{_sairPublishURL = a})
sairAssetImportMessages :: Lens' StartAssetImportResponse [AssetImportMessage]
sairAssetImportMessages
= lens _sairAssetImportMessages
(\ s a -> s{_sairAssetImportMessages = a})
. _Default
. _Coerce
sairAssetImportId :: Lens' StartAssetImportResponse (Maybe Text)
sairAssetImportId
= lens _sairAssetImportId
(\ s a -> s{_sairAssetImportId = a})
sairAssetId :: Lens' StartAssetImportResponse (Maybe Text)
sairAssetId
= lens _sairAssetId (\ s a -> s{_sairAssetId = a})
instance FromJSON StartAssetImportResponse where
parseJSON
= withObject "StartAssetImportResponse"
(\ o ->
StartAssetImportResponse' <$>
(o .:? "publishUrl") <*>
(o .:? "assetImportMessages" .!= mempty)
<*> (o .:? "assetImportId")
<*> (o .:? "assetId"))
instance ToJSON StartAssetImportResponse where
toJSON StartAssetImportResponse'{..}
= object
(catMaybes
[("publishUrl" .=) <$> _sairPublishURL,
("assetImportMessages" .=) <$>
_sairAssetImportMessages,
("assetImportId" .=) <$> _sairAssetImportId,
("assetId" .=) <$> _sairAssetId])
data ImageError = ImageError'
{ _ieFilePath :: !(Maybe Text)
, _ieCode :: !(Maybe ImageErrorCode)
} deriving (Eq,Show,Data,Typeable,Generic)
imageError
:: ImageError
imageError =
ImageError'
{ _ieFilePath = Nothing
, _ieCode = Nothing
}
ieFilePath :: Lens' ImageError (Maybe Text)
ieFilePath
= lens _ieFilePath (\ s a -> s{_ieFilePath = a})
ieCode :: Lens' ImageError (Maybe ImageErrorCode)
ieCode = lens _ieCode (\ s a -> s{_ieCode = a})
instance FromJSON ImageError where
parseJSON
= withObject "ImageError"
(\ o ->
ImageError' <$>
(o .:? "filePath") <*> (o .:? "code"))
instance ToJSON ImageError where
toJSON ImageError'{..}
= object
(catMaybes
[("filePath" .=) <$> _ieFilePath,
("code" .=) <$> _ieCode])
data FormatComplexity = FormatComplexity'
{ _fcTriangleCount :: !(Maybe (Textual Int64))
, _fcLodHint :: !(Maybe (Textual Int32))
} deriving (Eq,Show,Data,Typeable,Generic)
formatComplexity
:: FormatComplexity
formatComplexity =
FormatComplexity'
{ _fcTriangleCount = Nothing
, _fcLodHint = Nothing
}
fcTriangleCount :: Lens' FormatComplexity (Maybe Int64)
fcTriangleCount
= lens _fcTriangleCount
(\ s a -> s{_fcTriangleCount = a})
. mapping _Coerce
fcLodHint :: Lens' FormatComplexity (Maybe Int32)
fcLodHint
= lens _fcLodHint (\ s a -> s{_fcLodHint = a}) .
mapping _Coerce
instance FromJSON FormatComplexity where
parseJSON
= withObject "FormatComplexity"
(\ o ->
FormatComplexity' <$>
(o .:? "triangleCount") <*> (o .:? "lodHint"))
instance ToJSON FormatComplexity where
toJSON FormatComplexity'{..}
= object
(catMaybes
[("triangleCount" .=) <$> _fcTriangleCount,
("lodHint" .=) <$> _fcLodHint])
data ListAssetsResponse = ListAssetsResponse'
{ _larNextPageToken :: !(Maybe Text)
, _larTotalSize :: !(Maybe (Textual Int32))
, _larAssets :: !(Maybe [Asset])
} deriving (Eq,Show,Data,Typeable,Generic)
listAssetsResponse
:: ListAssetsResponse
listAssetsResponse =
ListAssetsResponse'
{ _larNextPageToken = Nothing
, _larTotalSize = Nothing
, _larAssets = Nothing
}
larNextPageToken :: Lens' ListAssetsResponse (Maybe Text)
larNextPageToken
= lens _larNextPageToken
(\ s a -> s{_larNextPageToken = a})
larTotalSize :: Lens' ListAssetsResponse (Maybe Int32)
larTotalSize
= lens _larTotalSize (\ s a -> s{_larTotalSize = a})
. mapping _Coerce
larAssets :: Lens' ListAssetsResponse [Asset]
larAssets
= lens _larAssets (\ s a -> s{_larAssets = a}) .
_Default
. _Coerce
instance FromJSON ListAssetsResponse where
parseJSON
= withObject "ListAssetsResponse"
(\ o ->
ListAssetsResponse' <$>
(o .:? "nextPageToken") <*> (o .:? "totalSize") <*>
(o .:? "assets" .!= mempty))
instance ToJSON ListAssetsResponse where
toJSON ListAssetsResponse'{..}
= object
(catMaybes
[("nextPageToken" .=) <$> _larNextPageToken,
("totalSize" .=) <$> _larTotalSize,
("assets" .=) <$> _larAssets])
data ListUserAssetsResponse = ListUserAssetsResponse'
{ _luarNextPageToken :: !(Maybe Text)
, _luarTotalSize :: !(Maybe (Textual Int32))
, _luarUserAssets :: !(Maybe [UserAsset])
} deriving (Eq,Show,Data,Typeable,Generic)
listUserAssetsResponse
:: ListUserAssetsResponse
listUserAssetsResponse =
ListUserAssetsResponse'
{ _luarNextPageToken = Nothing
, _luarTotalSize = Nothing
, _luarUserAssets = Nothing
}
luarNextPageToken :: Lens' ListUserAssetsResponse (Maybe Text)
luarNextPageToken
= lens _luarNextPageToken
(\ s a -> s{_luarNextPageToken = a})
luarTotalSize :: Lens' ListUserAssetsResponse (Maybe Int32)
luarTotalSize
= lens _luarTotalSize
(\ s a -> s{_luarTotalSize = a})
. mapping _Coerce
luarUserAssets :: Lens' ListUserAssetsResponse [UserAsset]
luarUserAssets
= lens _luarUserAssets
(\ s a -> s{_luarUserAssets = a})
. _Default
. _Coerce
instance FromJSON ListUserAssetsResponse where
parseJSON
= withObject "ListUserAssetsResponse"
(\ o ->
ListUserAssetsResponse' <$>
(o .:? "nextPageToken") <*> (o .:? "totalSize") <*>
(o .:? "userAssets" .!= mempty))
instance ToJSON ListUserAssetsResponse where
toJSON ListUserAssetsResponse'{..}
= object
(catMaybes
[("nextPageToken" .=) <$> _luarNextPageToken,
("totalSize" .=) <$> _luarTotalSize,
("userAssets" .=) <$> _luarUserAssets])
data File = File'
{ _fURL :: !(Maybe Text)
, _fRelativePath :: !(Maybe Text)
, _fContentType :: !(Maybe Text)
} deriving (Eq,Show,Data,Typeable,Generic)
file
:: File
file =
File'
{ _fURL = Nothing
, _fRelativePath = Nothing
, _fContentType = Nothing
}
fURL :: Lens' File (Maybe Text)
fURL = lens _fURL (\ s a -> s{_fURL = a})
fRelativePath :: Lens' File (Maybe Text)
fRelativePath
= lens _fRelativePath
(\ s a -> s{_fRelativePath = a})
fContentType :: Lens' File (Maybe Text)
fContentType
= lens _fContentType (\ s a -> s{_fContentType = a})
instance FromJSON File where
parseJSON
= withObject "File"
(\ o ->
File' <$>
(o .:? "url") <*> (o .:? "relativePath") <*>
(o .:? "contentType"))
instance ToJSON File where
toJSON File'{..}
= object
(catMaybes
[("url" .=) <$> _fURL,
("relativePath" .=) <$> _fRelativePath,
("contentType" .=) <$> _fContentType])
newtype UserAsset = UserAsset'
{ _uaAsset :: Maybe Asset
} deriving (Eq,Show,Data,Typeable,Generic)
userAsset
:: UserAsset
userAsset =
UserAsset'
{ _uaAsset = Nothing
}
uaAsset :: Lens' UserAsset (Maybe Asset)
uaAsset = lens _uaAsset (\ s a -> s{_uaAsset = a})
instance FromJSON UserAsset where
parseJSON
= withObject "UserAsset"
(\ o -> UserAsset' <$> (o .:? "asset"))
instance ToJSON UserAsset where
toJSON UserAsset'{..}
= object (catMaybes [("asset" .=) <$> _uaAsset])