{-# 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.PostCommentReply
(
PostCommentReply (..),
newPostCommentReply,
postCommentReply_clientRequestToken,
postCommentReply_inReplyTo,
postCommentReply_content,
PostCommentReplyResponse (..),
newPostCommentReplyResponse,
postCommentReplyResponse_comment,
postCommentReplyResponse_httpStatus,
)
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.Text,
:: Prelude.Text
}
deriving (PostCommentReply -> PostCommentReply -> Bool
(PostCommentReply -> PostCommentReply -> Bool)
-> (PostCommentReply -> PostCommentReply -> Bool)
-> Eq PostCommentReply
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PostCommentReply -> PostCommentReply -> Bool
$c/= :: PostCommentReply -> PostCommentReply -> Bool
== :: PostCommentReply -> PostCommentReply -> Bool
$c== :: PostCommentReply -> PostCommentReply -> Bool
Prelude.Eq, ReadPrec [PostCommentReply]
ReadPrec PostCommentReply
Int -> ReadS PostCommentReply
ReadS [PostCommentReply]
(Int -> ReadS PostCommentReply)
-> ReadS [PostCommentReply]
-> ReadPrec PostCommentReply
-> ReadPrec [PostCommentReply]
-> Read PostCommentReply
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PostCommentReply]
$creadListPrec :: ReadPrec [PostCommentReply]
readPrec :: ReadPrec PostCommentReply
$creadPrec :: ReadPrec PostCommentReply
readList :: ReadS [PostCommentReply]
$creadList :: ReadS [PostCommentReply]
readsPrec :: Int -> ReadS PostCommentReply
$creadsPrec :: Int -> ReadS PostCommentReply
Prelude.Read, Int -> PostCommentReply -> ShowS
[PostCommentReply] -> ShowS
PostCommentReply -> String
(Int -> PostCommentReply -> ShowS)
-> (PostCommentReply -> String)
-> ([PostCommentReply] -> ShowS)
-> Show PostCommentReply
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PostCommentReply] -> ShowS
$cshowList :: [PostCommentReply] -> ShowS
show :: PostCommentReply -> String
$cshow :: PostCommentReply -> String
showsPrec :: Int -> PostCommentReply -> ShowS
$cshowsPrec :: Int -> PostCommentReply -> ShowS
Prelude.Show, (forall x. PostCommentReply -> Rep PostCommentReply x)
-> (forall x. Rep PostCommentReply x -> PostCommentReply)
-> Generic PostCommentReply
forall x. Rep PostCommentReply x -> PostCommentReply
forall x. PostCommentReply -> Rep PostCommentReply x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PostCommentReply x -> PostCommentReply
$cfrom :: forall x. PostCommentReply -> Rep PostCommentReply x
Prelude.Generic)
newPostCommentReply ::
Prelude.Text ->
Prelude.Text ->
PostCommentReply
Text
pInReplyTo_ Text
pContent_ =
PostCommentReply' :: Maybe Text -> Text -> Text -> PostCommentReply
PostCommentReply'
{ $sel:clientRequestToken:PostCommentReply' :: Maybe Text
clientRequestToken =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:inReplyTo:PostCommentReply' :: Text
inReplyTo = Text
pInReplyTo_,
$sel:content:PostCommentReply' :: Text
content = Text
pContent_
}
postCommentReply_clientRequestToken :: Lens.Lens' PostCommentReply (Prelude.Maybe Prelude.Text)
= (PostCommentReply -> Maybe Text)
-> (PostCommentReply -> Maybe Text -> PostCommentReply)
-> Lens PostCommentReply PostCommentReply (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PostCommentReply' {Maybe Text
clientRequestToken :: Maybe Text
$sel:clientRequestToken:PostCommentReply' :: PostCommentReply -> Maybe Text
clientRequestToken} -> Maybe Text
clientRequestToken) (\s :: PostCommentReply
s@PostCommentReply' {} Maybe Text
a -> PostCommentReply
s {$sel:clientRequestToken:PostCommentReply' :: Maybe Text
clientRequestToken = Maybe Text
a} :: PostCommentReply)
postCommentReply_inReplyTo :: Lens.Lens' PostCommentReply Prelude.Text
= (PostCommentReply -> Text)
-> (PostCommentReply -> Text -> PostCommentReply)
-> Lens PostCommentReply PostCommentReply Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PostCommentReply' {Text
inReplyTo :: Text
$sel:inReplyTo:PostCommentReply' :: PostCommentReply -> Text
inReplyTo} -> Text
inReplyTo) (\s :: PostCommentReply
s@PostCommentReply' {} Text
a -> PostCommentReply
s {$sel:inReplyTo:PostCommentReply' :: Text
inReplyTo = Text
a} :: PostCommentReply)
postCommentReply_content :: Lens.Lens' PostCommentReply Prelude.Text
= (PostCommentReply -> Text)
-> (PostCommentReply -> Text -> PostCommentReply)
-> Lens PostCommentReply PostCommentReply Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PostCommentReply' {Text
content :: Text
$sel:content:PostCommentReply' :: PostCommentReply -> Text
content} -> Text
content) (\s :: PostCommentReply
s@PostCommentReply' {} Text
a -> PostCommentReply
s {$sel:content:PostCommentReply' :: Text
content = Text
a} :: PostCommentReply)
instance Core.AWSRequest PostCommentReply where
type
AWSResponse PostCommentReply =
PostCommentReplyResponse
request :: PostCommentReply -> Request PostCommentReply
request = Service -> PostCommentReply -> Request PostCommentReply
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy PostCommentReply
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse PostCommentReply)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse PostCommentReply))
-> Logger
-> Service
-> Proxy PostCommentReply
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse PostCommentReply)))
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 Comment -> Int -> PostCommentReplyResponse
PostCommentReplyResponse'
(Maybe Comment -> Int -> PostCommentReplyResponse)
-> Either String (Maybe Comment)
-> Either String (Int -> PostCommentReplyResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Comment)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"comment")
Either String (Int -> PostCommentReplyResponse)
-> Either String Int -> Either String PostCommentReplyResponse
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))
)
instance Prelude.Hashable PostCommentReply
instance Prelude.NFData PostCommentReply
instance Core.ToHeaders PostCommentReply where
toHeaders :: PostCommentReply -> ResponseHeaders
toHeaders =
ResponseHeaders -> PostCommentReply -> 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.PostCommentReply" ::
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 PostCommentReply where
toJSON :: PostCommentReply -> Value
toJSON PostCommentReply' {Maybe Text
Text
content :: Text
inReplyTo :: Text
clientRequestToken :: Maybe Text
$sel:content:PostCommentReply' :: PostCommentReply -> Text
$sel:inReplyTo:PostCommentReply' :: PostCommentReply -> Text
$sel:clientRequestToken:PostCommentReply' :: PostCommentReply -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"clientRequestToken" 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
clientRequestToken,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"inReplyTo" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
inReplyTo),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"content" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
content)
]
)
instance Core.ToPath PostCommentReply where
toPath :: PostCommentReply -> ByteString
toPath = ByteString -> PostCommentReply -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery PostCommentReply where
toQuery :: PostCommentReply -> QueryString
toQuery = QueryString -> PostCommentReply -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data =
{
:: Prelude.Maybe Comment,
:: Prelude.Int
}
deriving (PostCommentReplyResponse -> PostCommentReplyResponse -> Bool
(PostCommentReplyResponse -> PostCommentReplyResponse -> Bool)
-> (PostCommentReplyResponse -> PostCommentReplyResponse -> Bool)
-> Eq PostCommentReplyResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PostCommentReplyResponse -> PostCommentReplyResponse -> Bool
$c/= :: PostCommentReplyResponse -> PostCommentReplyResponse -> Bool
== :: PostCommentReplyResponse -> PostCommentReplyResponse -> Bool
$c== :: PostCommentReplyResponse -> PostCommentReplyResponse -> Bool
Prelude.Eq, ReadPrec [PostCommentReplyResponse]
ReadPrec PostCommentReplyResponse
Int -> ReadS PostCommentReplyResponse
ReadS [PostCommentReplyResponse]
(Int -> ReadS PostCommentReplyResponse)
-> ReadS [PostCommentReplyResponse]
-> ReadPrec PostCommentReplyResponse
-> ReadPrec [PostCommentReplyResponse]
-> Read PostCommentReplyResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PostCommentReplyResponse]
$creadListPrec :: ReadPrec [PostCommentReplyResponse]
readPrec :: ReadPrec PostCommentReplyResponse
$creadPrec :: ReadPrec PostCommentReplyResponse
readList :: ReadS [PostCommentReplyResponse]
$creadList :: ReadS [PostCommentReplyResponse]
readsPrec :: Int -> ReadS PostCommentReplyResponse
$creadsPrec :: Int -> ReadS PostCommentReplyResponse
Prelude.Read, Int -> PostCommentReplyResponse -> ShowS
[PostCommentReplyResponse] -> ShowS
PostCommentReplyResponse -> String
(Int -> PostCommentReplyResponse -> ShowS)
-> (PostCommentReplyResponse -> String)
-> ([PostCommentReplyResponse] -> ShowS)
-> Show PostCommentReplyResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PostCommentReplyResponse] -> ShowS
$cshowList :: [PostCommentReplyResponse] -> ShowS
show :: PostCommentReplyResponse -> String
$cshow :: PostCommentReplyResponse -> String
showsPrec :: Int -> PostCommentReplyResponse -> ShowS
$cshowsPrec :: Int -> PostCommentReplyResponse -> ShowS
Prelude.Show, (forall x.
PostCommentReplyResponse -> Rep PostCommentReplyResponse x)
-> (forall x.
Rep PostCommentReplyResponse x -> PostCommentReplyResponse)
-> Generic PostCommentReplyResponse
forall x.
Rep PostCommentReplyResponse x -> PostCommentReplyResponse
forall x.
PostCommentReplyResponse -> Rep PostCommentReplyResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep PostCommentReplyResponse x -> PostCommentReplyResponse
$cfrom :: forall x.
PostCommentReplyResponse -> Rep PostCommentReplyResponse x
Prelude.Generic)
newPostCommentReplyResponse ::
Prelude.Int ->
PostCommentReplyResponse
Int
pHttpStatus_ =
PostCommentReplyResponse' :: Maybe Comment -> Int -> PostCommentReplyResponse
PostCommentReplyResponse'
{ $sel:comment:PostCommentReplyResponse' :: Maybe Comment
comment =
Maybe Comment
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:PostCommentReplyResponse' :: Int
httpStatus = Int
pHttpStatus_
}
postCommentReplyResponse_comment :: Lens.Lens' PostCommentReplyResponse (Prelude.Maybe Comment)
= (PostCommentReplyResponse -> Maybe Comment)
-> (PostCommentReplyResponse
-> Maybe Comment -> PostCommentReplyResponse)
-> Lens
PostCommentReplyResponse
PostCommentReplyResponse
(Maybe Comment)
(Maybe Comment)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PostCommentReplyResponse' {Maybe Comment
comment :: Maybe Comment
$sel:comment:PostCommentReplyResponse' :: PostCommentReplyResponse -> Maybe Comment
comment} -> Maybe Comment
comment) (\s :: PostCommentReplyResponse
s@PostCommentReplyResponse' {} Maybe Comment
a -> PostCommentReplyResponse
s {$sel:comment:PostCommentReplyResponse' :: Maybe Comment
comment = Maybe Comment
a} :: PostCommentReplyResponse)
postCommentReplyResponse_httpStatus :: Lens.Lens' PostCommentReplyResponse Prelude.Int
= (PostCommentReplyResponse -> Int)
-> (PostCommentReplyResponse -> Int -> PostCommentReplyResponse)
-> Lens PostCommentReplyResponse PostCommentReplyResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PostCommentReplyResponse' {Int
httpStatus :: Int
$sel:httpStatus:PostCommentReplyResponse' :: PostCommentReplyResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: PostCommentReplyResponse
s@PostCommentReplyResponse' {} Int
a -> PostCommentReplyResponse
s {$sel:httpStatus:PostCommentReplyResponse' :: Int
httpStatus = Int
a} :: PostCommentReplyResponse)
instance Prelude.NFData PostCommentReplyResponse