{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE TypeFamilies #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}
module Network.AWS.CodeCommit.PostCommentForPullRequest
(
postCommentForPullRequest
, PostCommentForPullRequest
, pcfprLocation
, pcfprClientRequestToken
, pcfprPullRequestId
, pcfprRepositoryName
, pcfprBeforeCommitId
, pcfprAfterCommitId
, pcfprContent
, postCommentForPullRequestResponse
, PostCommentForPullRequestResponse
, pcfprrsBeforeBlobId
, pcfprrsLocation
, pcfprrsAfterCommitId
, pcfprrsPullRequestId
, pcfprrsAfterBlobId
, pcfprrsBeforeCommitId
, pcfprrsRepositoryName
, pcfprrsComment
, pcfprrsResponseStatus
) where
import Network.AWS.CodeCommit.Types
import Network.AWS.CodeCommit.Types.Product
import Network.AWS.Lens
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
data PostCommentForPullRequest = PostCommentForPullRequest'
{ _pcfprLocation :: !(Maybe Location)
, _pcfprClientRequestToken :: !(Maybe Text)
, _pcfprPullRequestId :: !Text
, _pcfprRepositoryName :: !Text
, _pcfprBeforeCommitId :: !Text
, _pcfprAfterCommitId :: !Text
, _pcfprContent :: !Text
} deriving (Eq, Read, Show, Data, Typeable, Generic)
postCommentForPullRequest
:: Text
-> Text
-> Text
-> Text
-> Text
-> PostCommentForPullRequest
postCommentForPullRequest pPullRequestId_ pRepositoryName_ pBeforeCommitId_ pAfterCommitId_ pContent_ =
PostCommentForPullRequest'
{ _pcfprLocation = Nothing
, _pcfprClientRequestToken = Nothing
, _pcfprPullRequestId = pPullRequestId_
, _pcfprRepositoryName = pRepositoryName_
, _pcfprBeforeCommitId = pBeforeCommitId_
, _pcfprAfterCommitId = pAfterCommitId_
, _pcfprContent = pContent_
}
pcfprLocation :: Lens' PostCommentForPullRequest (Maybe Location)
pcfprLocation = lens _pcfprLocation (\ s a -> s{_pcfprLocation = a})
pcfprClientRequestToken :: Lens' PostCommentForPullRequest (Maybe Text)
pcfprClientRequestToken = lens _pcfprClientRequestToken (\ s a -> s{_pcfprClientRequestToken = a})
pcfprPullRequestId :: Lens' PostCommentForPullRequest Text
pcfprPullRequestId = lens _pcfprPullRequestId (\ s a -> s{_pcfprPullRequestId = a})
pcfprRepositoryName :: Lens' PostCommentForPullRequest Text
pcfprRepositoryName = lens _pcfprRepositoryName (\ s a -> s{_pcfprRepositoryName = a})
pcfprBeforeCommitId :: Lens' PostCommentForPullRequest Text
pcfprBeforeCommitId = lens _pcfprBeforeCommitId (\ s a -> s{_pcfprBeforeCommitId = a})
pcfprAfterCommitId :: Lens' PostCommentForPullRequest Text
pcfprAfterCommitId = lens _pcfprAfterCommitId (\ s a -> s{_pcfprAfterCommitId = a})
pcfprContent :: Lens' PostCommentForPullRequest Text
pcfprContent = lens _pcfprContent (\ s a -> s{_pcfprContent = a})
instance AWSRequest PostCommentForPullRequest where
type Rs PostCommentForPullRequest =
PostCommentForPullRequestResponse
request = postJSON codeCommit
response
= receiveJSON
(\ s h x ->
PostCommentForPullRequestResponse' <$>
(x .?> "beforeBlobId") <*> (x .?> "location") <*>
(x .?> "afterCommitId")
<*> (x .?> "pullRequestId")
<*> (x .?> "afterBlobId")
<*> (x .?> "beforeCommitId")
<*> (x .?> "repositoryName")
<*> (x .?> "comment")
<*> (pure (fromEnum s)))
instance Hashable PostCommentForPullRequest where
instance NFData PostCommentForPullRequest where
instance ToHeaders PostCommentForPullRequest where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("CodeCommit_20150413.PostCommentForPullRequest" ::
ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON PostCommentForPullRequest where
toJSON PostCommentForPullRequest'{..}
= object
(catMaybes
[("location" .=) <$> _pcfprLocation,
("clientRequestToken" .=) <$>
_pcfprClientRequestToken,
Just ("pullRequestId" .= _pcfprPullRequestId),
Just ("repositoryName" .= _pcfprRepositoryName),
Just ("beforeCommitId" .= _pcfprBeforeCommitId),
Just ("afterCommitId" .= _pcfprAfterCommitId),
Just ("content" .= _pcfprContent)])
instance ToPath PostCommentForPullRequest where
toPath = const "/"
instance ToQuery PostCommentForPullRequest where
toQuery = const mempty
data PostCommentForPullRequestResponse = PostCommentForPullRequestResponse'
{ _pcfprrsBeforeBlobId :: !(Maybe Text)
, _pcfprrsLocation :: !(Maybe Location)
, _pcfprrsAfterCommitId :: !(Maybe Text)
, _pcfprrsPullRequestId :: !(Maybe Text)
, _pcfprrsAfterBlobId :: !(Maybe Text)
, _pcfprrsBeforeCommitId :: !(Maybe Text)
, _pcfprrsRepositoryName :: !(Maybe Text)
, _pcfprrsComment :: !(Maybe Comment)
, _pcfprrsResponseStatus :: !Int
} deriving (Eq, Read, Show, Data, Typeable, Generic)
postCommentForPullRequestResponse
:: Int
-> PostCommentForPullRequestResponse
postCommentForPullRequestResponse pResponseStatus_ =
PostCommentForPullRequestResponse'
{ _pcfprrsBeforeBlobId = Nothing
, _pcfprrsLocation = Nothing
, _pcfprrsAfterCommitId = Nothing
, _pcfprrsPullRequestId = Nothing
, _pcfprrsAfterBlobId = Nothing
, _pcfprrsBeforeCommitId = Nothing
, _pcfprrsRepositoryName = Nothing
, _pcfprrsComment = Nothing
, _pcfprrsResponseStatus = pResponseStatus_
}
pcfprrsBeforeBlobId :: Lens' PostCommentForPullRequestResponse (Maybe Text)
pcfprrsBeforeBlobId = lens _pcfprrsBeforeBlobId (\ s a -> s{_pcfprrsBeforeBlobId = a})
pcfprrsLocation :: Lens' PostCommentForPullRequestResponse (Maybe Location)
pcfprrsLocation = lens _pcfprrsLocation (\ s a -> s{_pcfprrsLocation = a})
pcfprrsAfterCommitId :: Lens' PostCommentForPullRequestResponse (Maybe Text)
pcfprrsAfterCommitId = lens _pcfprrsAfterCommitId (\ s a -> s{_pcfprrsAfterCommitId = a})
pcfprrsPullRequestId :: Lens' PostCommentForPullRequestResponse (Maybe Text)
pcfprrsPullRequestId = lens _pcfprrsPullRequestId (\ s a -> s{_pcfprrsPullRequestId = a})
pcfprrsAfterBlobId :: Lens' PostCommentForPullRequestResponse (Maybe Text)
pcfprrsAfterBlobId = lens _pcfprrsAfterBlobId (\ s a -> s{_pcfprrsAfterBlobId = a})
pcfprrsBeforeCommitId :: Lens' PostCommentForPullRequestResponse (Maybe Text)
pcfprrsBeforeCommitId = lens _pcfprrsBeforeCommitId (\ s a -> s{_pcfprrsBeforeCommitId = a})
pcfprrsRepositoryName :: Lens' PostCommentForPullRequestResponse (Maybe Text)
pcfprrsRepositoryName = lens _pcfprrsRepositoryName (\ s a -> s{_pcfprrsRepositoryName = a})
pcfprrsComment :: Lens' PostCommentForPullRequestResponse (Maybe Comment)
pcfprrsComment = lens _pcfprrsComment (\ s a -> s{_pcfprrsComment = a})
pcfprrsResponseStatus :: Lens' PostCommentForPullRequestResponse Int
pcfprrsResponseStatus = lens _pcfprrsResponseStatus (\ s a -> s{_pcfprrsResponseStatus = a})
instance NFData PostCommentForPullRequestResponse
where