{-# 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 #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.WorkDocs.CreateComment
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Adds a new comment to the specified document version.
module Amazonka.WorkDocs.CreateComment
  ( -- * Creating a Request
    CreateComment (..),
    newCreateComment,

    -- * Request Lenses
    createComment_notifyCollaborators,
    createComment_authenticationToken,
    createComment_visibility,
    createComment_threadId,
    createComment_parentId,
    createComment_documentId,
    createComment_versionId,
    createComment_text,

    -- * Destructuring the Response
    CreateCommentResponse (..),
    newCreateCommentResponse,

    -- * Response Lenses
    createCommentResponse_comment,
    createCommentResponse_httpStatus,
  )
where

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
import Amazonka.WorkDocs.Types

-- | /See:/ 'newCreateComment' smart constructor.
data CreateComment = CreateComment'
  { -- | Set this parameter to TRUE to send an email out to the document
    -- collaborators after the comment is created.
    CreateComment -> Maybe Bool
notifyCollaborators :: Prelude.Maybe Prelude.Bool,
    -- | Amazon WorkDocs authentication token. Not required when using AWS
    -- administrator credentials to access the API.
    CreateComment -> Maybe (Sensitive Text)
authenticationToken :: Prelude.Maybe (Core.Sensitive Prelude.Text),
    -- | The visibility of the comment. Options are either PRIVATE, where the
    -- comment is visible only to the comment author and document owner and
    -- co-owners, or PUBLIC, where the comment is visible to document owners,
    -- co-owners, and contributors.
    CreateComment -> Maybe CommentVisibilityType
visibility :: Prelude.Maybe CommentVisibilityType,
    -- | The ID of the root comment in the thread.
    CreateComment -> Maybe Text
threadId :: Prelude.Maybe Prelude.Text,
    -- | The ID of the parent comment.
    CreateComment -> Maybe Text
parentId :: Prelude.Maybe Prelude.Text,
    -- | The ID of the document.
    CreateComment -> Text
documentId :: Prelude.Text,
    -- | The ID of the document version.
    CreateComment -> Text
versionId :: Prelude.Text,
    -- | The text of the comment.
    CreateComment -> Sensitive Text
text :: Core.Sensitive Prelude.Text
  }
  deriving (CreateComment -> CreateComment -> Bool
(CreateComment -> CreateComment -> Bool)
-> (CreateComment -> CreateComment -> Bool) -> Eq CreateComment
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateComment -> CreateComment -> Bool
$c/= :: CreateComment -> CreateComment -> Bool
== :: CreateComment -> CreateComment -> Bool
$c== :: CreateComment -> CreateComment -> Bool
Prelude.Eq, Int -> CreateComment -> ShowS
[CreateComment] -> ShowS
CreateComment -> String
(Int -> CreateComment -> ShowS)
-> (CreateComment -> String)
-> ([CreateComment] -> ShowS)
-> Show CreateComment
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateComment] -> ShowS
$cshowList :: [CreateComment] -> ShowS
show :: CreateComment -> String
$cshow :: CreateComment -> String
showsPrec :: Int -> CreateComment -> ShowS
$cshowsPrec :: Int -> CreateComment -> ShowS
Prelude.Show, (forall x. CreateComment -> Rep CreateComment x)
-> (forall x. Rep CreateComment x -> CreateComment)
-> Generic CreateComment
forall x. Rep CreateComment x -> CreateComment
forall x. CreateComment -> Rep CreateComment x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateComment x -> CreateComment
$cfrom :: forall x. CreateComment -> Rep CreateComment x
Prelude.Generic)

