module Network.Google.Datastore.Types.Product where
import Network.Google.Datastore.Types.Sum
import Network.Google.Prelude
newtype RollbackRequest = RollbackRequest
{ _rrTransaction :: Maybe (Textual Word8)
} deriving (Eq,Show,Data,Typeable,Generic)
rollbackRequest
:: RollbackRequest
rollbackRequest =
RollbackRequest
{ _rrTransaction = Nothing
}
rrTransaction :: Lens' RollbackRequest (Maybe Word8)
rrTransaction
= lens _rrTransaction
(\ s a -> s{_rrTransaction = a})
. mapping _Coerce
instance FromJSON RollbackRequest where
parseJSON
= withObject "RollbackRequest"
(\ o -> RollbackRequest <$> (o .:? "transaction"))
instance ToJSON RollbackRequest where
toJSON RollbackRequest{..}
= object
(catMaybes [("transaction" .=) <$> _rrTransaction])
data Property = Property
{ _pKeyValue :: !(Maybe Key)
, _pBlobKeyValue :: !(Maybe Text)
, _pDateTimeValue :: !(Maybe DateTime')
, _pIntegerValue :: !(Maybe (Textual Int64))
, _pEntityValue :: !(Maybe Entity)
, _pDoubleValue :: !(Maybe (Textual Double))
, _pStringValue :: !(Maybe Text)
, _pListValue :: !(Maybe [Value])
, _pIndexed :: !(Maybe Bool)
, _pBooleanValue :: !(Maybe Bool)
, _pMeaning :: !(Maybe (Textual Int32))
, _pBlobValue :: !(Maybe (Textual Word8))
} deriving (Eq,Show,Data,Typeable,Generic)
property
:: Property
property =
Property
{ _pKeyValue = Nothing
, _pBlobKeyValue = Nothing
, _pDateTimeValue = Nothing
, _pIntegerValue = Nothing
, _pEntityValue = Nothing
, _pDoubleValue = Nothing
, _pStringValue = Nothing
, _pListValue = Nothing
, _pIndexed = Nothing
, _pBooleanValue = Nothing
, _pMeaning = Nothing
, _pBlobValue = Nothing
}
pKeyValue :: Lens' Property (Maybe Key)
pKeyValue
= lens _pKeyValue (\ s a -> s{_pKeyValue = a})
pBlobKeyValue :: Lens' Property (Maybe Text)
pBlobKeyValue
= lens _pBlobKeyValue
(\ s a -> s{_pBlobKeyValue = a})
pDateTimeValue :: Lens' Property (Maybe UTCTime)
pDateTimeValue
= lens _pDateTimeValue
(\ s a -> s{_pDateTimeValue = a})
. mapping _DateTime
pIntegerValue :: Lens' Property (Maybe Int64)
pIntegerValue
= lens _pIntegerValue
(\ s a -> s{_pIntegerValue = a})
. mapping _Coerce
pEntityValue :: Lens' Property (Maybe Entity)
pEntityValue
= lens _pEntityValue (\ s a -> s{_pEntityValue = a})
pDoubleValue :: Lens' Property (Maybe Double)
pDoubleValue
= lens _pDoubleValue (\ s a -> s{_pDoubleValue = a})
. mapping _Coerce
pStringValue :: Lens' Property (Maybe Text)
pStringValue
= lens _pStringValue (\ s a -> s{_pStringValue = a})
pListValue :: Lens' Property [Value]
pListValue
= lens _pListValue (\ s a -> s{_pListValue = a}) .
_Default
. _Coerce
pIndexed :: Lens' Property (Maybe Bool)
pIndexed = lens _pIndexed (\ s a -> s{_pIndexed = a})
pBooleanValue :: Lens' Property (Maybe Bool)
pBooleanValue
= lens _pBooleanValue
(\ s a -> s{_pBooleanValue = a})
pMeaning :: Lens' Property (Maybe Int32)
pMeaning
= lens _pMeaning (\ s a -> s{_pMeaning = a}) .
mapping _Coerce
pBlobValue :: Lens' Property (Maybe Word8)
pBlobValue
= lens _pBlobValue (\ s a -> s{_pBlobValue = a}) .
mapping _Coerce
instance FromJSON Property where
parseJSON
= withObject "Property"
(\ o ->
Property <$>
(o .:? "keyValue") <*> (o .:? "blobKeyValue") <*>
(o .:? "dateTimeValue")
<*> (o .:? "integerValue")
<*> (o .:? "entityValue")
<*> (o .:? "doubleValue")
<*> (o .:? "stringValue")
<*> (o .:? "listValue" .!= mempty)
<*> (o .:? "indexed")
<*> (o .:? "booleanValue")
<*> (o .:? "meaning")
<*> (o .:? "blobValue"))
instance ToJSON Property where
toJSON Property{..}
= object
(catMaybes
[("keyValue" .=) <$> _pKeyValue,
("blobKeyValue" .=) <$> _pBlobKeyValue,
("dateTimeValue" .=) <$> _pDateTimeValue,
("integerValue" .=) <$> _pIntegerValue,
("entityValue" .=) <$> _pEntityValue,
("doubleValue" .=) <$> _pDoubleValue,
("stringValue" .=) <$> _pStringValue,
("listValue" .=) <$> _pListValue,
("indexed" .=) <$> _pIndexed,
("booleanValue" .=) <$> _pBooleanValue,
("meaning" .=) <$> _pMeaning,
("blobValue" .=) <$> _pBlobValue])
data PartitionId = PartitionId
{ _piNamespace :: !(Maybe Text)
, _piDataSetId :: !(Maybe Text)
} deriving (Eq,Show,Data,Typeable,Generic)
partitionId
:: PartitionId
partitionId =
PartitionId
{ _piNamespace = Nothing
, _piDataSetId = Nothing
}
piNamespace :: Lens' PartitionId (Maybe Text)
piNamespace
= lens _piNamespace (\ s a -> s{_piNamespace = a})
piDataSetId :: Lens' PartitionId (Maybe Text)
piDataSetId
= lens _piDataSetId (\ s a -> s{_piDataSetId = a})
instance FromJSON PartitionId where
parseJSON
= withObject "PartitionId"
(\ o ->
PartitionId <$>
(o .:? "namespace") <*> (o .:? "datasetId"))
instance ToJSON PartitionId where
toJSON PartitionId{..}
= object
(catMaybes
[("namespace" .=) <$> _piNamespace,
("datasetId" .=) <$> _piDataSetId])
data QueryResultBatch = QueryResultBatch
{ _qrbSkippedResults :: !(Maybe (Textual Int32))
, _qrbEntityResultType :: !(Maybe QueryResultBatchEntityResultType)
, _qrbEntityResults :: !(Maybe [EntityResult])
, _qrbMoreResults :: !(Maybe QueryResultBatchMoreResults)
, _qrbEndCursor :: !(Maybe (Textual Word8))
} deriving (Eq,Show,Data,Typeable,Generic)
queryResultBatch
:: QueryResultBatch
queryResultBatch =
QueryResultBatch
{ _qrbSkippedResults = Nothing
, _qrbEntityResultType = Nothing
, _qrbEntityResults = Nothing
, _qrbMoreResults = Nothing
, _qrbEndCursor = Nothing
}
qrbSkippedResults :: Lens' QueryResultBatch (Maybe Int32)
qrbSkippedResults
= lens _qrbSkippedResults
(\ s a -> s{_qrbSkippedResults = a})
. mapping _Coerce
qrbEntityResultType :: Lens' QueryResultBatch (Maybe QueryResultBatchEntityResultType)
qrbEntityResultType
= lens _qrbEntityResultType
(\ s a -> s{_qrbEntityResultType = a})
qrbEntityResults :: Lens' QueryResultBatch [EntityResult]
qrbEntityResults
= lens _qrbEntityResults
(\ s a -> s{_qrbEntityResults = a})
. _Default
. _Coerce
qrbMoreResults :: Lens' QueryResultBatch (Maybe QueryResultBatchMoreResults)
qrbMoreResults
= lens _qrbMoreResults
(\ s a -> s{_qrbMoreResults = a})
qrbEndCursor :: Lens' QueryResultBatch (Maybe Word8)
qrbEndCursor
= lens _qrbEndCursor (\ s a -> s{_qrbEndCursor = a})
. mapping _Coerce
instance FromJSON QueryResultBatch where
parseJSON
= withObject "QueryResultBatch"
(\ o ->
QueryResultBatch <$>
(o .:? "skippedResults") <*>
(o .:? "entityResultType")
<*> (o .:? "entityResults" .!= mempty)
<*> (o .:? "moreResults")
<*> (o .:? "endCursor"))
instance ToJSON QueryResultBatch where
toJSON QueryResultBatch{..}
= object
(catMaybes
[("skippedResults" .=) <$> _qrbSkippedResults,
("entityResultType" .=) <$> _qrbEntityResultType,
("entityResults" .=) <$> _qrbEntityResults,
("moreResults" .=) <$> _qrbMoreResults,
("endCursor" .=) <$> _qrbEndCursor])
newtype EntityProperties = EntityProperties
{ _epAddtional :: HashMap Text Property
} deriving (Eq,Show,Data,Typeable,Generic)
entityProperties
:: HashMap Text Property
-> EntityProperties
entityProperties pEpAddtional_ =
EntityProperties
{ _epAddtional = _Coerce # pEpAddtional_
}
epAddtional :: Lens' EntityProperties (HashMap Text Property)
epAddtional
= lens _epAddtional (\ s a -> s{_epAddtional = a}) .
_Coerce
instance FromJSON EntityProperties where
parseJSON
= withObject "EntityProperties"
(\ o -> EntityProperties <$> (parseJSONObject o))
instance ToJSON EntityProperties where
toJSON = toJSON . _epAddtional
newtype BeginTransactionRequest = BeginTransactionRequest
{ _btrIsolationLevel :: Maybe BeginTransactionRequestIsolationLevel
} deriving (Eq,Show,Data,Typeable,Generic)
beginTransactionRequest
:: BeginTransactionRequest
beginTransactionRequest =
BeginTransactionRequest
{ _btrIsolationLevel = Nothing
}
btrIsolationLevel :: Lens' BeginTransactionRequest (Maybe BeginTransactionRequestIsolationLevel)
btrIsolationLevel
= lens _btrIsolationLevel
(\ s a -> s{_btrIsolationLevel = a})
instance FromJSON BeginTransactionRequest where
parseJSON
= withObject "BeginTransactionRequest"
(\ o ->
BeginTransactionRequest <$> (o .:? "isolationLevel"))
instance ToJSON BeginTransactionRequest where
toJSON BeginTransactionRequest{..}
= object
(catMaybes
[("isolationLevel" .=) <$> _btrIsolationLevel])
data RunQueryRequest = RunQueryRequest
{ _rqrPartitionId :: !(Maybe PartitionId)
, _rqrGqlQuery :: !(Maybe GqlQuery)
, _rqrQuery :: !(Maybe Query)
, _rqrReadOptions :: !(Maybe ReadOptions)
} deriving (Eq,Show,Data,Typeable,Generic)
runQueryRequest
:: RunQueryRequest
runQueryRequest =
RunQueryRequest
{ _rqrPartitionId = Nothing
, _rqrGqlQuery = Nothing
, _rqrQuery = Nothing
, _rqrReadOptions = Nothing
}
rqrPartitionId :: Lens' RunQueryRequest (Maybe PartitionId)
rqrPartitionId
= lens _rqrPartitionId
(\ s a -> s{_rqrPartitionId = a})
rqrGqlQuery :: Lens' RunQueryRequest (Maybe GqlQuery)
rqrGqlQuery
= lens _rqrGqlQuery (\ s a -> s{_rqrGqlQuery = a})
rqrQuery :: Lens' RunQueryRequest (Maybe Query)
rqrQuery = lens _rqrQuery (\ s a -> s{_rqrQuery = a})
rqrReadOptions :: Lens' RunQueryRequest (Maybe ReadOptions)
rqrReadOptions
= lens _rqrReadOptions
(\ s a -> s{_rqrReadOptions = a})
instance FromJSON RunQueryRequest where
parseJSON
= withObject "RunQueryRequest"
(\ o ->
RunQueryRequest <$>
(o .:? "partitionId") <*> (o .:? "gqlQuery") <*>
(o .:? "query")
<*> (o .:? "readOptions"))
instance ToJSON RunQueryRequest where
toJSON RunQueryRequest{..}
= object
(catMaybes
[("partitionId" .=) <$> _rqrPartitionId,
("gqlQuery" .=) <$> _rqrGqlQuery,
("query" .=) <$> _rqrQuery,
("readOptions" .=) <$> _rqrReadOptions])
newtype AllocateIdsRequest = AllocateIdsRequest
{ _airKeys :: Maybe [Key]
} deriving (Eq,Show,Data,Typeable,Generic)
allocateIdsRequest
:: AllocateIdsRequest
allocateIdsRequest =
AllocateIdsRequest
{ _airKeys = Nothing
}
airKeys :: Lens' AllocateIdsRequest [Key]
airKeys
= lens _airKeys (\ s a -> s{_airKeys = a}) . _Default
. _Coerce
instance FromJSON AllocateIdsRequest where
parseJSON
= withObject "AllocateIdsRequest"
(\ o ->
AllocateIdsRequest <$> (o .:? "keys" .!= mempty))
instance ToJSON AllocateIdsRequest where
toJSON AllocateIdsRequest{..}
= object (catMaybes [("keys" .=) <$> _airKeys])
data CompositeFilter = CompositeFilter
{ _cfOperator :: !(Maybe CompositeFilterOperator)
, _cfFilters :: !(Maybe [Filter])
} deriving (Eq,Show,Data,Typeable,Generic)
compositeFilter
:: CompositeFilter
compositeFilter =
CompositeFilter
{ _cfOperator = Nothing
, _cfFilters = Nothing
}
cfOperator :: Lens' CompositeFilter (Maybe CompositeFilterOperator)
cfOperator
= lens _cfOperator (\ s a -> s{_cfOperator = a})
cfFilters :: Lens' CompositeFilter [Filter]
cfFilters
= lens _cfFilters (\ s a -> s{_cfFilters = a}) .
_Default
. _Coerce
instance FromJSON CompositeFilter where
parseJSON
= withObject "CompositeFilter"
(\ o ->
CompositeFilter <$>
(o .:? "operator") <*> (o .:? "filters" .!= mempty))
instance ToJSON CompositeFilter where
toJSON CompositeFilter{..}
= object
(catMaybes
[("operator" .=) <$> _cfOperator,
("filters" .=) <$> _cfFilters])
data BeginTransactionResponse = BeginTransactionResponse
{ _btrTransaction :: !(Maybe (Textual Word8))
, _btrHeader :: !(Maybe ResponseHeader)
} deriving (Eq,Show,Data,Typeable,Generic)
beginTransactionResponse
:: BeginTransactionResponse
beginTransactionResponse =
BeginTransactionResponse
{ _btrTransaction = Nothing
, _btrHeader = Nothing
}
btrTransaction :: Lens' BeginTransactionResponse (Maybe Word8)
btrTransaction
= lens _btrTransaction
(\ s a -> s{_btrTransaction = a})
. mapping _Coerce
btrHeader :: Lens' BeginTransactionResponse (Maybe ResponseHeader)
btrHeader
= lens _btrHeader (\ s a -> s{_btrHeader = a})
instance FromJSON BeginTransactionResponse where
parseJSON
= withObject "BeginTransactionResponse"
(\ o ->
BeginTransactionResponse <$>
(o .:? "transaction") <*> (o .:? "header"))
instance ToJSON BeginTransactionResponse where
toJSON BeginTransactionResponse{..}
= object
(catMaybes
[("transaction" .=) <$> _btrTransaction,
("header" .=) <$> _btrHeader])
data MutationResult = MutationResult
{ _mrInsertAutoIdKeys :: !(Maybe [Key])
, _mrIndexUpdates :: !(Maybe (Textual Int32))
} deriving (Eq,Show,Data,Typeable,Generic)
mutationResult
:: MutationResult
mutationResult =
MutationResult
{ _mrInsertAutoIdKeys = Nothing
, _mrIndexUpdates = Nothing
}
mrInsertAutoIdKeys :: Lens' MutationResult [Key]
mrInsertAutoIdKeys
= lens _mrInsertAutoIdKeys
(\ s a -> s{_mrInsertAutoIdKeys = a})
. _Default
. _Coerce
mrIndexUpdates :: Lens' MutationResult (Maybe Int32)
mrIndexUpdates
= lens _mrIndexUpdates
(\ s a -> s{_mrIndexUpdates = a})
. mapping _Coerce
instance FromJSON MutationResult where
parseJSON
= withObject "MutationResult"
(\ o ->
MutationResult <$>
(o .:? "insertAutoIdKeys" .!= mempty) <*>
(o .:? "indexUpdates"))
instance ToJSON MutationResult where
toJSON MutationResult{..}
= object
(catMaybes
[("insertAutoIdKeys" .=) <$> _mrInsertAutoIdKeys,
("indexUpdates" .=) <$> _mrIndexUpdates])
data AllocateIdsResponse = AllocateIdsResponse
{ _aKeys :: !(Maybe [Key])
, _aHeader :: !(Maybe ResponseHeader)
} deriving (Eq,Show,Data,Typeable,Generic)
allocateIdsResponse
:: AllocateIdsResponse
allocateIdsResponse =
AllocateIdsResponse
{ _aKeys = Nothing
, _aHeader = Nothing
}
aKeys :: Lens' AllocateIdsResponse [Key]
aKeys
= lens _aKeys (\ s a -> s{_aKeys = a}) . _Default .
_Coerce
aHeader :: Lens' AllocateIdsResponse (Maybe ResponseHeader)
aHeader = lens _aHeader (\ s a -> s{_aHeader = a})
instance FromJSON AllocateIdsResponse where
parseJSON
= withObject "AllocateIdsResponse"
(\ o ->
AllocateIdsResponse <$>
(o .:? "keys" .!= mempty) <*> (o .:? "header"))
instance ToJSON AllocateIdsResponse where
toJSON AllocateIdsResponse{..}
= object
(catMaybes
[("keys" .=) <$> _aKeys, ("header" .=) <$> _aHeader])
data GqlQuery = GqlQuery
{ _gqAllowLiteral :: !(Maybe Bool)
, _gqNumberArgs :: !(Maybe [GqlQueryArg])
, _gqQueryString :: !(Maybe Text)
, _gqNameArgs :: !(Maybe [GqlQueryArg])
} deriving (Eq,Show,Data,Typeable,Generic)
gqlQuery
:: GqlQuery
gqlQuery =
GqlQuery
{ _gqAllowLiteral = Nothing
, _gqNumberArgs = Nothing
, _gqQueryString = Nothing
, _gqNameArgs = Nothing
}
gqAllowLiteral :: Lens' GqlQuery (Maybe Bool)
gqAllowLiteral
= lens _gqAllowLiteral
(\ s a -> s{_gqAllowLiteral = a})
gqNumberArgs :: Lens' GqlQuery [GqlQueryArg]
gqNumberArgs
= lens _gqNumberArgs (\ s a -> s{_gqNumberArgs = a})
. _Default
. _Coerce
gqQueryString :: Lens' GqlQuery (Maybe Text)
gqQueryString
= lens _gqQueryString
(\ s a -> s{_gqQueryString = a})
gqNameArgs :: Lens' GqlQuery [GqlQueryArg]
gqNameArgs
= lens _gqNameArgs (\ s a -> s{_gqNameArgs = a}) .
_Default
. _Coerce
instance FromJSON GqlQuery where
parseJSON
= withObject "GqlQuery"
(\ o ->
GqlQuery <$>
(o .:? "allowLiteral") <*>
(o .:? "numberArgs" .!= mempty)
<*> (o .:? "queryString")
<*> (o .:? "nameArgs" .!= mempty))
instance ToJSON GqlQuery where
toJSON GqlQuery{..}
= object
(catMaybes
[("allowLiteral" .=) <$> _gqAllowLiteral,
("numberArgs" .=) <$> _gqNumberArgs,
("queryString" .=) <$> _gqQueryString,
("nameArgs" .=) <$> _gqNameArgs])
data RunQueryResponse = RunQueryResponse
{ _rqrBatch :: !(Maybe QueryResultBatch)
, _rqrHeader :: !(Maybe ResponseHeader)
} deriving (Eq,Show,Data,Typeable,Generic)
runQueryResponse
:: RunQueryResponse
runQueryResponse =
RunQueryResponse
{ _rqrBatch = Nothing
, _rqrHeader = Nothing
}
rqrBatch :: Lens' RunQueryResponse (Maybe QueryResultBatch)
rqrBatch = lens _rqrBatch (\ s a -> s{_rqrBatch = a})
rqrHeader :: Lens' RunQueryResponse (Maybe ResponseHeader)
rqrHeader
= lens _rqrHeader (\ s a -> s{_rqrHeader = a})
instance FromJSON RunQueryResponse where
parseJSON
= withObject "RunQueryResponse"
(\ o ->
RunQueryResponse <$>
(o .:? "batch") <*> (o .:? "header"))
instance ToJSON RunQueryResponse where
toJSON RunQueryResponse{..}
= object
(catMaybes
[("batch" .=) <$> _rqrBatch,
("header" .=) <$> _rqrHeader])
data Value = Value
{ _vKeyValue :: !(Maybe Key)
, _vBlobKeyValue :: !(Maybe Text)
, _vDateTimeValue :: !(Maybe DateTime')
, _vIntegerValue :: !(Maybe (Textual Int64))
, _vEntityValue :: !(Maybe Entity)
, _vDoubleValue :: !(Maybe (Textual Double))
, _vStringValue :: !(Maybe Text)
, _vListValue :: !(Maybe [Value])
, _vIndexed :: !(Maybe Bool)
, _vBooleanValue :: !(Maybe Bool)
, _vMeaning :: !(Maybe (Textual Int32))
, _vBlobValue :: !(Maybe (Textual Word8))
} deriving (Eq,Show,Data,Typeable,Generic)
value
:: Value
value =
Value
{ _vKeyValue = Nothing
, _vBlobKeyValue = Nothing
, _vDateTimeValue = Nothing
, _vIntegerValue = Nothing
, _vEntityValue = Nothing
, _vDoubleValue = Nothing
, _vStringValue = Nothing
, _vListValue = Nothing
, _vIndexed = Nothing
, _vBooleanValue = Nothing
, _vMeaning = Nothing
, _vBlobValue = Nothing
}
vKeyValue :: Lens' Value (Maybe Key)
vKeyValue
= lens _vKeyValue (\ s a -> s{_vKeyValue = a})
vBlobKeyValue :: Lens' Value (Maybe Text)
vBlobKeyValue
= lens _vBlobKeyValue
(\ s a -> s{_vBlobKeyValue = a})
vDateTimeValue :: Lens' Value (Maybe UTCTime)
vDateTimeValue
= lens _vDateTimeValue
(\ s a -> s{_vDateTimeValue = a})
. mapping _DateTime
vIntegerValue :: Lens' Value (Maybe Int64)
vIntegerValue
= lens _vIntegerValue
(\ s a -> s{_vIntegerValue = a})
. mapping _Coerce
vEntityValue :: Lens' Value (Maybe Entity)
vEntityValue
= lens _vEntityValue (\ s a -> s{_vEntityValue = a})
vDoubleValue :: Lens' Value (Maybe Double)
vDoubleValue
= lens _vDoubleValue (\ s a -> s{_vDoubleValue = a})
. mapping _Coerce
vStringValue :: Lens' Value (Maybe Text)
vStringValue
= lens _vStringValue (\ s a -> s{_vStringValue = a})
vListValue :: Lens' Value [Value]
vListValue
= lens _vListValue (\ s a -> s{_vListValue = a}) .
_Default
. _Coerce
vIndexed :: Lens' Value (Maybe Bool)
vIndexed = lens _vIndexed (\ s a -> s{_vIndexed = a})
vBooleanValue :: Lens' Value (Maybe Bool)
vBooleanValue
= lens _vBooleanValue
(\ s a -> s{_vBooleanValue = a})
vMeaning :: Lens' Value (Maybe Int32)
vMeaning
= lens _vMeaning (\ s a -> s{_vMeaning = a}) .
mapping _Coerce
vBlobValue :: Lens' Value (Maybe Word8)
vBlobValue
= lens _vBlobValue (\ s a -> s{_vBlobValue = a}) .
mapping _Coerce
instance FromJSON Value where
parseJSON
= withObject "Value"
(\ o ->
Value <$>
(o .:? "keyValue") <*> (o .:? "blobKeyValue") <*>
(o .:? "dateTimeValue")
<*> (o .:? "integerValue")
<*> (o .:? "entityValue")
<*> (o .:? "doubleValue")
<*> (o .:? "stringValue")
<*> (o .:? "listValue" .!= mempty)
<*> (o .:? "indexed")
<*> (o .:? "booleanValue")
<*> (o .:? "meaning")
<*> (o .:? "blobValue"))
instance ToJSON Value where
toJSON Value{..}
= object
(catMaybes
[("keyValue" .=) <$> _vKeyValue,
("blobKeyValue" .=) <$> _vBlobKeyValue,
("dateTimeValue" .=) <$> _vDateTimeValue,
("integerValue" .=) <$> _vIntegerValue,
("entityValue" .=) <$> _vEntityValue,
("doubleValue" .=) <$> _vDoubleValue,
("stringValue" .=) <$> _vStringValue,
("listValue" .=) <$> _vListValue,
("indexed" .=) <$> _vIndexed,
("booleanValue" .=) <$> _vBooleanValue,
("meaning" .=) <$> _vMeaning,
("blobValue" .=) <$> _vBlobValue])
data LookupRequest = LookupRequest
{ _lrKeys :: !(Maybe [Key])
, _lrReadOptions :: !(Maybe ReadOptions)
} deriving (Eq,Show,Data,Typeable,Generic)
lookupRequest
:: LookupRequest
lookupRequest =
LookupRequest
{ _lrKeys = Nothing
, _lrReadOptions = Nothing
}
lrKeys :: Lens' LookupRequest [Key]
lrKeys
= lens _lrKeys (\ s a -> s{_lrKeys = a}) . _Default .
_Coerce
lrReadOptions :: Lens' LookupRequest (Maybe ReadOptions)
lrReadOptions
= lens _lrReadOptions
(\ s a -> s{_lrReadOptions = a})
instance FromJSON LookupRequest where
parseJSON
= withObject "LookupRequest"
(\ o ->
LookupRequest <$>
(o .:? "keys" .!= mempty) <*> (o .:? "readOptions"))
instance ToJSON LookupRequest where
toJSON LookupRequest{..}
= object
(catMaybes
[("keys" .=) <$> _lrKeys,
("readOptions" .=) <$> _lrReadOptions])
data Mutation = Mutation
{ _mInsert :: !(Maybe [Entity])
, _mForce :: !(Maybe Bool)
, _mInsertAutoId :: !(Maybe [Entity])
, _mUpsert :: !(Maybe [Entity])
, _mDelete :: !(Maybe [Key])
, _mUpdate :: !(Maybe [Entity])
} deriving (Eq,Show,Data,Typeable,Generic)
mutation
:: Mutation
mutation =
Mutation
{ _mInsert = Nothing
, _mForce = Nothing
, _mInsertAutoId = Nothing
, _mUpsert = Nothing
, _mDelete = Nothing
, _mUpdate = Nothing
}
mInsert :: Lens' Mutation [Entity]
mInsert
= lens _mInsert (\ s a -> s{_mInsert = a}) . _Default
. _Coerce
mForce :: Lens' Mutation (Maybe Bool)
mForce = lens _mForce (\ s a -> s{_mForce = a})
mInsertAutoId :: Lens' Mutation [Entity]
mInsertAutoId
= lens _mInsertAutoId
(\ s a -> s{_mInsertAutoId = a})
. _Default
. _Coerce
mUpsert :: Lens' Mutation [Entity]
mUpsert
= lens _mUpsert (\ s a -> s{_mUpsert = a}) . _Default
. _Coerce
mDelete :: Lens' Mutation [Key]
mDelete
= lens _mDelete (\ s a -> s{_mDelete = a}) . _Default
. _Coerce
mUpdate :: Lens' Mutation [Entity]
mUpdate
= lens _mUpdate (\ s a -> s{_mUpdate = a}) . _Default
. _Coerce
instance FromJSON Mutation where
parseJSON
= withObject "Mutation"
(\ o ->
Mutation <$>
(o .:? "insert" .!= mempty) <*> (o .:? "force") <*>
(o .:? "insertAutoId" .!= mempty)
<*> (o .:? "upsert" .!= mempty)
<*> (o .:? "delete" .!= mempty)
<*> (o .:? "update" .!= mempty))
instance ToJSON Mutation where
toJSON Mutation{..}
= object
(catMaybes
[("insert" .=) <$> _mInsert,
("force" .=) <$> _mForce,
("insertAutoId" .=) <$> _mInsertAutoId,
("upsert" .=) <$> _mUpsert,
("delete" .=) <$> _mDelete,
("update" .=) <$> _mUpdate])
newtype ResponseHeader = ResponseHeader
{ _rhKind :: Text
} deriving (Eq,Show,Data,Typeable,Generic)
responseHeader
:: ResponseHeader
responseHeader =
ResponseHeader
{ _rhKind = "datastore#responseHeader"
}
rhKind :: Lens' ResponseHeader Text
rhKind = lens _rhKind (\ s a -> s{_rhKind = a})
instance FromJSON ResponseHeader where
parseJSON
= withObject "ResponseHeader"
(\ o ->
ResponseHeader <$>
(o .:? "kind" .!= "datastore#responseHeader"))
instance ToJSON ResponseHeader where
toJSON ResponseHeader{..}
= object (catMaybes [Just ("kind" .= _rhKind)])
data KeyPathElement = KeyPathElement
{ _kpeKind :: !(Maybe Text)
, _kpeName :: !(Maybe Text)
, _kpeId :: !(Maybe (Textual Int64))
} deriving (Eq,Show,Data,Typeable,Generic)
keyPathElement
:: KeyPathElement
keyPathElement =
KeyPathElement
{ _kpeKind = Nothing
, _kpeName = Nothing
, _kpeId = Nothing
}
kpeKind :: Lens' KeyPathElement (Maybe Text)
kpeKind = lens _kpeKind (\ s a -> s{_kpeKind = a})
kpeName :: Lens' KeyPathElement (Maybe Text)
kpeName = lens _kpeName (\ s a -> s{_kpeName = a})
kpeId :: Lens' KeyPathElement (Maybe Int64)
kpeId
= lens _kpeId (\ s a -> s{_kpeId = a}) .
mapping _Coerce
instance FromJSON KeyPathElement where
parseJSON
= withObject "KeyPathElement"
(\ o ->
KeyPathElement <$>
(o .:? "kind") <*> (o .:? "name") <*> (o .:? "id"))
instance ToJSON KeyPathElement where
toJSON KeyPathElement{..}
= object
(catMaybes
[("kind" .=) <$> _kpeKind, ("name" .=) <$> _kpeName,
("id" .=) <$> _kpeId])
newtype PropertyReference = PropertyReference
{ _prName :: Maybe Text
} deriving (Eq,Show,Data,Typeable,Generic)
propertyReference
:: PropertyReference
propertyReference =
PropertyReference
{ _prName = Nothing
}
prName :: Lens' PropertyReference (Maybe Text)
prName = lens _prName (\ s a -> s{_prName = a})
instance FromJSON PropertyReference where
parseJSON
= withObject "PropertyReference"
(\ o -> PropertyReference <$> (o .:? "name"))
instance ToJSON PropertyReference where
toJSON PropertyReference{..}
= object (catMaybes [("name" .=) <$> _prName])
data GqlQueryArg = GqlQueryArg
{ _gqaCursor :: !(Maybe (Textual Word8))
, _gqaValue :: !(Maybe Value)
, _gqaName :: !(Maybe Text)
} deriving (Eq,Show,Data,Typeable,Generic)
gqlQueryArg
:: GqlQueryArg
gqlQueryArg =
GqlQueryArg
{ _gqaCursor = Nothing
, _gqaValue = Nothing
, _gqaName = Nothing
}
gqaCursor :: Lens' GqlQueryArg (Maybe Word8)
gqaCursor
= lens _gqaCursor (\ s a -> s{_gqaCursor = a}) .
mapping _Coerce
gqaValue :: Lens' GqlQueryArg (Maybe Value)
gqaValue = lens _gqaValue (\ s a -> s{_gqaValue = a})
gqaName :: Lens' GqlQueryArg (Maybe Text)
gqaName = lens _gqaName (\ s a -> s{_gqaName = a})
instance FromJSON GqlQueryArg where
parseJSON
= withObject "GqlQueryArg"
(\ o ->
GqlQueryArg <$>
(o .:? "cursor") <*> (o .:? "value") <*>
(o .:? "name"))
instance ToJSON GqlQueryArg where
toJSON GqlQueryArg{..}
= object
(catMaybes
[("cursor" .=) <$> _gqaCursor,
("value" .=) <$> _gqaValue,
("name" .=) <$> _gqaName])
data Key = Key
{ _kPartitionId :: !(Maybe PartitionId)
, _kPath :: !(Maybe [KeyPathElement])
} deriving (Eq,Show,Data,Typeable,Generic)
key
:: Key
key =
Key
{ _kPartitionId = Nothing
, _kPath = Nothing
}
kPartitionId :: Lens' Key (Maybe PartitionId)
kPartitionId
= lens _kPartitionId (\ s a -> s{_kPartitionId = a})
kPath :: Lens' Key [KeyPathElement]
kPath
= lens _kPath (\ s a -> s{_kPath = a}) . _Default .
_Coerce
instance FromJSON Key where
parseJSON
= withObject "Key"
(\ o ->
Key <$>
(o .:? "partitionId") <*> (o .:? "path" .!= mempty))
instance ToJSON Key where
toJSON Key{..}
= object
(catMaybes
[("partitionId" .=) <$> _kPartitionId,
("path" .=) <$> _kPath])
data PropertyFilter = PropertyFilter
{ _pfProperty :: !(Maybe PropertyReference)
, _pfOperator :: !(Maybe PropertyFilterOperator)
, _pfValue :: !(Maybe Value)
} deriving (Eq,Show,Data,Typeable,Generic)
propertyFilter
:: PropertyFilter
propertyFilter =
PropertyFilter
{ _pfProperty = Nothing
, _pfOperator = Nothing
, _pfValue = Nothing
}
pfProperty :: Lens' PropertyFilter (Maybe PropertyReference)
pfProperty
= lens _pfProperty (\ s a -> s{_pfProperty = a})
pfOperator :: Lens' PropertyFilter (Maybe PropertyFilterOperator)
pfOperator
= lens _pfOperator (\ s a -> s{_pfOperator = a})
pfValue :: Lens' PropertyFilter (Maybe Value)
pfValue = lens _pfValue (\ s a -> s{_pfValue = a})
instance FromJSON PropertyFilter where
parseJSON
= withObject "PropertyFilter"
(\ o ->
PropertyFilter <$>
(o .:? "property") <*> (o .:? "operator") <*>
(o .:? "value"))
instance ToJSON PropertyFilter where
toJSON PropertyFilter{..}
= object
(catMaybes
[("property" .=) <$> _pfProperty,
("operator" .=) <$> _pfOperator,
("value" .=) <$> _pfValue])
data Query = Query
{ _qGroupBy :: !(Maybe [PropertyReference])
, _qStartCursor :: !(Maybe (Textual Word8))
, _qOffSet :: !(Maybe (Textual Int32))
, _qEndCursor :: !(Maybe (Textual Word8))
, _qLimit :: !(Maybe (Textual Int32))
, _qProjection :: !(Maybe [PropertyExpression])
, _qFilter :: !(Maybe Filter)
, _qKinds :: !(Maybe [KindExpression])
, _qOrder :: !(Maybe [PropertyOrder])
} deriving (Eq,Show,Data,Typeable,Generic)
query
:: Query
query =
Query
{ _qGroupBy = Nothing
, _qStartCursor = Nothing
, _qOffSet = Nothing
, _qEndCursor = Nothing
, _qLimit = Nothing
, _qProjection = Nothing
, _qFilter = Nothing
, _qKinds = Nothing
, _qOrder = Nothing
}
qGroupBy :: Lens' Query [PropertyReference]
qGroupBy
= lens _qGroupBy (\ s a -> s{_qGroupBy = a}) .
_Default
. _Coerce
qStartCursor :: Lens' Query (Maybe Word8)
qStartCursor
= lens _qStartCursor (\ s a -> s{_qStartCursor = a})
. mapping _Coerce
qOffSet :: Lens' Query (Maybe Int32)
qOffSet
= lens _qOffSet (\ s a -> s{_qOffSet = a}) .
mapping _Coerce
qEndCursor :: Lens' Query (Maybe Word8)
qEndCursor
= lens _qEndCursor (\ s a -> s{_qEndCursor = a}) .
mapping _Coerce
qLimit :: Lens' Query (Maybe Int32)
qLimit
= lens _qLimit (\ s a -> s{_qLimit = a}) .
mapping _Coerce
qProjection :: Lens' Query [PropertyExpression]
qProjection
= lens _qProjection (\ s a -> s{_qProjection = a}) .
_Default
. _Coerce
qFilter :: Lens' Query (Maybe Filter)
qFilter = lens _qFilter (\ s a -> s{_qFilter = a})
qKinds :: Lens' Query [KindExpression]
qKinds
= lens _qKinds (\ s a -> s{_qKinds = a}) . _Default .
_Coerce
qOrder :: Lens' Query [PropertyOrder]
qOrder
= lens _qOrder (\ s a -> s{_qOrder = a}) . _Default .
_Coerce
instance FromJSON Query where
parseJSON
= withObject "Query"
(\ o ->
Query <$>
(o .:? "groupBy" .!= mempty) <*>
(o .:? "startCursor")
<*> (o .:? "offset")
<*> (o .:? "endCursor")
<*> (o .:? "limit")
<*> (o .:? "projection" .!= mempty)
<*> (o .:? "filter")
<*> (o .:? "kinds" .!= mempty)
<*> (o .:? "order" .!= mempty))
instance ToJSON Query where
toJSON Query{..}
= object
(catMaybes
[("groupBy" .=) <$> _qGroupBy,
("startCursor" .=) <$> _qStartCursor,
("offset" .=) <$> _qOffSet,
("endCursor" .=) <$> _qEndCursor,
("limit" .=) <$> _qLimit,
("projection" .=) <$> _qProjection,
("filter" .=) <$> _qFilter, ("kinds" .=) <$> _qKinds,
("order" .=) <$> _qOrder])
newtype EntityResult = EntityResult
{ _erEntity :: Maybe Entity
} deriving (Eq,Show,Data,Typeable,Generic)
entityResult
:: EntityResult
entityResult =
EntityResult
{ _erEntity = Nothing
}
erEntity :: Lens' EntityResult (Maybe Entity)
erEntity = lens _erEntity (\ s a -> s{_erEntity = a})
instance FromJSON EntityResult where
parseJSON
= withObject "EntityResult"
(\ o -> EntityResult <$> (o .:? "entity"))
instance ToJSON EntityResult where
toJSON EntityResult{..}
= object (catMaybes [("entity" .=) <$> _erEntity])
data CommitResponse = CommitResponse
{ _crMutationResult :: !(Maybe MutationResult)
, _crHeader :: !(Maybe ResponseHeader)
} deriving (Eq,Show,Data,Typeable,Generic)
commitResponse
:: CommitResponse
commitResponse =
CommitResponse
{ _crMutationResult = Nothing
, _crHeader = Nothing
}
crMutationResult :: Lens' CommitResponse (Maybe MutationResult)
crMutationResult
= lens _crMutationResult
(\ s a -> s{_crMutationResult = a})
crHeader :: Lens' CommitResponse (Maybe ResponseHeader)
crHeader = lens _crHeader (\ s a -> s{_crHeader = a})
instance FromJSON CommitResponse where
parseJSON
= withObject "CommitResponse"
(\ o ->
CommitResponse <$>
(o .:? "mutationResult") <*> (o .:? "header"))
instance ToJSON CommitResponse where
toJSON CommitResponse{..}
= object
(catMaybes
[("mutationResult" .=) <$> _crMutationResult,
("header" .=) <$> _crHeader])
newtype KindExpression = KindExpression
{ _keName :: Maybe Text
} deriving (Eq,Show,Data,Typeable,Generic)
kindExpression
:: KindExpression
kindExpression =
KindExpression
{ _keName = Nothing
}
keName :: Lens' KindExpression (Maybe Text)
keName = lens _keName (\ s a -> s{_keName = a})
instance FromJSON KindExpression where
parseJSON
= withObject "KindExpression"
(\ o -> KindExpression <$> (o .:? "name"))
instance ToJSON KindExpression where
toJSON KindExpression{..}
= object (catMaybes [("name" .=) <$> _keName])
data ReadOptions = ReadOptions
{ _roReadConsistency :: !(Maybe ReadOptionsReadConsistency)
, _roTransaction :: !(Maybe (Textual Word8))
} deriving (Eq,Show,Data,Typeable,Generic)
readOptions
:: ReadOptions
readOptions =
ReadOptions
{ _roReadConsistency = Nothing
, _roTransaction = Nothing
}
roReadConsistency :: Lens' ReadOptions (Maybe ReadOptionsReadConsistency)
roReadConsistency
= lens _roReadConsistency
(\ s a -> s{_roReadConsistency = a})
roTransaction :: Lens' ReadOptions (Maybe Word8)
roTransaction
= lens _roTransaction
(\ s a -> s{_roTransaction = a})
. mapping _Coerce
instance FromJSON ReadOptions where
parseJSON
= withObject "ReadOptions"
(\ o ->
ReadOptions <$>
(o .:? "readConsistency") <*> (o .:? "transaction"))
instance ToJSON ReadOptions where
toJSON ReadOptions{..}
= object
(catMaybes
[("readConsistency" .=) <$> _roReadConsistency,
("transaction" .=) <$> _roTransaction])
newtype RollbackResponse = RollbackResponse
{ _rrHeader :: Maybe ResponseHeader
} deriving (Eq,Show,Data,Typeable,Generic)
rollbackResponse
:: RollbackResponse
rollbackResponse =
RollbackResponse
{ _rrHeader = Nothing
}
rrHeader :: Lens' RollbackResponse (Maybe ResponseHeader)
rrHeader = lens _rrHeader (\ s a -> s{_rrHeader = a})
instance FromJSON RollbackResponse where
parseJSON
= withObject "RollbackResponse"
(\ o -> RollbackResponse <$> (o .:? "header"))
instance ToJSON RollbackResponse where
toJSON RollbackResponse{..}
= object (catMaybes [("header" .=) <$> _rrHeader])
data PropertyExpression = PropertyExpression
{ _peProperty :: !(Maybe PropertyReference)
, _peAggregationFunction :: !(Maybe PropertyExpressionAggregationFunction)
} deriving (Eq,Show,Data,Typeable,Generic)
propertyExpression
:: PropertyExpression
propertyExpression =
PropertyExpression
{ _peProperty = Nothing
, _peAggregationFunction = Nothing
}
peProperty :: Lens' PropertyExpression (Maybe PropertyReference)
peProperty
= lens _peProperty (\ s a -> s{_peProperty = a})
peAggregationFunction :: Lens' PropertyExpression (Maybe PropertyExpressionAggregationFunction)
peAggregationFunction
= lens _peAggregationFunction
(\ s a -> s{_peAggregationFunction = a})
instance FromJSON PropertyExpression where
parseJSON
= withObject "PropertyExpression"
(\ o ->
PropertyExpression <$>
(o .:? "property") <*> (o .:? "aggregationFunction"))
instance ToJSON PropertyExpression where
toJSON PropertyExpression{..}
= object
(catMaybes
[("property" .=) <$> _peProperty,
("aggregationFunction" .=) <$>
_peAggregationFunction])
data Filter = Filter
{ _fCompositeFilter :: !(Maybe CompositeFilter)
, _fPropertyFilter :: !(Maybe PropertyFilter)
} deriving (Eq,Show,Data,Typeable,Generic)
filter'
:: Filter
filter' =
Filter
{ _fCompositeFilter = Nothing
, _fPropertyFilter = Nothing
}
fCompositeFilter :: Lens' Filter (Maybe CompositeFilter)
fCompositeFilter
= lens _fCompositeFilter
(\ s a -> s{_fCompositeFilter = a})
fPropertyFilter :: Lens' Filter (Maybe PropertyFilter)
fPropertyFilter
= lens _fPropertyFilter
(\ s a -> s{_fPropertyFilter = a})
instance FromJSON Filter where
parseJSON
= withObject "Filter"
(\ o ->
Filter <$>
(o .:? "compositeFilter") <*>
(o .:? "propertyFilter"))
instance ToJSON Filter where
toJSON Filter{..}
= object
(catMaybes
[("compositeFilter" .=) <$> _fCompositeFilter,
("propertyFilter" .=) <$> _fPropertyFilter])
data CommitRequest = CommitRequest
{ _crMode :: !(Maybe CommitRequestMode)
, _crMutation :: !(Maybe Mutation)
, _crTransaction :: !(Maybe (Textual Word8))
, _crIgnoreReadOnly :: !(Maybe Bool)
} deriving (Eq,Show,Data,Typeable,Generic)
commitRequest
:: CommitRequest
commitRequest =
CommitRequest
{ _crMode = Nothing
, _crMutation = Nothing
, _crTransaction = Nothing
, _crIgnoreReadOnly = Nothing
}
crMode :: Lens' CommitRequest (Maybe CommitRequestMode)
crMode = lens _crMode (\ s a -> s{_crMode = a})
crMutation :: Lens' CommitRequest (Maybe Mutation)
crMutation
= lens _crMutation (\ s a -> s{_crMutation = a})
crTransaction :: Lens' CommitRequest (Maybe Word8)
crTransaction
= lens _crTransaction
(\ s a -> s{_crTransaction = a})
. mapping _Coerce
crIgnoreReadOnly :: Lens' CommitRequest (Maybe Bool)
crIgnoreReadOnly
= lens _crIgnoreReadOnly
(\ s a -> s{_crIgnoreReadOnly = a})
instance FromJSON CommitRequest where
parseJSON
= withObject "CommitRequest"
(\ o ->
CommitRequest <$>
(o .:? "mode") <*> (o .:? "mutation") <*>
(o .:? "transaction")
<*> (o .:? "ignoreReadOnly"))
instance ToJSON CommitRequest where
toJSON CommitRequest{..}
= object
(catMaybes
[("mode" .=) <$> _crMode,
("mutation" .=) <$> _crMutation,
("transaction" .=) <$> _crTransaction,
("ignoreReadOnly" .=) <$> _crIgnoreReadOnly])
data Entity = Entity
{ _eKey :: !(Maybe Key)
, _eProperties :: !(Maybe EntityProperties)
} deriving (Eq,Show,Data,Typeable,Generic)
entity
:: Entity
entity =
Entity
{ _eKey = Nothing
, _eProperties = Nothing
}
eKey :: Lens' Entity (Maybe Key)
eKey = lens _eKey (\ s a -> s{_eKey = a})
eProperties :: Lens' Entity (Maybe EntityProperties)
eProperties
= lens _eProperties (\ s a -> s{_eProperties = a})
instance FromJSON Entity where
parseJSON
= withObject "Entity"
(\ o ->
Entity <$> (o .:? "key") <*> (o .:? "properties"))
instance ToJSON Entity where
toJSON Entity{..}
= object
(catMaybes
[("key" .=) <$> _eKey,
("properties" .=) <$> _eProperties])
data LookupResponse = LookupResponse
{ _lrDeferred :: !(Maybe [Key])
, _lrFound :: !(Maybe [EntityResult])
, _lrMissing :: !(Maybe [EntityResult])
, _lrHeader :: !(Maybe ResponseHeader)
} deriving (Eq,Show,Data,Typeable,Generic)
lookupResponse
:: LookupResponse
lookupResponse =
LookupResponse
{ _lrDeferred = Nothing
, _lrFound = Nothing
, _lrMissing = Nothing
, _lrHeader = Nothing
}
lrDeferred :: Lens' LookupResponse [Key]
lrDeferred
= lens _lrDeferred (\ s a -> s{_lrDeferred = a}) .
_Default
. _Coerce
lrFound :: Lens' LookupResponse [EntityResult]
lrFound
= lens _lrFound (\ s a -> s{_lrFound = a}) . _Default
. _Coerce
lrMissing :: Lens' LookupResponse [EntityResult]
lrMissing
= lens _lrMissing (\ s a -> s{_lrMissing = a}) .
_Default
. _Coerce
lrHeader :: Lens' LookupResponse (Maybe ResponseHeader)
lrHeader = lens _lrHeader (\ s a -> s{_lrHeader = a})
instance FromJSON LookupResponse where
parseJSON
= withObject "LookupResponse"
(\ o ->
LookupResponse <$>
(o .:? "deferred" .!= mempty) <*>
(o .:? "found" .!= mempty)
<*> (o .:? "missing" .!= mempty)
<*> (o .:? "header"))
instance ToJSON LookupResponse where
toJSON LookupResponse{..}
= object
(catMaybes
[("deferred" .=) <$> _lrDeferred,
("found" .=) <$> _lrFound,
("missing" .=) <$> _lrMissing,
("header" .=) <$> _lrHeader])
data PropertyOrder = PropertyOrder
{ _poProperty :: !(Maybe PropertyReference)
, _poDirection :: !(Maybe PropertyOrderDirection)
} deriving (Eq,Show,Data,Typeable,Generic)
propertyOrder
:: PropertyOrder
propertyOrder =
PropertyOrder
{ _poProperty = Nothing
, _poDirection = Nothing
}
poProperty :: Lens' PropertyOrder (Maybe PropertyReference)
poProperty
= lens _poProperty (\ s a -> s{_poProperty = a})
poDirection :: Lens' PropertyOrder (Maybe PropertyOrderDirection)
poDirection
= lens _poDirection (\ s a -> s{_poDirection = a})
instance FromJSON PropertyOrder where
parseJSON
= withObject "PropertyOrder"
(\ o ->
PropertyOrder <$>
(o .:? "property") <*> (o .:? "direction"))
instance ToJSON PropertyOrder where
toJSON PropertyOrder{..}
= object
(catMaybes
[("property" .=) <$> _poProperty,
("direction" .=) <$> _poDirection])