{-# 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.CommentAnalyzer.Types.Product where
import Network.Google.CommentAnalyzer.Types.Sum
import Network.Google.Prelude
data SpanScore =
SpanScore'
{ _ssBegin :: !(Maybe (Textual Int32))
, _ssScore :: !(Maybe Score)
, _ssEnd :: !(Maybe (Textual Int32))
}
deriving (Eq, Show, Data, Typeable, Generic)
spanScore
:: SpanScore
spanScore =
SpanScore' {_ssBegin = Nothing, _ssScore = Nothing, _ssEnd = Nothing}
ssBegin :: Lens' SpanScore (Maybe Int32)
ssBegin
= lens _ssBegin (\ s a -> s{_ssBegin = a}) .
mapping _Coerce
ssScore :: Lens' SpanScore (Maybe Score)
ssScore = lens _ssScore (\ s a -> s{_ssScore = a})
ssEnd :: Lens' SpanScore (Maybe Int32)
ssEnd
= lens _ssEnd (\ s a -> s{_ssEnd = a}) .
mapping _Coerce
instance FromJSON SpanScore where
parseJSON
= withObject "SpanScore"
(\ o ->
SpanScore' <$>
(o .:? "begin") <*> (o .:? "score") <*>
(o .:? "end"))
instance ToJSON SpanScore where
toJSON SpanScore'{..}
= object
(catMaybes
[("begin" .=) <$> _ssBegin,
("score" .=) <$> _ssScore, ("end" .=) <$> _ssEnd])
data AnalyzeCommentResponse =
AnalyzeCommentResponse'
{ _acrDetectedLanguages :: !(Maybe [Text])
, _acrClientToken :: !(Maybe Text)
, _acrLanguages :: !(Maybe [Text])
, _acrAttributeScores :: !(Maybe AnalyzeCommentResponseAttributeScores)
}
deriving (Eq, Show, Data, Typeable, Generic)
analyzeCommentResponse
:: AnalyzeCommentResponse
analyzeCommentResponse =
AnalyzeCommentResponse'
{ _acrDetectedLanguages = Nothing
, _acrClientToken = Nothing
, _acrLanguages = Nothing
, _acrAttributeScores = Nothing
}
acrDetectedLanguages :: Lens' AnalyzeCommentResponse [Text]
acrDetectedLanguages
= lens _acrDetectedLanguages
(\ s a -> s{_acrDetectedLanguages = a})
. _Default
. _Coerce
acrClientToken :: Lens' AnalyzeCommentResponse (Maybe Text)
acrClientToken
= lens _acrClientToken
(\ s a -> s{_acrClientToken = a})
acrLanguages :: Lens' AnalyzeCommentResponse [Text]
acrLanguages
= lens _acrLanguages (\ s a -> s{_acrLanguages = a})
. _Default
. _Coerce
acrAttributeScores :: Lens' AnalyzeCommentResponse (Maybe AnalyzeCommentResponseAttributeScores)
acrAttributeScores
= lens _acrAttributeScores
(\ s a -> s{_acrAttributeScores = a})
instance FromJSON AnalyzeCommentResponse where
parseJSON
= withObject "AnalyzeCommentResponse"
(\ o ->
AnalyzeCommentResponse' <$>
(o .:? "detectedLanguages" .!= mempty) <*>
(o .:? "clientToken")
<*> (o .:? "languages" .!= mempty)
<*> (o .:? "attributeScores"))
instance ToJSON AnalyzeCommentResponse where
toJSON AnalyzeCommentResponse'{..}
= object
(catMaybes
[("detectedLanguages" .=) <$> _acrDetectedLanguages,
("clientToken" .=) <$> _acrClientToken,
("languages" .=) <$> _acrLanguages,
("attributeScores" .=) <$> _acrAttributeScores])
data SuggestCommentScoreResponse =
SuggestCommentScoreResponse'
{ _scsrDetectedLanguages :: !(Maybe [Text])
, _scsrClientToken :: !(Maybe Text)
, _scsrRequestedLanguages :: !(Maybe [Text])
}
deriving (Eq, Show, Data, Typeable, Generic)
suggestCommentScoreResponse
:: SuggestCommentScoreResponse
suggestCommentScoreResponse =
SuggestCommentScoreResponse'
{ _scsrDetectedLanguages = Nothing
, _scsrClientToken = Nothing
, _scsrRequestedLanguages = Nothing
}
scsrDetectedLanguages :: Lens' SuggestCommentScoreResponse [Text]
scsrDetectedLanguages
= lens _scsrDetectedLanguages
(\ s a -> s{_scsrDetectedLanguages = a})
. _Default
. _Coerce
scsrClientToken :: Lens' SuggestCommentScoreResponse (Maybe Text)
scsrClientToken
= lens _scsrClientToken
(\ s a -> s{_scsrClientToken = a})
scsrRequestedLanguages :: Lens' SuggestCommentScoreResponse [Text]
scsrRequestedLanguages
= lens _scsrRequestedLanguages
(\ s a -> s{_scsrRequestedLanguages = a})
. _Default
. _Coerce
instance FromJSON SuggestCommentScoreResponse where
parseJSON
= withObject "SuggestCommentScoreResponse"
(\ o ->
SuggestCommentScoreResponse' <$>
(o .:? "detectedLanguages" .!= mempty) <*>
(o .:? "clientToken")
<*> (o .:? "requestedLanguages" .!= mempty))
instance ToJSON SuggestCommentScoreResponse where
toJSON SuggestCommentScoreResponse'{..}
= object
(catMaybes
[("detectedLanguages" .=) <$> _scsrDetectedLanguages,
("clientToken" .=) <$> _scsrClientToken,
("requestedLanguages" .=) <$>
_scsrRequestedLanguages])
data Context =
Context'
{ _cEntries :: !(Maybe [TextEntry])
, _cArticleAndParentComment :: !(Maybe ArticleAndParentComment)
}
deriving (Eq, Show, Data, Typeable, Generic)
context
:: Context
context = Context' {_cEntries = Nothing, _cArticleAndParentComment = Nothing}
cEntries :: Lens' Context [TextEntry]
cEntries
= lens _cEntries (\ s a -> s{_cEntries = a}) .
_Default
. _Coerce
cArticleAndParentComment :: Lens' Context (Maybe ArticleAndParentComment)
cArticleAndParentComment
= lens _cArticleAndParentComment
(\ s a -> s{_cArticleAndParentComment = a})
instance FromJSON Context where
parseJSON
= withObject "Context"
(\ o ->
Context' <$>
(o .:? "entries" .!= mempty) <*>
(o .:? "articleAndParentComment"))
instance ToJSON Context where
toJSON Context'{..}
= object
(catMaybes
[("entries" .=) <$> _cEntries,
("articleAndParentComment" .=) <$>
_cArticleAndParentComment])
data Score =
Score'
{ _sValue :: !(Maybe (Textual Double))
, _sType :: !(Maybe ScoreType)
}
deriving (Eq, Show, Data, Typeable, Generic)
score
:: Score
score = Score' {_sValue = Nothing, _sType = Nothing}
sValue :: Lens' Score (Maybe Double)
sValue
= lens _sValue (\ s a -> s{_sValue = a}) .
mapping _Coerce
sType :: Lens' Score (Maybe ScoreType)
sType = lens _sType (\ s a -> s{_sType = a})
instance FromJSON Score where
parseJSON
= withObject "Score"
(\ o ->
Score' <$> (o .:? "value") <*> (o .:? "type"))
instance ToJSON Score where
toJSON Score'{..}
= object
(catMaybes
[("value" .=) <$> _sValue, ("type" .=) <$> _sType])
data ArticleAndParentComment =
ArticleAndParentComment'
{ _aapcArticle :: !(Maybe TextEntry)
, _aapcParentComment :: !(Maybe TextEntry)
}
deriving (Eq, Show, Data, Typeable, Generic)
articleAndParentComment
:: ArticleAndParentComment
articleAndParentComment =
ArticleAndParentComment'
{_aapcArticle = Nothing, _aapcParentComment = Nothing}
aapcArticle :: Lens' ArticleAndParentComment (Maybe TextEntry)
aapcArticle
= lens _aapcArticle (\ s a -> s{_aapcArticle = a})
aapcParentComment :: Lens' ArticleAndParentComment (Maybe TextEntry)
aapcParentComment
= lens _aapcParentComment
(\ s a -> s{_aapcParentComment = a})
instance FromJSON ArticleAndParentComment where
parseJSON
= withObject "ArticleAndParentComment"
(\ o ->
ArticleAndParentComment' <$>
(o .:? "article") <*> (o .:? "parentComment"))
instance ToJSON ArticleAndParentComment where
toJSON ArticleAndParentComment'{..}
= object
(catMaybes
[("article" .=) <$> _aapcArticle,
("parentComment" .=) <$> _aapcParentComment])
data AttributeParameters =
AttributeParameters'
{ _apScoreThreshold :: !(Maybe (Textual Double))
, _apScoreType :: !(Maybe AttributeParametersScoreType)
}
deriving (Eq, Show, Data, Typeable, Generic)
attributeParameters
:: AttributeParameters
attributeParameters =
AttributeParameters' {_apScoreThreshold = Nothing, _apScoreType = Nothing}
apScoreThreshold :: Lens' AttributeParameters (Maybe Double)
apScoreThreshold
= lens _apScoreThreshold
(\ s a -> s{_apScoreThreshold = a})
. mapping _Coerce
apScoreType :: Lens' AttributeParameters (Maybe AttributeParametersScoreType)
apScoreType
= lens _apScoreType (\ s a -> s{_apScoreType = a})
instance FromJSON AttributeParameters where
parseJSON
= withObject "AttributeParameters"
(\ o ->
AttributeParameters' <$>
(o .:? "scoreThreshold") <*> (o .:? "scoreType"))
instance ToJSON AttributeParameters where
toJSON AttributeParameters'{..}
= object
(catMaybes
[("scoreThreshold" .=) <$> _apScoreThreshold,
("scoreType" .=) <$> _apScoreType])
data TextEntry =
TextEntry'
{ _teText :: !(Maybe Text)
, _teType :: !(Maybe TextEntryType)
}
deriving (Eq, Show, Data, Typeable, Generic)
textEntry
:: TextEntry
textEntry = TextEntry' {_teText = Nothing, _teType = Nothing}
teText :: Lens' TextEntry (Maybe Text)
teText = lens _teText (\ s a -> s{_teText = a})
teType :: Lens' TextEntry (Maybe TextEntryType)
teType = lens _teType (\ s a -> s{_teType = a})
instance FromJSON TextEntry where
parseJSON
= withObject "TextEntry"
(\ o ->
TextEntry' <$> (o .:? "text") <*> (o .:? "type"))
instance ToJSON TextEntry where
toJSON TextEntry'{..}
= object
(catMaybes
[("text" .=) <$> _teText, ("type" .=) <$> _teType])
data AttributeScores =
AttributeScores'
{ _asSummaryScore :: !(Maybe Score)
, _asSpanScores :: !(Maybe [SpanScore])
}
deriving (Eq, Show, Data, Typeable, Generic)
attributeScores
:: AttributeScores
attributeScores =
AttributeScores' {_asSummaryScore = Nothing, _asSpanScores = Nothing}
asSummaryScore :: Lens' AttributeScores (Maybe Score)
asSummaryScore
= lens _asSummaryScore
(\ s a -> s{_asSummaryScore = a})
asSpanScores :: Lens' AttributeScores [SpanScore]
asSpanScores
= lens _asSpanScores (\ s a -> s{_asSpanScores = a})
. _Default
. _Coerce
instance FromJSON AttributeScores where
parseJSON
= withObject "AttributeScores"
(\ o ->
AttributeScores' <$>
(o .:? "summaryScore") <*>
(o .:? "spanScores" .!= mempty))
instance ToJSON AttributeScores where
toJSON AttributeScores'{..}
= object
(catMaybes
[("summaryScore" .=) <$> _asSummaryScore,
("spanScores" .=) <$> _asSpanScores])
newtype AnalyzeCommentResponseAttributeScores =
AnalyzeCommentResponseAttributeScores'
{ _acrasAddtional :: HashMap Text AttributeScores
}
deriving (Eq, Show, Data, Typeable, Generic)
analyzeCommentResponseAttributeScores
:: HashMap Text AttributeScores
-> AnalyzeCommentResponseAttributeScores
analyzeCommentResponseAttributeScores pAcrasAddtional_ =
AnalyzeCommentResponseAttributeScores'
{_acrasAddtional = _Coerce # pAcrasAddtional_}
acrasAddtional :: Lens' AnalyzeCommentResponseAttributeScores (HashMap Text AttributeScores)
acrasAddtional
= lens _acrasAddtional
(\ s a -> s{_acrasAddtional = a})
. _Coerce
instance FromJSON
AnalyzeCommentResponseAttributeScores
where
parseJSON
= withObject "AnalyzeCommentResponseAttributeScores"
(\ o ->
AnalyzeCommentResponseAttributeScores' <$>
(parseJSONObject o))
instance ToJSON AnalyzeCommentResponseAttributeScores
where
toJSON = toJSON . _acrasAddtional
data SuggestCommentScoreRequest =
SuggestCommentScoreRequest'
{ _sContext :: !(Maybe Context)
, _sClientToken :: !(Maybe Text)
, _sLanguages :: !(Maybe [Text])
, _sAttributeScores :: !(Maybe SuggestCommentScoreRequestAttributeScores)
, _sSessionId :: !(Maybe Text)
, _sComment :: !(Maybe TextEntry)
, _sCommUnityId :: !(Maybe Text)
}
deriving (Eq, Show, Data, Typeable, Generic)
suggestCommentScoreRequest
:: SuggestCommentScoreRequest
suggestCommentScoreRequest =
SuggestCommentScoreRequest'
{ _sContext = Nothing
, _sClientToken = Nothing
, _sLanguages = Nothing
, _sAttributeScores = Nothing
, _sSessionId = Nothing
, _sComment = Nothing
, _sCommUnityId = Nothing
}
sContext :: Lens' SuggestCommentScoreRequest (Maybe Context)
sContext = lens _sContext (\ s a -> s{_sContext = a})
sClientToken :: Lens' SuggestCommentScoreRequest (Maybe Text)
sClientToken
= lens _sClientToken (\ s a -> s{_sClientToken = a})
sLanguages :: Lens' SuggestCommentScoreRequest [Text]
sLanguages
= lens _sLanguages (\ s a -> s{_sLanguages = a}) .
_Default
. _Coerce
sAttributeScores :: Lens' SuggestCommentScoreRequest (Maybe SuggestCommentScoreRequestAttributeScores)
sAttributeScores
= lens _sAttributeScores
(\ s a -> s{_sAttributeScores = a})
sSessionId :: Lens' SuggestCommentScoreRequest (Maybe Text)
sSessionId
= lens _sSessionId (\ s a -> s{_sSessionId = a})
sComment :: Lens' SuggestCommentScoreRequest (Maybe TextEntry)
sComment = lens _sComment (\ s a -> s{_sComment = a})
sCommUnityId :: Lens' SuggestCommentScoreRequest (Maybe Text)
sCommUnityId
= lens _sCommUnityId (\ s a -> s{_sCommUnityId = a})
instance FromJSON SuggestCommentScoreRequest where
parseJSON
= withObject "SuggestCommentScoreRequest"
(\ o ->
SuggestCommentScoreRequest' <$>
(o .:? "context") <*> (o .:? "clientToken") <*>
(o .:? "languages" .!= mempty)
<*> (o .:? "attributeScores")
<*> (o .:? "sessionId")
<*> (o .:? "comment")
<*> (o .:? "communityId"))
instance ToJSON SuggestCommentScoreRequest where
toJSON SuggestCommentScoreRequest'{..}
= object
(catMaybes
[("context" .=) <$> _sContext,
("clientToken" .=) <$> _sClientToken,
("languages" .=) <$> _sLanguages,
("attributeScores" .=) <$> _sAttributeScores,
("sessionId" .=) <$> _sSessionId,
("comment" .=) <$> _sComment,
("communityId" .=) <$> _sCommUnityId])
data AnalyzeCommentRequest =
AnalyzeCommentRequest'
{ _aContext :: !(Maybe Context)
, _aClientToken :: !(Maybe Text)
, _aSpanAnnotations :: !(Maybe Bool)
, _aDoNotStore :: !(Maybe Bool)
, _aLanguages :: !(Maybe [Text])
, _aRequestedAttributes :: !(Maybe AnalyzeCommentRequestRequestedAttributes)
, _aSessionId :: !(Maybe Text)
, _aComment :: !(Maybe TextEntry)
, _aCommUnityId :: !(Maybe Text)
}
deriving (Eq, Show, Data, Typeable, Generic)
analyzeCommentRequest
:: AnalyzeCommentRequest
analyzeCommentRequest =
AnalyzeCommentRequest'
{ _aContext = Nothing
, _aClientToken = Nothing
, _aSpanAnnotations = Nothing
, _aDoNotStore = Nothing
, _aLanguages = Nothing
, _aRequestedAttributes = Nothing
, _aSessionId = Nothing
, _aComment = Nothing
, _aCommUnityId = Nothing
}
aContext :: Lens' AnalyzeCommentRequest (Maybe Context)
aContext = lens _aContext (\ s a -> s{_aContext = a})
aClientToken :: Lens' AnalyzeCommentRequest (Maybe Text)
aClientToken
= lens _aClientToken (\ s a -> s{_aClientToken = a})
aSpanAnnotations :: Lens' AnalyzeCommentRequest (Maybe Bool)
aSpanAnnotations
= lens _aSpanAnnotations
(\ s a -> s{_aSpanAnnotations = a})
aDoNotStore :: Lens' AnalyzeCommentRequest (Maybe Bool)
aDoNotStore
= lens _aDoNotStore (\ s a -> s{_aDoNotStore = a})
aLanguages :: Lens' AnalyzeCommentRequest [Text]
aLanguages
= lens _aLanguages (\ s a -> s{_aLanguages = a}) .
_Default
. _Coerce
aRequestedAttributes :: Lens' AnalyzeCommentRequest (Maybe AnalyzeCommentRequestRequestedAttributes)
aRequestedAttributes
= lens _aRequestedAttributes
(\ s a -> s{_aRequestedAttributes = a})
aSessionId :: Lens' AnalyzeCommentRequest (Maybe Text)
aSessionId
= lens _aSessionId (\ s a -> s{_aSessionId = a})
aComment :: Lens' AnalyzeCommentRequest (Maybe TextEntry)
aComment = lens _aComment (\ s a -> s{_aComment = a})
aCommUnityId :: Lens' AnalyzeCommentRequest (Maybe Text)
aCommUnityId
= lens _aCommUnityId (\ s a -> s{_aCommUnityId = a})
instance FromJSON AnalyzeCommentRequest where
parseJSON
= withObject "AnalyzeCommentRequest"
(\ o ->
AnalyzeCommentRequest' <$>
(o .:? "context") <*> (o .:? "clientToken") <*>
(o .:? "spanAnnotations")
<*> (o .:? "doNotStore")
<*> (o .:? "languages" .!= mempty)
<*> (o .:? "requestedAttributes")
<*> (o .:? "sessionId")
<*> (o .:? "comment")
<*> (o .:? "communityId"))
instance ToJSON AnalyzeCommentRequest where
toJSON AnalyzeCommentRequest'{..}
= object
(catMaybes
[("context" .=) <$> _aContext,
("clientToken" .=) <$> _aClientToken,
("spanAnnotations" .=) <$> _aSpanAnnotations,
("doNotStore" .=) <$> _aDoNotStore,
("languages" .=) <$> _aLanguages,
("requestedAttributes" .=) <$> _aRequestedAttributes,
("sessionId" .=) <$> _aSessionId,
("comment" .=) <$> _aComment,
("communityId" .=) <$> _aCommUnityId])
newtype SuggestCommentScoreRequestAttributeScores =
SuggestCommentScoreRequestAttributeScores'
{ _scsrasAddtional :: HashMap Text AttributeScores
}
deriving (Eq, Show, Data, Typeable, Generic)
suggestCommentScoreRequestAttributeScores
:: HashMap Text AttributeScores
-> SuggestCommentScoreRequestAttributeScores
suggestCommentScoreRequestAttributeScores pScsrasAddtional_ =
SuggestCommentScoreRequestAttributeScores'
{_scsrasAddtional = _Coerce # pScsrasAddtional_}
scsrasAddtional :: Lens' SuggestCommentScoreRequestAttributeScores (HashMap Text AttributeScores)
scsrasAddtional
= lens _scsrasAddtional
(\ s a -> s{_scsrasAddtional = a})
. _Coerce
instance FromJSON
SuggestCommentScoreRequestAttributeScores
where
parseJSON
= withObject
"SuggestCommentScoreRequestAttributeScores"
(\ o ->
SuggestCommentScoreRequestAttributeScores' <$>
(parseJSONObject o))
instance ToJSON
SuggestCommentScoreRequestAttributeScores
where
toJSON = toJSON . _scsrasAddtional
newtype AnalyzeCommentRequestRequestedAttributes =
AnalyzeCommentRequestRequestedAttributes'
{ _acrraAddtional :: HashMap Text AttributeParameters
}
deriving (Eq, Show, Data, Typeable, Generic)
analyzeCommentRequestRequestedAttributes
:: HashMap Text AttributeParameters
-> AnalyzeCommentRequestRequestedAttributes
analyzeCommentRequestRequestedAttributes pAcrraAddtional_ =
AnalyzeCommentRequestRequestedAttributes'
{_acrraAddtional = _Coerce # pAcrraAddtional_}
acrraAddtional :: Lens' AnalyzeCommentRequestRequestedAttributes (HashMap Text AttributeParameters)
acrraAddtional
= lens _acrraAddtional
(\ s a -> s{_acrraAddtional = a})
. _Coerce
instance FromJSON
AnalyzeCommentRequestRequestedAttributes
where
parseJSON
= withObject
"AnalyzeCommentRequestRequestedAttributes"
(\ o ->
AnalyzeCommentRequestRequestedAttributes' <$>
(parseJSONObject o))
instance ToJSON
AnalyzeCommentRequestRequestedAttributes
where
toJSON = toJSON . _acrraAddtional