-- |
-- Create a value of 'CreateComment' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'notifyCollaborators', 'createComment_notifyCollaborators' - Set this parameter to TRUE to send an email out to the document
-- collaborators after the comment is created.
--
-- 'authenticationToken', 'createComment_authenticationToken' - Amazon WorkDocs authentication token. Not required when using AWS
-- administrator credentials to access the API.
--
-- 'visibility', 'createComment_visibility' - The visibility of the comment. Options are either PRIVATE, where the
-- comment is visible only to the comment author and document owner and
-- co-owners, or PUBLIC, where the comment is visible to document owners,
-- co-owners, and contributors.
--
-- 'threadId', 'createComment_threadId' - The ID of the root comment in the thread.
--
-- 'parentId', 'createComment_parentId' - The ID of the parent comment.
--
-- 'documentId', 'createComment_documentId' - The ID of the document.
--
-- 'versionId', 'createComment_versionId' - The ID of the document version.
--
-- 'text', 'createComment_text' - The text of the comment.
newCreateComment ::
  -- | 'documentId'
  Prelude.Text ->
  -- | 'versionId'
  Prelude.Text ->
  -- | 'text'
  Prelude.Text ->
  CreateComment
newCreateComment :: Text -> Text -> Text -> CreateComment
newCreateComment Text
pDocumentId_ Text
pVersionId_ Text
pText_ =
  CreateComment' :: Maybe Bool
-> Maybe (Sensitive Text)
-> Maybe CommentVisibilityType
-> Maybe Text
-> Maybe Text
-> Text
-> Text
-> Sensitive Text
-> CreateComment
CreateComment'
    { $sel:notifyCollaborators:CreateComment' :: Maybe Bool
notifyCollaborators =
        Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:authenticationToken:CreateComment' :: Maybe (Sensitive Text)
authenticationToken = Maybe (Sensitive Text)
forall a. Maybe a
Prelude.Nothing,
      $sel:visibility:CreateComment' :: Maybe CommentVisibilityType
visibility = Maybe CommentVisibilityType
forall a. Maybe a
Prelude.Nothing,
      $sel:threadId:CreateComment' :: Maybe Text
threadId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:parentId:CreateComment' :: Maybe Text
parentId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:documentId:CreateComment' :: Text
documentId = Text
pDocumentId_,
      $sel:versionId:CreateComment' :: Text
versionId = Text
pVersionId_,
      $sel:text:CreateComment' :: Sensitive Text
text = Tagged Text (Identity Text)
-> Tagged (Sensitive Text) (Identity (Sensitive Text))
forall a. Iso' (Sensitive a) a
Core._Sensitive (Tagged Text (Identity Text)
 -> Tagged (Sensitive Text) (Identity (Sensitive Text)))
-> Text -> Sensitive Text
forall t b. AReview t b -> b -> t
Lens.# Text
pText_
    }

-- | Set this parameter to TRUE to send an email out to the document
-- collaborators after the comment is created.
createComment_notifyCollaborators :: Lens.Lens' CreateComment (Prelude.Maybe Prelude.Bool)
createComment_notifyCollaborators :: (Maybe Bool -> f (Maybe Bool)) -> CreateComment -> f CreateComment
createComment_notifyCollaborators = (CreateComment -> Maybe Bool)
-> (CreateComment -> Maybe Bool -> CreateComment)
-> Lens CreateComment CreateComment (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateComment' {Maybe Bool
notifyCollaborators :: Maybe Bool
$sel:notifyCollaborators:CreateComment' :: CreateComment -> Maybe Bool
notifyCollaborators} -> Maybe Bool
notifyCollaborators) (\s :: CreateComment
s@CreateComment' {} Maybe Bool
a -> CreateComment
s {$sel:notifyCollaborators:CreateComment' :: Maybe Bool
notifyCollaborators = Maybe Bool
a} :: CreateComment)

