{-# 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.Datastore.Types.Product where
import Network.Google.Datastore.Types.Sum
import Network.Google.Prelude
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])
newtype RollbackRequest = RollbackRequest'
{ _rrTransaction :: Maybe Base64
} deriving (Eq,Show,Data,Typeable,Generic)
rollbackRequest
:: RollbackRequest
rollbackRequest =
RollbackRequest'
{ _rrTransaction = Nothing
}
rrTransaction :: Lens' RollbackRequest (Maybe ByteString)
rrTransaction
= lens _rrTransaction
(\ s a -> s{_rrTransaction = a})
. mapping _Base64
instance FromJSON RollbackRequest where
parseJSON
= withObject "RollbackRequest"
(\ o -> RollbackRequest' <$> (o .:? "transaction"))
instance ToJSON RollbackRequest where
toJSON RollbackRequest'{..}
= object
(catMaybes [("transaction" .=) <$> _rrTransaction])
data PartitionId = PartitionId'
{ _piNamespaceId :: !(Maybe Text)
, _piProjectId :: !(Maybe Text)
} deriving (Eq,Show,Data,Typeable,Generic)
partitionId
:: PartitionId
partitionId =
PartitionId'
{ _piNamespaceId = Nothing
, _piProjectId = Nothing
}
piNamespaceId :: Lens' PartitionId (Maybe Text)
piNamespaceId
= lens _piNamespaceId
(\ s a -> s{_piNamespaceId = a})
piProjectId :: Lens' PartitionId (Maybe Text)
piProjectId
= lens _piProjectId (\ s a -> s{_piProjectId = a})
instance FromJSON PartitionId where
parseJSON
= withObject "PartitionId"
(\ o ->
PartitionId' <$>
(o .:? "namespaceId") <*> (o .:? "projectId"))
instance ToJSON PartitionId where
toJSON PartitionId'{..}
= object
(catMaybes
[("namespaceId" .=) <$> _piNamespaceId,
("projectId" .=) <$> _piProjectId])
data QueryResultBatch = QueryResultBatch'
{ _qrbSkippedResults :: !(Maybe (Textual Int32))
, _qrbSkippedCursor :: !(Maybe Base64)
, _qrbEntityResultType :: !(Maybe QueryResultBatchEntityResultType)
, _qrbEntityResults :: !(Maybe [EntityResult])
, _qrbMoreResults :: !(Maybe QueryResultBatchMoreResults)
, _qrbEndCursor :: !(Maybe Base64)
} deriving (Eq,Show,Data,Typeable,Generic)
queryResultBatch
:: QueryResultBatch
queryResultBatch =
QueryResultBatch'
{ _qrbSkippedResults = Nothing
, _qrbSkippedCursor = Nothing
, _qrbEntityResultType = Nothing
, _qrbEntityResults = Nothing
, _qrbMoreResults = Nothing
, _qrbEndCursor = Nothing
}
qrbSkippedResults :: Lens' QueryResultBatch (Maybe Int32)
qrbSkippedResults
= lens _qrbSkippedResults
(\ s a -> s{_qrbSkippedResults = a})
. mapping _Coerce
qrbSkippedCursor :: Lens' QueryResultBatch (Maybe ByteString)
qrbSkippedCursor
= lens _qrbSkippedCursor
(\ s a -> s{_qrbSkippedCursor = a})
. mapping _Base64
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 ByteString)
qrbEndCursor
= lens _qrbEndCursor (\ s a -> s{_qrbEndCursor = a})
. mapping _Base64
instance FromJSON QueryResultBatch where
parseJSON
= withObject "QueryResultBatch"
(\ o ->
QueryResultBatch' <$>
(o .:? "skippedResults") <*> (o .:? "skippedCursor")
<*> (o .:? "entityResultType")
<*> (o .:? "entityResults" .!= mempty)
<*> (o .:? "moreResults")
<*> (o .:? "endCursor"))
instance ToJSON QueryResultBatch where
toJSON QueryResultBatch'{..}
= object
(catMaybes
[("skippedResults" .=) <$> _qrbSkippedResults,
("skippedCursor" .=) <$> _qrbSkippedCursor,
("entityResultType" .=) <$> _qrbEntityResultType,
("entityResults" .=) <$> _qrbEntityResults,
("moreResults" .=) <$> _qrbMoreResults,
("endCursor" .=) <$> _qrbEndCursor])
newtype EntityProperties = EntityProperties'
{ _epAddtional :: HashMap Text Value
} deriving (Eq,Show,Data,Typeable,Generic)
entityProperties
:: HashMap Text Value
-> EntityProperties
entityProperties pEpAddtional_ =
EntityProperties'
{ _epAddtional = _Coerce # pEpAddtional_
}
epAddtional :: Lens' EntityProperties (HashMap Text Value)
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
data BeginTransactionRequest =
BeginTransactionRequest'
deriving (Eq,Show,Data,Typeable,Generic)
beginTransactionRequest
:: BeginTransactionRequest
beginTransactionRequest = BeginTransactionRequest'
instance FromJSON BeginTransactionRequest where
parseJSON
= withObject "BeginTransactionRequest"
(\ o -> pure BeginTransactionRequest')
instance ToJSON BeginTransactionRequest where
toJSON = const emptyObject
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'
{ _cfOp :: !(Maybe CompositeFilterOp)
, _cfFilters :: !(Maybe [Filter])
} deriving (Eq,Show,Data,Typeable,Generic)
compositeFilter
:: CompositeFilter
compositeFilter =
CompositeFilter'
{ _cfOp = Nothing
, _cfFilters = Nothing
}
cfOp :: Lens' CompositeFilter (Maybe CompositeFilterOp)
cfOp = lens _cfOp (\ s a -> s{_cfOp = 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 .:? "op") <*> (o .:? "filters" .!= mempty))
instance ToJSON CompositeFilter where
toJSON CompositeFilter'{..}
= object
(catMaybes
[("op" .=) <$> _cfOp, ("filters" .=) <$> _cfFilters])
newtype BeginTransactionResponse = BeginTransactionResponse'
{ _btrTransaction :: Maybe Base64
} deriving (Eq,Show,Data,Typeable,Generic)
beginTransactionResponse
:: BeginTransactionResponse
beginTransactionResponse =
BeginTransactionResponse'
{ _btrTransaction = Nothing
}
btrTransaction :: Lens' BeginTransactionResponse (Maybe ByteString)
btrTransaction
= lens _btrTransaction
(\ s a -> s{_btrTransaction = a})
. mapping _Base64
instance FromJSON BeginTransactionResponse where
parseJSON
= withObject "BeginTransactionResponse"
(\ o ->
BeginTransactionResponse' <$> (o .:? "transaction"))
instance ToJSON BeginTransactionResponse where
toJSON BeginTransactionResponse'{..}
= object
(catMaybes [("transaction" .=) <$> _btrTransaction])
newtype MutationResult = MutationResult'
{ _mrKey :: Maybe Key
} deriving (Eq,Show,Data,Typeable,Generic)
mutationResult
:: MutationResult
mutationResult =
MutationResult'
{ _mrKey = Nothing
}
mrKey :: Lens' MutationResult (Maybe Key)
mrKey = lens _mrKey (\ s a -> s{_mrKey = a})
instance FromJSON MutationResult where
parseJSON
= withObject "MutationResult"
(\ o -> MutationResult' <$> (o .:? "key"))
instance ToJSON MutationResult where
toJSON MutationResult'{..}
= object (catMaybes [("key" .=) <$> _mrKey])
newtype AllocateIdsResponse = AllocateIdsResponse'
{ _aKeys :: Maybe [Key]
} deriving (Eq,Show,Data,Typeable,Generic)
allocateIdsResponse
:: AllocateIdsResponse
allocateIdsResponse =
AllocateIdsResponse'
{ _aKeys = Nothing
}
aKeys :: Lens' AllocateIdsResponse [Key]
aKeys
= lens _aKeys (\ s a -> s{_aKeys = a}) . _Default .
_Coerce
instance FromJSON AllocateIdsResponse where
parseJSON
= withObject "AllocateIdsResponse"
(\ o ->
AllocateIdsResponse' <$> (o .:? "keys" .!= mempty))
instance ToJSON AllocateIdsResponse where
toJSON AllocateIdsResponse'{..}
= object (catMaybes [("keys" .=) <$> _aKeys])
data GqlQuery = GqlQuery'
{ _gqPositionalBindings :: !(Maybe [GqlQueryParameter])
, _gqNamedBindings :: !(Maybe GqlQueryNamedBindings)
, _gqQueryString :: !(Maybe Text)
, _gqAllowLiterals :: !(Maybe Bool)
} deriving (Eq,Show,Data,Typeable,Generic)
gqlQuery
:: GqlQuery
gqlQuery =
GqlQuery'
{ _gqPositionalBindings = Nothing
, _gqNamedBindings = Nothing
, _gqQueryString = Nothing
, _gqAllowLiterals = Nothing
}
gqPositionalBindings :: Lens' GqlQuery [GqlQueryParameter]
gqPositionalBindings
= lens _gqPositionalBindings
(\ s a -> s{_gqPositionalBindings = a})
. _Default
. _Coerce
gqNamedBindings :: Lens' GqlQuery (Maybe GqlQueryNamedBindings)
gqNamedBindings
= lens _gqNamedBindings
(\ s a -> s{_gqNamedBindings = a})
gqQueryString :: Lens' GqlQuery (Maybe Text)
gqQueryString
= lens _gqQueryString
(\ s a -> s{_gqQueryString = a})
gqAllowLiterals :: Lens' GqlQuery (Maybe Bool)
gqAllowLiterals
= lens _gqAllowLiterals
(\ s a -> s{_gqAllowLiterals = a})
instance FromJSON GqlQuery where
parseJSON
= withObject "GqlQuery"
(\ o ->
GqlQuery' <$>
(o .:? "positionalBindings" .!= mempty) <*>
(o .:? "namedBindings")
<*> (o .:? "queryString")
<*> (o .:? "allowLiterals"))
instance ToJSON GqlQuery where
toJSON GqlQuery'{..}
= object
(catMaybes
[("positionalBindings" .=) <$> _gqPositionalBindings,
("namedBindings" .=) <$> _gqNamedBindings,
("queryString" .=) <$> _gqQueryString,
("allowLiterals" .=) <$> _gqAllowLiterals])
data RunQueryResponse = RunQueryResponse'
{ _rBatch :: !(Maybe QueryResultBatch)
, _rQuery :: !(Maybe Query)
} deriving (Eq,Show,Data,Typeable,Generic)
runQueryResponse
:: RunQueryResponse
runQueryResponse =
RunQueryResponse'
{ _rBatch = Nothing
, _rQuery = Nothing
}
rBatch :: Lens' RunQueryResponse (Maybe QueryResultBatch)
rBatch = lens _rBatch (\ s a -> s{_rBatch = a})
rQuery :: Lens' RunQueryResponse (Maybe Query)
rQuery = lens _rQuery (\ s a -> s{_rQuery = a})
instance FromJSON RunQueryResponse where
parseJSON
= withObject "RunQueryResponse"
(\ o ->
RunQueryResponse' <$>
(o .:? "batch") <*> (o .:? "query"))
instance ToJSON RunQueryResponse where
toJSON RunQueryResponse'{..}
= object
(catMaybes
[("batch" .=) <$> _rBatch, ("query" .=) <$> _rQuery])
data Value = Value'
{ _vKeyValue :: !(Maybe Key)
, _vGeoPointValue :: !(Maybe LatLng)
, _vIntegerValue :: !(Maybe (Textual Int64))
, _vTimestampValue :: !(Maybe DateTime')
, _vEntityValue :: !(Maybe Entity)
, _vExcludeFromIndexes :: !(Maybe Bool)
, _vDoubleValue :: !(Maybe (Textual Double))
, _vStringValue :: !(Maybe Text)
, _vBooleanValue :: !(Maybe Bool)
, _vMeaning :: !(Maybe (Textual Int32))
, _vArrayValue :: !(Maybe ArrayValue)
, _vNullValue :: !(Maybe ValueNullValue)
, _vBlobValue :: !(Maybe Base64)
} deriving (Eq,Show,Data,Typeable,Generic)
value
:: Value
value =
Value'
{ _vKeyValue = Nothing
, _vGeoPointValue = Nothing
, _vIntegerValue = Nothing
, _vTimestampValue = Nothing
, _vEntityValue = Nothing
, _vExcludeFromIndexes = Nothing
, _vDoubleValue = Nothing
, _vStringValue = Nothing
, _vBooleanValue = Nothing
, _vMeaning = Nothing
, _vArrayValue = Nothing
, _vNullValue = Nothing
, _vBlobValue = Nothing
}
vKeyValue :: Lens' Value (Maybe Key)
vKeyValue
= lens _vKeyValue (\ s a -> s{_vKeyValue = a})
vGeoPointValue :: Lens' Value (Maybe LatLng)
vGeoPointValue
= lens _vGeoPointValue
(\ s a -> s{_vGeoPointValue = a})
vIntegerValue :: Lens' Value (Maybe Int64)
vIntegerValue
= lens _vIntegerValue
(\ s a -> s{_vIntegerValue = a})
. mapping _Coerce
vTimestampValue :: Lens' Value (Maybe UTCTime)
vTimestampValue
= lens _vTimestampValue
(\ s a -> s{_vTimestampValue = a})
. mapping _DateTime
vEntityValue :: Lens' Value (Maybe Entity)
vEntityValue
= lens _vEntityValue (\ s a -> s{_vEntityValue = a})
vExcludeFromIndexes :: Lens' Value (Maybe Bool)
vExcludeFromIndexes
= lens _vExcludeFromIndexes
(\ s a -> s{_vExcludeFromIndexes = 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})
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
vArrayValue :: Lens' Value (Maybe ArrayValue)
vArrayValue
= lens _vArrayValue (\ s a -> s{_vArrayValue = a})
vNullValue :: Lens' Value (Maybe ValueNullValue)
vNullValue
= lens _vNullValue (\ s a -> s{_vNullValue = a})
vBlobValue :: Lens' Value (Maybe ByteString)
vBlobValue
= lens _vBlobValue (\ s a -> s{_vBlobValue = a}) .
mapping _Base64
instance FromJSON Value where
parseJSON
= withObject "Value"
(\ o ->
Value' <$>
(o .:? "keyValue") <*> (o .:? "geoPointValue") <*>
(o .:? "integerValue")
<*> (o .:? "timestampValue")
<*> (o .:? "entityValue")
<*> (o .:? "excludeFromIndexes")
<*> (o .:? "doubleValue")
<*> (o .:? "stringValue")
<*> (o .:? "booleanValue")
<*> (o .:? "meaning")
<*> (o .:? "arrayValue")
<*> (o .:? "nullValue")
<*> (o .:? "blobValue"))
instance ToJSON Value where
toJSON Value'{..}
= object
(catMaybes
[("keyValue" .=) <$> _vKeyValue,
("geoPointValue" .=) <$> _vGeoPointValue,
("integerValue" .=) <$> _vIntegerValue,
("timestampValue" .=) <$> _vTimestampValue,
("entityValue" .=) <$> _vEntityValue,
("excludeFromIndexes" .=) <$> _vExcludeFromIndexes,
("doubleValue" .=) <$> _vDoubleValue,
("stringValue" .=) <$> _vStringValue,
("booleanValue" .=) <$> _vBooleanValue,
("meaning" .=) <$> _vMeaning,
("arrayValue" .=) <$> _vArrayValue,
("nullValue" .=) <$> _vNullValue,
("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)
, _mUpsert :: !(Maybe Entity)
, _mDelete :: !(Maybe Key)
, _mUpdate :: !(Maybe Entity)
} deriving (Eq,Show,Data,Typeable,Generic)
mutation
:: Mutation
mutation =
Mutation'
{ _mInsert = Nothing
, _mUpsert = Nothing
, _mDelete = Nothing
, _mUpdate = Nothing
}
mInsert :: Lens' Mutation (Maybe Entity)
mInsert = lens _mInsert (\ s a -> s{_mInsert = a})
mUpsert :: Lens' Mutation (Maybe Entity)
mUpsert = lens _mUpsert (\ s a -> s{_mUpsert = a})
mDelete :: Lens' Mutation (Maybe Key)
mDelete = lens _mDelete (\ s a -> s{_mDelete = a})
mUpdate :: Lens' Mutation (Maybe Entity)
mUpdate = lens _mUpdate (\ s a -> s{_mUpdate = a})
instance FromJSON Mutation where
parseJSON
= withObject "Mutation"
(\ o ->
Mutation' <$>
(o .:? "insert") <*> (o .:? "upsert") <*>
(o .:? "delete")
<*> (o .:? "update"))
instance ToJSON Mutation where
toJSON Mutation'{..}
= object
(catMaybes
[("insert" .=) <$> _mInsert,
("upsert" .=) <$> _mUpsert,
("delete" .=) <$> _mDelete,
("update" .=) <$> _mUpdate])
newtype GqlQueryNamedBindings = GqlQueryNamedBindings'
{ _gqnbAddtional :: HashMap Text GqlQueryParameter
} deriving (Eq,Show,Data,Typeable,Generic)
gqlQueryNamedBindings
:: HashMap Text GqlQueryParameter
-> GqlQueryNamedBindings
gqlQueryNamedBindings pGqnbAddtional_ =
GqlQueryNamedBindings'
{ _gqnbAddtional = _Coerce # pGqnbAddtional_
}
gqnbAddtional :: Lens' GqlQueryNamedBindings (HashMap Text GqlQueryParameter)
gqnbAddtional
= lens _gqnbAddtional
(\ s a -> s{_gqnbAddtional = a})
. _Coerce
instance FromJSON GqlQueryNamedBindings where
parseJSON
= withObject "GqlQueryNamedBindings"
(\ o ->
GqlQueryNamedBindings' <$> (parseJSONObject o))
instance ToJSON GqlQueryNamedBindings where
toJSON = toJSON . _gqnbAddtional
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 Key = Key'
{ _kPartitionId :: !(Maybe PartitionId)
, _kPath :: !(Maybe [PathElement])
} 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 [PathElement]
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)
, _pfOp :: !(Maybe PropertyFilterOp)
, _pfValue :: !(Maybe Value)
} deriving (Eq,Show,Data,Typeable,Generic)
propertyFilter
:: PropertyFilter
propertyFilter =
PropertyFilter'
{ _pfProperty = Nothing
, _pfOp = Nothing
, _pfValue = Nothing
}
pfProperty :: Lens' PropertyFilter (Maybe PropertyReference)
pfProperty
= lens _pfProperty (\ s a -> s{_pfProperty = a})
pfOp :: Lens' PropertyFilter (Maybe PropertyFilterOp)
pfOp = lens _pfOp (\ s a -> s{_pfOp = 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 .:? "op") <*>
(o .:? "value"))
instance ToJSON PropertyFilter where
toJSON PropertyFilter'{..}
= object
(catMaybes
[("property" .=) <$> _pfProperty,
("op" .=) <$> _pfOp, ("value" .=) <$> _pfValue])
data Query = Query'
{ _qStartCursor :: !(Maybe Base64)
, _qOffSet :: !(Maybe (Textual Int32))
, _qKind :: !(Maybe [KindExpression])
, _qDistinctOn :: !(Maybe [PropertyReference])
, _qEndCursor :: !(Maybe Base64)
, _qLimit :: !(Maybe (Textual Int32))
, _qProjection :: !(Maybe [Projection])
, _qFilter :: !(Maybe Filter)
, _qOrder :: !(Maybe [PropertyOrder])
} deriving (Eq,Show,Data,Typeable,Generic)
query
:: Query
query =
Query'
{ _qStartCursor = Nothing
, _qOffSet = Nothing
, _qKind = Nothing
, _qDistinctOn = Nothing
, _qEndCursor = Nothing
, _qLimit = Nothing
, _qProjection = Nothing
, _qFilter = Nothing
, _qOrder = Nothing
}
qStartCursor :: Lens' Query (Maybe ByteString)
qStartCursor
= lens _qStartCursor (\ s a -> s{_qStartCursor = a})
. mapping _Base64
qOffSet :: Lens' Query (Maybe Int32)
qOffSet
= lens _qOffSet (\ s a -> s{_qOffSet = a}) .
mapping _Coerce
qKind :: Lens' Query [KindExpression]
qKind
= lens _qKind (\ s a -> s{_qKind = a}) . _Default .
_Coerce
qDistinctOn :: Lens' Query [PropertyReference]
qDistinctOn
= lens _qDistinctOn (\ s a -> s{_qDistinctOn = a}) .
_Default
. _Coerce
qEndCursor :: Lens' Query (Maybe ByteString)
qEndCursor
= lens _qEndCursor (\ s a -> s{_qEndCursor = a}) .
mapping _Base64
qLimit :: Lens' Query (Maybe Int32)
qLimit
= lens _qLimit (\ s a -> s{_qLimit = a}) .
mapping _Coerce
qProjection :: Lens' Query [Projection]
qProjection
= lens _qProjection (\ s a -> s{_qProjection = a}) .
_Default
. _Coerce
qFilter :: Lens' Query (Maybe Filter)
qFilter = lens _qFilter (\ s a -> s{_qFilter = a})
qOrder :: Lens' Query [PropertyOrder]
qOrder
= lens _qOrder (\ s a -> s{_qOrder = a}) . _Default .
_Coerce
instance FromJSON Query where
parseJSON
= withObject "Query"
(\ o ->
Query' <$>
(o .:? "startCursor") <*> (o .:? "offset") <*>
(o .:? "kind" .!= mempty)
<*> (o .:? "distinctOn" .!= mempty)
<*> (o .:? "endCursor")
<*> (o .:? "limit")
<*> (o .:? "projection" .!= mempty)
<*> (o .:? "filter")
<*> (o .:? "order" .!= mempty))
instance ToJSON Query where
toJSON Query'{..}
= object
(catMaybes
[("startCursor" .=) <$> _qStartCursor,
("offset" .=) <$> _qOffSet, ("kind" .=) <$> _qKind,
("distinctOn" .=) <$> _qDistinctOn,
("endCursor" .=) <$> _qEndCursor,
("limit" .=) <$> _qLimit,
("projection" .=) <$> _qProjection,
("filter" .=) <$> _qFilter,
("order" .=) <$> _qOrder])
newtype ArrayValue = ArrayValue'
{ _avValues :: Maybe [Value]
} deriving (Eq,Show,Data,Typeable,Generic)
arrayValue
:: ArrayValue
arrayValue =
ArrayValue'
{ _avValues = Nothing
}
avValues :: Lens' ArrayValue [Value]
avValues
= lens _avValues (\ s a -> s{_avValues = a}) .
_Default
. _Coerce
instance FromJSON ArrayValue where
parseJSON
= withObject "ArrayValue"
(\ o -> ArrayValue' <$> (o .:? "values" .!= mempty))
instance ToJSON ArrayValue where
toJSON ArrayValue'{..}
= object (catMaybes [("values" .=) <$> _avValues])
data EntityResult = EntityResult'
{ _erCursor :: !(Maybe Base64)
, _erEntity :: !(Maybe Entity)
} deriving (Eq,Show,Data,Typeable,Generic)
entityResult
:: EntityResult
entityResult =
EntityResult'
{ _erCursor = Nothing
, _erEntity = Nothing
}
erCursor :: Lens' EntityResult (Maybe ByteString)
erCursor
= lens _erCursor (\ s a -> s{_erCursor = a}) .
mapping _Base64
erEntity :: Lens' EntityResult (Maybe Entity)
erEntity = lens _erEntity (\ s a -> s{_erEntity = a})
instance FromJSON EntityResult where
parseJSON
= withObject "EntityResult"
(\ o ->
EntityResult' <$>
(o .:? "cursor") <*> (o .:? "entity"))
instance ToJSON EntityResult where
toJSON EntityResult'{..}
= object
(catMaybes
[("cursor" .=) <$> _erCursor,
("entity" .=) <$> _erEntity])
data CommitResponse = CommitResponse'
{ _crIndexUpdates :: !(Maybe (Textual Int32))
, _crMutationResults :: !(Maybe [MutationResult])
} deriving (Eq,Show,Data,Typeable,Generic)
commitResponse
:: CommitResponse
commitResponse =
CommitResponse'
{ _crIndexUpdates = Nothing
, _crMutationResults = Nothing
}
crIndexUpdates :: Lens' CommitResponse (Maybe Int32)
crIndexUpdates
= lens _crIndexUpdates
(\ s a -> s{_crIndexUpdates = a})
. mapping _Coerce
crMutationResults :: Lens' CommitResponse [MutationResult]
crMutationResults
= lens _crMutationResults
(\ s a -> s{_crMutationResults = a})
. _Default
. _Coerce
instance FromJSON CommitResponse where
parseJSON
= withObject "CommitResponse"
(\ o ->
CommitResponse' <$>
(o .:? "indexUpdates") <*>
(o .:? "mutationResults" .!= mempty))
instance ToJSON CommitResponse where
toJSON CommitResponse'{..}
= object
(catMaybes
[("indexUpdates" .=) <$> _crIndexUpdates,
("mutationResults" .=) <$> _crMutationResults])
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 Base64)
} 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 ByteString)
roTransaction
= lens _roTransaction
(\ s a -> s{_roTransaction = a})
. mapping _Base64
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])
data RollbackResponse =
RollbackResponse'
deriving (Eq,Show,Data,Typeable,Generic)
rollbackResponse
:: RollbackResponse
rollbackResponse = RollbackResponse'
instance FromJSON RollbackResponse where
parseJSON
= withObject "RollbackResponse"
(\ o -> pure RollbackResponse')
instance ToJSON RollbackResponse where
toJSON = const emptyObject
newtype Projection = Projection'
{ _pProperty :: Maybe PropertyReference
} deriving (Eq,Show,Data,Typeable,Generic)
projection
:: Projection
projection =
Projection'
{ _pProperty = Nothing
}
pProperty :: Lens' Projection (Maybe PropertyReference)
pProperty
= lens _pProperty (\ s a -> s{_pProperty = a})
instance FromJSON Projection where
parseJSON
= withObject "Projection"
(\ o -> Projection' <$> (o .:? "property"))
instance ToJSON Projection where
toJSON Projection'{..}
= object (catMaybes [("property" .=) <$> _pProperty])
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'
{ _crMutations :: !(Maybe [Mutation])
, _crMode :: !(Maybe CommitRequestMode)
, _crTransaction :: !(Maybe Base64)
} deriving (Eq,Show,Data,Typeable,Generic)
commitRequest
:: CommitRequest
commitRequest =
CommitRequest'
{ _crMutations = Nothing
, _crMode = Nothing
, _crTransaction = Nothing
}
crMutations :: Lens' CommitRequest [Mutation]
crMutations
= lens _crMutations (\ s a -> s{_crMutations = a}) .
_Default
. _Coerce
crMode :: Lens' CommitRequest (Maybe CommitRequestMode)
crMode = lens _crMode (\ s a -> s{_crMode = a})
crTransaction :: Lens' CommitRequest (Maybe ByteString)
crTransaction
= lens _crTransaction
(\ s a -> s{_crTransaction = a})
. mapping _Base64
instance FromJSON CommitRequest where
parseJSON
= withObject "CommitRequest"
(\ o ->
CommitRequest' <$>
(o .:? "mutations" .!= mempty) <*> (o .:? "mode") <*>
(o .:? "transaction"))
instance ToJSON CommitRequest where
toJSON CommitRequest'{..}
= object
(catMaybes
[("mutations" .=) <$> _crMutations,
("mode" .=) <$> _crMode,
("transaction" .=) <$> _crTransaction])
data PathElement = PathElement'
{ _peKind :: !(Maybe Text)
, _peName :: !(Maybe Text)
, _peId :: !(Maybe (Textual Int64))
} deriving (Eq,Show,Data,Typeable,Generic)
pathElement
:: PathElement
pathElement =
PathElement'
{ _peKind = Nothing
, _peName = Nothing
, _peId = Nothing
}
peKind :: Lens' PathElement (Maybe Text)
peKind = lens _peKind (\ s a -> s{_peKind = a})
peName :: Lens' PathElement (Maybe Text)
peName = lens _peName (\ s a -> s{_peName = a})
peId :: Lens' PathElement (Maybe Int64)
peId
= lens _peId (\ s a -> s{_peId = a}) .
mapping _Coerce
instance FromJSON PathElement where
parseJSON
= withObject "PathElement"
(\ o ->
PathElement' <$>
(o .:? "kind") <*> (o .:? "name") <*> (o .:? "id"))
instance ToJSON PathElement where
toJSON PathElement'{..}
= object
(catMaybes
[("kind" .=) <$> _peKind, ("name" .=) <$> _peName,
("id" .=) <$> _peId])
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])
} deriving (Eq,Show,Data,Typeable,Generic)
lookupResponse
:: LookupResponse
lookupResponse =
LookupResponse'
{ _lrDeferred = Nothing
, _lrFound = Nothing
, _lrMissing = 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
instance FromJSON LookupResponse where
parseJSON
= withObject "LookupResponse"
(\ o ->
LookupResponse' <$>
(o .:? "deferred" .!= mempty) <*>
(o .:? "found" .!= mempty)
<*> (o .:? "missing" .!= mempty))
instance ToJSON LookupResponse where
toJSON LookupResponse'{..}
= object
(catMaybes
[("deferred" .=) <$> _lrDeferred,
("found" .=) <$> _lrFound,
("missing" .=) <$> _lrMissing])
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])
data GqlQueryParameter = GqlQueryParameter'
{ _gqpCursor :: !(Maybe Base64)
, _gqpValue :: !(Maybe Value)
} deriving (Eq,Show,Data,Typeable,Generic)
gqlQueryParameter
:: GqlQueryParameter
gqlQueryParameter =
GqlQueryParameter'
{ _gqpCursor = Nothing
, _gqpValue = Nothing
}
gqpCursor :: Lens' GqlQueryParameter (Maybe ByteString)
gqpCursor
= lens _gqpCursor (\ s a -> s{_gqpCursor = a}) .
mapping _Base64
gqpValue :: Lens' GqlQueryParameter (Maybe Value)
gqpValue = lens _gqpValue (\ s a -> s{_gqpValue = a})
instance FromJSON GqlQueryParameter where
parseJSON
= withObject "GqlQueryParameter"
(\ o ->
GqlQueryParameter' <$>
(o .:? "cursor") <*> (o .:? "value"))
instance ToJSON GqlQueryParameter where
toJSON GqlQueryParameter'{..}
= object
(catMaybes
[("cursor" .=) <$> _gqpCursor,
("value" .=) <$> _gqpValue])