{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}
module Amazonka.CodeCommit.GetCommentReactions
(
GetCommentReactions (..),
newGetCommentReactions,
getCommentReactions_nextToken,
getCommentReactions_reactionUserArn,
getCommentReactions_maxResults,
getCommentReactions_commentId,
GetCommentReactionsResponse (..),
newGetCommentReactionsResponse,
getCommentReactionsResponse_nextToken,
getCommentReactionsResponse_httpStatus,
getCommentReactionsResponse_reactionsForComment,
)
where
import Amazonka.CodeCommit.Types
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data =
{
:: Prelude.Maybe Prelude.Text,
:: Prelude.Maybe Prelude.Text,
:: Prelude.Maybe Prelude.Int,
:: Prelude.Text
}
deriving (GetCommentReactions -> GetCommentReactions -> Bool
(GetCommentReactions -> GetCommentReactions -> Bool)
-> (GetCommentReactions -> GetCommentReactions -> Bool)
-> Eq GetCommentReactions
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetCommentReactions -> GetCommentReactions -> Bool
$c/= :: GetCommentReactions -> GetCommentReactions -> Bool
== :: GetCommentReactions -> GetCommentReactions -> Bool
$c== :: GetCommentReactions -> GetCommentReactions -> Bool
Prelude.Eq, ReadPrec [GetCommentReactions]
ReadPrec GetCommentReactions
Int -> ReadS GetCommentReactions
ReadS [GetCommentReactions]
(Int -> ReadS GetCommentReactions)
-> ReadS [GetCommentReactions]
-> ReadPrec GetCommentReactions
-> ReadPrec [GetCommentReactions]
-> Read GetCommentReactions
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetCommentReactions]
$creadListPrec :: ReadPrec [GetCommentReactions]
readPrec :: ReadPrec GetCommentReactions
$creadPrec :: ReadPrec GetCommentReactions
readList :: ReadS [GetCommentReactions]
$creadList :: ReadS [GetCommentReactions]
readsPrec :: Int -> ReadS GetCommentReactions
$creadsPrec :: Int -> ReadS GetCommentReactions
Prelude.Read, Int -> GetCommentReactions -> ShowS
[GetCommentReactions] -> ShowS
GetCommentReactions -> String
(Int -> GetCommentReactions -> ShowS)
-> (GetCommentReactions -> String)
-> ([GetCommentReactions] -> ShowS)
-> Show GetCommentReactions
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetCommentReactions] -> ShowS
$cshowList :: [GetCommentReactions] -> ShowS
show :: GetCommentReactions -> String
$cshow :: GetCommentReactions -> String
showsPrec :: Int -> GetCommentReactions -> ShowS
$cshowsPrec :: Int -> GetCommentReactions -> ShowS
Prelude.Show, (forall x. GetCommentReactions -> Rep GetCommentReactions x)
-> (forall x. Rep GetCommentReactions x -> GetCommentReactions)
-> Generic GetCommentReactions
forall x. Rep GetCommentReactions x -> GetCommentReactions
forall x. GetCommentReactions -> Rep GetCommentReactions x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetCommentReactions x -> GetCommentReactions
$cfrom :: forall x. GetCommentReactions -> Rep GetCommentReactions x
Prelude.Generic)
newGetCommentReactions ::
Prelude.Text ->
GetCommentReactions
Text
pCommentId_ =
GetCommentReactions' :: Maybe Text
-> Maybe Text -> Maybe Int -> Text -> GetCommentReactions
GetCommentReactions'
{ $sel:nextToken:GetCommentReactions' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:reactionUserArn:GetCommentReactions' :: Maybe Text
reactionUserArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:maxResults:GetCommentReactions' :: Maybe Int
maxResults = Maybe Int
forall a. Maybe a
Prelude.Nothing,
$sel:commentId:GetCommentReactions' :: Text
commentId = Text
pCommentId_
}
getCommentReactions_nextToken :: Lens.Lens' GetCommentReactions (Prelude.Maybe Prelude.Text)
= (GetCommentReactions -> Maybe Text)
-> (GetCommentReactions -> Maybe Text -> GetCommentReactions)
-> Lens
GetCommentReactions GetCommentReactions (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetCommentReactions' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:GetCommentReactions' :: GetCommentReactions -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: GetCommentReactions
s@GetCommentReactions' {} Maybe Text
a -> GetCommentReactions
s {$sel:nextToken:GetCommentReactions' :: Maybe Text
nextToken = Maybe Text
a} :: GetCommentReactions)
getCommentReactions_reactionUserArn :: Lens.Lens' GetCommentReactions (Prelude.Maybe Prelude.Text)
= (GetCommentReactions -> Maybe Text)
-> (GetCommentReactions -> Maybe Text -> GetCommentReactions)
-> Lens
GetCommentReactions GetCommentReactions (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetCommentReactions' {Maybe Text
reactionUserArn :: Maybe Text
$sel:reactionUserArn:GetCommentReactions' :: GetCommentReactions -> Maybe Text
reactionUserArn} -> Maybe Text
reactionUserArn) (\s :: GetCommentReactions
s@GetCommentReactions' {} Maybe Text
a -> GetCommentReactions
s {$sel:reactionUserArn:GetCommentReactions' :: Maybe Text
reactionUserArn = Maybe Text
a} :: GetCommentReactions)
getCommentReactions_maxResults :: Lens.Lens' GetCommentReactions (Prelude.Maybe Prelude.Int)
= (GetCommentReactions -> Maybe Int)
-> (GetCommentReactions -> Maybe Int -> GetCommentReactions)
-> Lens
GetCommentReactions GetCommentReactions (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetCommentReactions' {Maybe Int
maxResults :: Maybe Int
$sel:maxResults:GetCommentReactions' :: GetCommentReactions -> Maybe Int
maxResults} -> Maybe Int
maxResults) (\s :: GetCommentReactions
s@GetCommentReactions' {} Maybe Int
a -> GetCommentReactions
s {$sel:maxResults:GetCommentReactions' :: Maybe Int
maxResults = Maybe Int
a} :: GetCommentReactions)
getCommentReactions_commentId :: Lens.Lens' GetCommentReactions Prelude.Text
= (GetCommentReactions -> Text)
-> (GetCommentReactions -> Text -> GetCommentReactions)
-> Lens GetCommentReactions GetCommentReactions Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetCommentReactions' {Text
commentId :: Text
$sel:commentId:GetCommentReactions' :: GetCommentReactions -> Text
commentId} -> Text
commentId) (\s :: GetCommentReactions
s@GetCommentReactions' {} Text
a -> GetCommentReactions
s {$sel:commentId:GetCommentReactions' :: Text
commentId = Text
a} :: GetCommentReactions)
instance Core.AWSRequest GetCommentReactions where
type
AWSResponse GetCommentReactions =
GetCommentReactionsResponse
request :: GetCommentReactions -> Request GetCommentReactions
request = Service -> GetCommentReactions -> Request GetCommentReactions
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy GetCommentReactions
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetCommentReactions)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse GetCommentReactions))
-> Logger
-> Service
-> Proxy GetCommentReactions
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetCommentReactions)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
( \Int
s ResponseHeaders
h Object
x ->
Maybe Text
-> Int -> [ReactionForComment] -> GetCommentReactionsResponse
GetCommentReactionsResponse'
(Maybe Text
-> Int -> [ReactionForComment] -> GetCommentReactionsResponse)
-> Either String (Maybe Text)
-> Either
String (Int -> [ReactionForComment] -> GetCommentReactionsResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"nextToken")
Either
String (Int -> [ReactionForComment] -> GetCommentReactionsResponse)
-> Either String Int
-> Either
String ([ReactionForComment] -> GetCommentReactionsResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
Either String ([ReactionForComment] -> GetCommentReactionsResponse)
-> Either String [ReactionForComment]
-> Either String GetCommentReactionsResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x Object -> Text -> Either String (Maybe [ReactionForComment])
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"reactionsForComment"
Either String (Maybe [ReactionForComment])
-> [ReactionForComment] -> Either String [ReactionForComment]
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ [ReactionForComment]
forall a. Monoid a => a
Prelude.mempty
)
)
instance Prelude.Hashable GetCommentReactions
instance Prelude.NFData GetCommentReactions
instance Core.ToHeaders GetCommentReactions where
toHeaders :: GetCommentReactions -> ResponseHeaders
toHeaders =
ResponseHeaders -> GetCommentReactions -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"CodeCommit_20150413.GetCommentReactions" ::
Prelude.ByteString
),
HeaderName
"Content-Type"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Core.ToJSON GetCommentReactions where
toJSON :: GetCommentReactions -> Value
toJSON GetCommentReactions' {Maybe Int
Maybe Text
Text
commentId :: Text
maxResults :: Maybe Int
reactionUserArn :: Maybe Text
nextToken :: Maybe Text
$sel:commentId:GetCommentReactions' :: GetCommentReactions -> Text
$sel:maxResults:GetCommentReactions' :: GetCommentReactions -> Maybe Int
$sel:reactionUserArn:GetCommentReactions' :: GetCommentReactions -> Maybe Text
$sel:nextToken:GetCommentReactions' :: GetCommentReactions -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"nextToken" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
nextToken,
(Text
"reactionUserArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
reactionUserArn,
(Text
"maxResults" Text -> Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Int -> Pair) -> Maybe Int -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Int
maxResults,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"commentId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
commentId)
]
)
instance Core.ToPath GetCommentReactions where
toPath :: GetCommentReactions -> ByteString
toPath = ByteString -> GetCommentReactions -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery GetCommentReactions where
toQuery :: GetCommentReactions -> QueryString
toQuery = QueryString -> GetCommentReactions -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data =
{
:: Prelude.Maybe Prelude.Text,
:: Prelude.Int,
:: [ReactionForComment]
}
deriving (GetCommentReactionsResponse -> GetCommentReactionsResponse -> Bool
(GetCommentReactionsResponse
-> GetCommentReactionsResponse -> Bool)
-> (GetCommentReactionsResponse
-> GetCommentReactionsResponse -> Bool)
-> Eq GetCommentReactionsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetCommentReactionsResponse -> GetCommentReactionsResponse -> Bool
$c/= :: GetCommentReactionsResponse -> GetCommentReactionsResponse -> Bool
== :: GetCommentReactionsResponse -> GetCommentReactionsResponse -> Bool
$c== :: GetCommentReactionsResponse -> GetCommentReactionsResponse -> Bool
Prelude.Eq, ReadPrec [GetCommentReactionsResponse]
ReadPrec GetCommentReactionsResponse
Int -> ReadS GetCommentReactionsResponse
ReadS [GetCommentReactionsResponse]
(Int -> ReadS GetCommentReactionsResponse)
-> ReadS [GetCommentReactionsResponse]
-> ReadPrec GetCommentReactionsResponse
-> ReadPrec [GetCommentReactionsResponse]
-> Read GetCommentReactionsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetCommentReactionsResponse]
$creadListPrec :: ReadPrec [GetCommentReactionsResponse]
readPrec :: ReadPrec GetCommentReactionsResponse
$creadPrec :: ReadPrec GetCommentReactionsResponse
readList :: ReadS [GetCommentReactionsResponse]
$creadList :: ReadS [GetCommentReactionsResponse]
readsPrec :: Int -> ReadS GetCommentReactionsResponse
$creadsPrec :: Int -> ReadS GetCommentReactionsResponse
Prelude.Read, Int -> GetCommentReactionsResponse -> ShowS
[GetCommentReactionsResponse] -> ShowS
GetCommentReactionsResponse -> String
(Int -> GetCommentReactionsResponse -> ShowS)
-> (GetCommentReactionsResponse -> String)
-> ([GetCommentReactionsResponse] -> ShowS)
-> Show GetCommentReactionsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetCommentReactionsResponse] -> ShowS
$cshowList :: [GetCommentReactionsResponse] -> ShowS
show :: GetCommentReactionsResponse -> String
$cshow :: GetCommentReactionsResponse -> String
showsPrec :: Int -> GetCommentReactionsResponse -> ShowS
$cshowsPrec :: Int -> GetCommentReactionsResponse -> ShowS
Prelude.Show, (forall x.
GetCommentReactionsResponse -> Rep GetCommentReactionsResponse x)
-> (forall x.
Rep GetCommentReactionsResponse x -> GetCommentReactionsResponse)
-> Generic GetCommentReactionsResponse
forall x.
Rep GetCommentReactionsResponse x -> GetCommentReactionsResponse
forall x.
GetCommentReactionsResponse -> Rep GetCommentReactionsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetCommentReactionsResponse x -> GetCommentReactionsResponse
$cfrom :: forall x.
GetCommentReactionsResponse -> Rep GetCommentReactionsResponse x
Prelude.Generic)
newGetCommentReactionsResponse ::
Prelude.Int ->
GetCommentReactionsResponse
Int
pHttpStatus_ =
GetCommentReactionsResponse' :: Maybe Text
-> Int -> [ReactionForComment] -> GetCommentReactionsResponse
GetCommentReactionsResponse'
{ $sel:nextToken:GetCommentReactionsResponse' :: Maybe Text
nextToken =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetCommentReactionsResponse' :: Int
httpStatus = Int
pHttpStatus_,
$sel:reactionsForComment:GetCommentReactionsResponse' :: [ReactionForComment]
reactionsForComment = [ReactionForComment]
forall a. Monoid a => a
Prelude.mempty
}
getCommentReactionsResponse_nextToken :: Lens.Lens' GetCommentReactionsResponse (Prelude.Maybe Prelude.Text)
= (GetCommentReactionsResponse -> Maybe Text)
-> (GetCommentReactionsResponse
-> Maybe Text -> GetCommentReactionsResponse)
-> Lens
GetCommentReactionsResponse
GetCommentReactionsResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetCommentReactionsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:GetCommentReactionsResponse' :: GetCommentReactionsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: GetCommentReactionsResponse
s@GetCommentReactionsResponse' {} Maybe Text
a -> GetCommentReactionsResponse
s {$sel:nextToken:GetCommentReactionsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: GetCommentReactionsResponse)
getCommentReactionsResponse_httpStatus :: Lens.Lens' GetCommentReactionsResponse Prelude.Int
= (GetCommentReactionsResponse -> Int)
-> (GetCommentReactionsResponse
-> Int -> GetCommentReactionsResponse)
-> Lens
GetCommentReactionsResponse GetCommentReactionsResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetCommentReactionsResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetCommentReactionsResponse' :: GetCommentReactionsResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetCommentReactionsResponse
s@GetCommentReactionsResponse' {} Int
a -> GetCommentReactionsResponse
s {$sel:httpStatus:GetCommentReactionsResponse' :: Int
httpStatus = Int
a} :: GetCommentReactionsResponse)
getCommentReactionsResponse_reactionsForComment :: Lens.Lens' GetCommentReactionsResponse [ReactionForComment]
= (GetCommentReactionsResponse -> [ReactionForComment])
-> (GetCommentReactionsResponse
-> [ReactionForComment] -> GetCommentReactionsResponse)
-> Lens
GetCommentReactionsResponse
GetCommentReactionsResponse
[ReactionForComment]
[ReactionForComment]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetCommentReactionsResponse' {[ReactionForComment]
reactionsForComment :: [ReactionForComment]
$sel:reactionsForComment:GetCommentReactionsResponse' :: GetCommentReactionsResponse -> [ReactionForComment]
reactionsForComment} -> [ReactionForComment]
reactionsForComment) (\s :: GetCommentReactionsResponse
s@GetCommentReactionsResponse' {} [ReactionForComment]
a -> GetCommentReactionsResponse
s {$sel:reactionsForComment:GetCommentReactionsResponse' :: [ReactionForComment]
reactionsForComment = [ReactionForComment]
a} :: GetCommentReactionsResponse) (([ReactionForComment] -> f [ReactionForComment])
-> GetCommentReactionsResponse -> f GetCommentReactionsResponse)
-> (([ReactionForComment] -> f [ReactionForComment])
-> [ReactionForComment] -> f [ReactionForComment])
-> ([ReactionForComment] -> f [ReactionForComment])
-> GetCommentReactionsResponse
-> f GetCommentReactionsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([ReactionForComment] -> f [ReactionForComment])
-> [ReactionForComment] -> f [ReactionForComment]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Prelude.NFData GetCommentReactionsResponse