-- | Amazon WorkDocs authentication token. Not required when using AWS
-- administrator credentials to access the API.
createComment_authenticationToken :: Lens.Lens' CreateComment (Prelude.Maybe Prelude.Text)
createComment_authenticationToken :: (Maybe Text -> f (Maybe Text)) -> CreateComment -> f CreateComment
createComment_authenticationToken = (CreateComment -> Maybe (Sensitive Text))
-> (CreateComment -> Maybe (Sensitive Text) -> CreateComment)
-> Lens
     CreateComment
     CreateComment
     (Maybe (Sensitive Text))
     (Maybe (Sensitive Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateComment' {Maybe (Sensitive Text)
authenticationToken :: Maybe (Sensitive Text)
$sel:authenticationToken:CreateComment' :: CreateComment -> Maybe (Sensitive Text)
authenticationToken} -> Maybe (Sensitive Text)
authenticationToken) (\s :: CreateComment
s@CreateComment' {} Maybe (Sensitive Text)
a -> CreateComment
s {$sel:authenticationToken:CreateComment' :: Maybe (Sensitive Text)
authenticationToken = Maybe (Sensitive Text)
a} :: CreateComment) ((Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
 -> CreateComment -> f CreateComment)
-> ((Maybe Text -> f (Maybe Text))
    -> Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
-> (Maybe Text -> f (Maybe Text))
-> CreateComment
-> f CreateComment
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso (Sensitive Text) (Sensitive Text) Text Text
-> Iso
     (Maybe (Sensitive Text))
     (Maybe (Sensitive Text))
     (Maybe Text)
     (Maybe Text)
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso (Sensitive Text) (Sensitive Text) Text Text
forall a. Iso' (Sensitive a) a
Core._Sensitive

-- | The visibility of the comment. Options are either PRIVATE, where the
-- comment is visible only to the comment author and document owner and
-- co-owners, or PUBLIC, where the comment is visible to document owners,
-- co-owners, and contributors.
createComment_visibility :: Lens.Lens' CreateComment (Prelude.Maybe CommentVisibilityType)
createComment_visibility :: (Maybe CommentVisibilityType -> f (Maybe CommentVisibilityType))
-> CreateComment -> f CreateComment
createComment_visibility = (CreateComment -> Maybe CommentVisibilityType)
-> (CreateComment -> Maybe CommentVisibilityType -> CreateComment)
-> Lens
     CreateComment
     CreateComment
     (Maybe CommentVisibilityType)
     (Maybe CommentVisibilityType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateComment' {Maybe CommentVisibilityType
visibility :: Maybe CommentVisibilityType
$sel:visibility:CreateComment' :: CreateComment -> Maybe CommentVisibilityType
visibility} -> Maybe CommentVisibilityType
visibility) (\s :: CreateComment
s@CreateComment' {} Maybe CommentVisibilityType
a -> CreateComment
s {$sel:visibility:CreateComment' :: Maybe CommentVisibilityType
visibility = Maybe CommentVisibilityType
a} :: CreateComment)

-- | The ID of the root comment in the thread.
createComment_threadId :: Lens.Lens' CreateComment (Prelude.Maybe Prelude.Text)
createComment_threadId :: (Maybe Text -> f (Maybe Text)) -> CreateComment -> f CreateComment
createComment_threadId = (CreateComment -> Maybe Text)
-> (CreateComment -> Maybe Text -> CreateComment)
-> Lens CreateComment CreateComment (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateComment' {Maybe Text
threadId :: Maybe Text
$sel:threadId:CreateComment' :: CreateComment -> Maybe Text
threadId} -> Maybe Text
threadId) (\s :: CreateComment
s@CreateComment' {} Maybe Text
a -> CreateComment
s {$sel:threadId:CreateComment' :: Maybe Text
threadId = Maybe Text
a} :: CreateComment)

-- | The ID of the parent comment.
createComment_parentId :: Lens.Lens' CreateComment (Prelude.Maybe Prelude.Text)
createComment_parentId :: (Maybe Text -> f (Maybe Text)) -> CreateComment -> f CreateComment
createComment_parentId = (CreateComment -> Maybe Text)
-> (CreateComment -> Maybe Text -> CreateComment)
-> Lens CreateComment CreateComment (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateComment' {Maybe Text
parentId :: Maybe Text
$sel:parentId:CreateComment' :: CreateComment -> Maybe Text
parentId} -> Maybe Text
parentId) (\s :: CreateComment
s@CreateComment' {} Maybe Text
a -> CreateComment
s {$sel:parentId:CreateComment' :: Maybe Text
parentId = Maybe Text
a} :: CreateComment)

-- | The ID of the document.
createComment_documentId :: Lens.Lens' CreateComment Prelude.Text
createComment_documentId :: (Text -> f Text) -> CreateComment -> f CreateComment
createComment_documentId = (CreateComment -> Text)
-> (CreateComment -> Text -> CreateComment)
-> Lens CreateComment CreateComment Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateComment' {Text
documentId :: Text
$sel:documentId:CreateComment' :: CreateComment -> Text
documentId} -> Text
documentId) (\s :: CreateComment
s@CreateComment' {} Text
a -> CreateComment
s {$sel:documentId:CreateComment' :: Text
documentId = Text
a} :: CreateComment)

-- | The ID of the document version.
createComment_versionId :: Lens.Lens' CreateComment Prelude.Text
createComment_versionId :: (Text -> f Text) -> CreateComment -> f CreateComment
createComment_versionId = (CreateComment -> Text)
-> (CreateComment -> Text -> CreateComment)
-> Lens CreateComment CreateComment Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateComment' {Text
versionId :: Text
$sel:versionId:CreateComment' :: CreateComment -> Text
versionId} -> Text
versionId) (\s :: CreateComment
s@CreateComment' {} Text
a -> CreateComment
s {$sel:versionId:CreateComment' :: Text
versionId = Text
a} :: CreateComment)

-- | The text of the comment.
createComment_text :: Lens.Lens' CreateComment Prelude.Text
createComment_text :: (Text -> f Text) -> CreateComment -> f CreateComment
createComment_text = (CreateComment -> Sensitive Text)
-> (CreateComment -> Sensitive Text -> CreateComment)
-> Lens
     CreateComment CreateComment (Sensitive Text) (Sensitive Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateComment' {Sensitive Text
text :: Sensitive Text
$sel:text:CreateComment' :: CreateComment -> Sensitive Text
text} -> Sensitive Text
text) (\s :: CreateComment
s@CreateComment' {} Sensitive Text
a -> CreateComment
s {$sel:text:CreateComment' :: Sensitive Text
text = Sensitive Text
a} :: CreateComment) ((Sensitive Text -> f (Sensitive Text))
 -> CreateComment -> f CreateComment)
-> ((Text -> f Text) -> Sensitive Text -> f (Sensitive Text))
-> (Text -> f Text)
-> CreateComment
-> f CreateComment
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> f Text) -> Sensitive Text -> f (Sensitive Text)
forall a. Iso' (Sensitive a) a
Core._Sensitive

instance Core.AWSRequest CreateComment where
  type
    AWSResponse CreateComment =
      CreateCommentResponse
  request :: CreateComment -> Request CreateComment
request = Service -> CreateComment -> Request CreateComment
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy CreateComment
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateComment)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse CreateComment))
-> Logger
-> Service
-> Proxy CreateComment
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateComment)))
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 -> CreateCommentResponse
CreateCommentResponse'
            (Maybe Comment -> Int -> CreateCommentResponse)
-> Either String (Maybe Comment)
-> Either String (Int -> CreateCommentResponse)
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 -> CreateCommentResponse)
-> Either String Int -> Either String CreateCommentResponse
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 CreateComment

instance Prelude.NFData CreateComment

instance Core.ToHeaders CreateComment where
  toHeaders :: CreateComment -> ResponseHeaders
toHeaders CreateComment' {Maybe Bool
Maybe Text
Maybe (Sensitive Text)
Maybe CommentVisibilityType
Text
Sensitive Text
text :: Sensitive Text
versionId :: Text
documentId :: Text
parentId :: Maybe Text
threadId :: Maybe Text
visibility :: Maybe CommentVisibilityType
authenticationToken :: Maybe (Sensitive Text)
notifyCollaborators :: Maybe Bool
$sel:text:CreateComment' :: CreateComment -> Sensitive Text
$sel:versionId:CreateComment' :: CreateComment -> Text
$sel:documentId:CreateComment' :: CreateComment -> Text
$sel:parentId:CreateComment' :: CreateComment -> Maybe Text
$sel:threadId:CreateComment' :: CreateComment -> Maybe Text
$sel:visibility:CreateComment' :: CreateComment -> Maybe CommentVisibilityType
$sel:authenticationToken:CreateComment' :: CreateComment -> Maybe (Sensitive Text)
$sel:notifyCollaborators:CreateComment' :: CreateComment -> Maybe Bool
..} =
    [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ HeaderName
"Authentication" HeaderName -> Maybe (Sensitive Text) -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# Maybe (Sensitive Text)
authenticationToken,
        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 CreateComment where
  toJSON :: CreateComment -> Value
toJSON CreateComment' {Maybe Bool
Maybe Text
Maybe (Sensitive Text)
Maybe CommentVisibilityType
Text
Sensitive Text
text :: Sensitive Text
versionId :: Text
documentId :: Text
parentId :: Maybe Text
threadId :: Maybe Text
visibility :: Maybe CommentVisibilityType
authenticationToken :: Maybe (Sensitive Text)
notifyCollaborators :: Maybe Bool
$sel:text:CreateComment' :: CreateComment -> Sensitive Text
$sel:versionId:CreateComment' :: CreateComment -> Text
$sel:documentId:CreateComment' :: CreateComment -> Text
$sel:parentId:CreateComment' :: CreateComment -> Maybe Text
$sel:threadId:CreateComment' :: CreateComment -> Maybe Text
$sel:visibility:CreateComment' :: CreateComment -> Maybe CommentVisibilityType
$sel:authenticationToken:CreateComment' :: CreateComment -> Maybe (Sensitive Text)
$sel:notifyCollaborators:CreateComment' :: CreateComment -> Maybe Bool
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"NotifyCollaborators" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
notifyCollaborators,
            (Text
"Visibility" Text -> CommentVisibilityType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (CommentVisibilityType -> Pair)
-> Maybe CommentVisibilityType -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe CommentVisibilityType
visibility,
            (Text
"ThreadId" 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
threadId,
            (Text
"ParentId" 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
parentId,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Text" Text -> Sensitive Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Sensitive Text
text)
          ]
      )

instance Core.ToPath CreateComment where
  toPath :: CreateComment -> ByteString
toPath CreateComment' {Maybe Bool
Maybe Text
Maybe (Sensitive Text)
Maybe CommentVisibilityType
Text
Sensitive Text
text :: Sensitive Text
versionId :: Text
documentId :: Text
parentId :: Maybe Text
threadId :: Maybe Text
visibility :: Maybe CommentVisibilityType
authenticationToken :: Maybe (Sensitive Text)
notifyCollaborators :: Maybe Bool
$sel:text:CreateComment' :: CreateComment -> Sensitive Text
$sel:versionId:CreateComment' :: CreateComment -> Text
$sel:documentId:CreateComment' :: CreateComment -> Text
$sel:parentId:CreateComment' :: CreateComment -> Maybe Text
$sel:threadId:CreateComment' :: CreateComment -> Maybe Text
$sel:visibility:CreateComment' :: CreateComment -> Maybe CommentVisibilityType
$sel:authenticationToken:CreateComment' :: CreateComment -> Maybe (Sensitive Text)
$sel:notifyCollaborators:CreateComment' :: CreateComment -> Maybe Bool
..} =
    [ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/api/v1/documents/",
        Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
documentId,
        ByteString
"/versions/",
        Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
versionId,
        ByteString
"/comment"
      ]

instance Core.ToQuery CreateComment where
  toQuery :: CreateComment -> QueryString
toQuery = QueryString -> CreateComment -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty

-- | /See:/ 'newCreateCommentResponse' smart constructor.
data CreateCommentResponse = CreateCommentResponse'
  { -- | The comment that has been created.
    CreateCommentResponse -> Maybe Comment
comment :: Prelude.Maybe Comment,
    -- | The response's http status code.
    CreateCommentResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (CreateCommentResponse -> CreateCommentResponse -> Bool
(CreateCommentResponse -> CreateCommentResponse -> Bool)
-> (CreateCommentResponse -> CreateCommentResponse -> Bool)
-> Eq CreateCommentResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateCommentResponse -> CreateCommentResponse -> Bool
$c/= :: CreateCommentResponse -> CreateCommentResponse -> Bool
== :: CreateCommentResponse -> CreateCommentResponse -> Bool
$c== :: CreateCommentResponse -> CreateCommentResponse -> Bool
Prelude.Eq, Int -> CreateCommentResponse -> ShowS
[CreateCommentResponse] -> ShowS
CreateCommentResponse -> String
(Int -> CreateCommentResponse -> ShowS)
-> (CreateCommentResponse -> String)
-> ([CreateCommentResponse] -> ShowS)
-> Show CreateCommentResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateCommentResponse] -> ShowS
$cshowList :: [CreateCommentResponse] -> ShowS
show :: CreateCommentResponse -> String
$cshow :: CreateCommentResponse -> String
showsPrec :: Int -> CreateCommentResponse -> ShowS
$cshowsPrec :: Int -> CreateCommentResponse -> ShowS
Prelude.Show, (forall x. CreateCommentResponse -> Rep CreateCommentResponse x)
-> (forall x. Rep CreateCommentResponse x -> CreateCommentResponse)
-> Generic CreateCommentResponse
forall x. Rep CreateCommentResponse x -> CreateCommentResponse
forall x. CreateCommentResponse -> Rep CreateCommentResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateCommentResponse x -> CreateCommentResponse
$cfrom :: forall x. CreateCommentResponse -> Rep CreateCommentResponse x
Prelude.Generic)

-- |
-- Create a value of 'CreateCommentResponse' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'comment', 'createCommentResponse_comment' - The comment that has been created.
--
-- 'httpStatus', 'createCommentResponse_httpStatus' - The response's http status code.
newCreateCommentResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  CreateCommentResponse
newCreateCommentResponse :: Int -> CreateCommentResponse
newCreateCommentResponse Int
pHttpStatus_ =
  CreateCommentResponse' :: Maybe Comment -> Int -> CreateCommentResponse
CreateCommentResponse'
    { $sel:comment:CreateCommentResponse' :: Maybe Comment
comment = Maybe Comment
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:CreateCommentResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The comment that has been created.
createCommentResponse_comment :: Lens.Lens' CreateCommentResponse (Prelude.Maybe Comment)
createCommentResponse_comment :: (Maybe Comment -> f (Maybe Comment))
-> CreateCommentResponse -> f CreateCommentResponse
createCommentResponse_comment = (CreateCommentResponse -> Maybe Comment)
-> (CreateCommentResponse
    -> Maybe Comment -> CreateCommentResponse)
-> Lens
     CreateCommentResponse
     CreateCommentResponse
     (Maybe Comment)
     (Maybe Comment)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateCommentResponse' {Maybe Comment
comment :: Maybe Comment
$sel:comment:CreateCommentResponse' :: CreateCommentResponse -> Maybe Comment
comment} -> Maybe Comment
comment) (\s :: CreateCommentResponse
s@CreateCommentResponse' {} Maybe Comment
a -> CreateCommentResponse
s {$sel:comment:CreateCommentResponse' :: Maybe Comment
comment = Maybe Comment
a} :: CreateCommentResponse)

-- | The response's http status code.
createCommentResponse_httpStatus :: Lens.Lens' CreateCommentResponse Prelude.Int
createCommentResponse_httpStatus :: (Int -> f Int) -> CreateCommentResponse -> f CreateCommentResponse
createCommentResponse_httpStatus = (CreateCommentResponse -> Int)
-> (CreateCommentResponse -> Int -> CreateCommentResponse)
-> Lens CreateCommentResponse CreateCommentResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateCommentResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreateCommentResponse' :: CreateCommentResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreateCommentResponse
s@CreateCommentResponse' {} Int
a -> CreateCommentResponse
s {$sel:httpStatus:CreateCommentResponse' :: Int
httpStatus = Int
a} :: CreateCommentResponse)

instance Prelude.NFData CreateCommentResponse