{-# 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.Wisdom.UpdateContent
-- 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)
--
-- Updates information about the content.
module Amazonka.Wisdom.UpdateContent
  ( -- * Creating a Request
    UpdateContent (..),
    newUpdateContent,

    -- * Request Lenses
    updateContent_overrideLinkOutUri,
    updateContent_removeOverrideLinkOutUri,
    updateContent_metadata,
    updateContent_title,
    updateContent_revisionId,
    updateContent_uploadId,
    updateContent_contentId,
    updateContent_knowledgeBaseId,

    -- * Destructuring the Response
    UpdateContentResponse (..),
    newUpdateContentResponse,

    -- * Response Lenses
    updateContentResponse_content,
    updateContentResponse_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.Wisdom.Types

-- | /See:/ 'newUpdateContent' smart constructor.
data UpdateContent = UpdateContent'
  { -- | The URI for the article. If the knowledge base has a templateUri,
    -- setting this argument overrides it for this piece of content. To remove
    -- an existing @overrideLinkOurUri@, exclude this argument and set
    -- @removeOverrideLinkOutUri@ to true.
    UpdateContent -> Maybe Text
overrideLinkOutUri :: Prelude.Maybe Prelude.Text,
    -- | Unset the existing @overrideLinkOutUri@ if it exists.
    UpdateContent -> Maybe Bool
removeOverrideLinkOutUri :: Prelude.Maybe Prelude.Bool,
    -- | A key\/value map to store attributes without affecting tagging or
    -- recommendations. For example, when synchronizing data between an
    -- external system and Wisdom, you can store an external version identifier
    -- as metadata to utilize for determining drift.
    UpdateContent -> Maybe (HashMap Text Text)
metadata :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
    -- | The title of the content.
    UpdateContent -> Maybe Text
title :: Prelude.Maybe Prelude.Text,
    -- | The @revisionId@ of the content resource to update, taken from an
    -- earlier call to @GetContent@, @GetContentSummary@, @SearchContent@, or
    -- @ListContents@. If included, this argument acts as an optimistic lock to
    -- ensure content was not modified since it was last read. If it has been
    -- modified, this API throws a @PreconditionFailedException@.
    UpdateContent -> Maybe Text
revisionId :: Prelude.Maybe Prelude.Text,
    -- | A pointer to the uploaded asset. This value is returned by
    -- <https://docs.aws.amazon.com/wisdom/latest/APIReference/API_StartContentUpload.html StartContentUpload>.
    UpdateContent -> Maybe Text
uploadId :: Prelude.Maybe Prelude.Text,
    -- | The identifier of the content. Can be either the ID or the ARN. URLs
    -- cannot contain the ARN.
    UpdateContent -> Text
contentId :: Prelude.Text,
    -- | The the identifier of the knowledge base. Can be either the ID or the
    -- ARN
    UpdateContent -> Text
knowledgeBaseId :: Prelude.Text
  }
  deriving (UpdateContent -> UpdateContent -> Bool
(UpdateContent -> UpdateContent -> Bool)
-> (UpdateContent -> UpdateContent -> Bool) -> Eq UpdateContent
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateContent -> UpdateContent -> Bool
$c/= :: UpdateContent -> UpdateContent -> Bool
== :: UpdateContent -> UpdateContent -> Bool
$c== :: UpdateContent -> UpdateContent -> Bool
Prelude.Eq, ReadPrec [UpdateContent]
ReadPrec UpdateContent
Int -> ReadS UpdateContent
ReadS [UpdateContent]
(Int -> ReadS UpdateContent)
-> ReadS [UpdateContent]
-> ReadPrec UpdateContent
-> ReadPrec [UpdateContent]
-> Read UpdateContent
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateContent]
$creadListPrec :: ReadPrec [UpdateContent]
readPrec :: ReadPrec UpdateContent
$creadPrec :: ReadPrec UpdateContent
readList :: ReadS [UpdateContent]
$creadList :: ReadS [UpdateContent]
readsPrec :: Int -> ReadS UpdateContent
$creadsPrec :: Int -> ReadS UpdateContent
Prelude.Read, Int -> UpdateContent -> ShowS
[UpdateContent] -> ShowS
UpdateContent -> String
(Int -> UpdateContent -> ShowS)
-> (UpdateContent -> String)
-> ([UpdateContent] -> ShowS)
-> Show UpdateContent
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateContent] -> ShowS
$cshowList :: [UpdateContent] -> ShowS
show :: UpdateContent -> String
$cshow :: UpdateContent -> String
showsPrec :: Int -> UpdateContent -> ShowS
$cshowsPrec :: Int -> UpdateContent -> ShowS
Prelude.Show, (forall x. UpdateContent -> Rep UpdateContent x)
-> (forall x. Rep UpdateContent x -> UpdateContent)
-> Generic UpdateContent
forall x. Rep UpdateContent x -> UpdateContent
forall x. UpdateContent -> Rep UpdateContent x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateContent x -> UpdateContent
$cfrom :: forall x. UpdateContent -> Rep UpdateContent x
Prelude.Generic)

-- |
-- Create a value of 'UpdateContent' 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:
--
-- 'overrideLinkOutUri', 'updateContent_overrideLinkOutUri' - The URI for the article. If the knowledge base has a templateUri,
-- setting this argument overrides it for this piece of content. To remove
-- an existing @overrideLinkOurUri@, exclude this argument and set
-- @removeOverrideLinkOutUri@ to true.
--
-- 'removeOverrideLinkOutUri', 'updateContent_removeOverrideLinkOutUri' - Unset the existing @overrideLinkOutUri@ if it exists.
--
-- 'metadata', 'updateContent_metadata' - A key\/value map to store attributes without affecting tagging or
-- recommendations. For example, when synchronizing data between an
-- external system and Wisdom, you can store an external version identifier
-- as metadata to utilize for determining drift.
--
-- 'title', 'updateContent_title' - The title of the content.
--
-- 'revisionId', 'updateContent_revisionId' - The @revisionId@ of the content resource to update, taken from an
-- earlier call to @GetContent@, @GetContentSummary@, @SearchContent@, or
-- @ListContents@. If included, this argument acts as an optimistic lock to
-- ensure content was not modified since it was last read. If it has been
-- modified, this API throws a @PreconditionFailedException@.
--
-- 'uploadId', 'updateContent_uploadId' - A pointer to the uploaded asset. This value is returned by
-- <https://docs.aws.amazon.com/wisdom/latest/APIReference/API_StartContentUpload.html StartContentUpload>.
--
-- 'contentId', 'updateContent_contentId' - The identifier of the content. Can be either the ID or the ARN. URLs
-- cannot contain the ARN.
--
-- 'knowledgeBaseId', 'updateContent_knowledgeBaseId' - The the identifier of the knowledge base. Can be either the ID or the
-- ARN
newUpdateContent ::
  -- | 'contentId'
  Prelude.Text ->
  -- | 'knowledgeBaseId'
  Prelude.Text ->
  UpdateContent
newUpdateContent :: Text -> Text -> UpdateContent
newUpdateContent Text
pContentId_ Text
pKnowledgeBaseId_ =
  UpdateContent' :: Maybe Text
-> Maybe Bool
-> Maybe (HashMap Text Text)
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Text
-> Text
-> UpdateContent
UpdateContent'
    { $sel:overrideLinkOutUri:UpdateContent' :: Maybe Text
overrideLinkOutUri =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:removeOverrideLinkOutUri:UpdateContent' :: Maybe Bool
removeOverrideLinkOutUri = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:metadata:UpdateContent' :: Maybe (HashMap Text Text)
metadata = Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing,
      $sel:title:UpdateContent' :: Maybe Text
title = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:revisionId:UpdateContent' :: Maybe Text
revisionId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:uploadId:UpdateContent' :: Maybe Text
uploadId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:contentId:UpdateContent' :: Text
contentId = Text
pContentId_,
      $sel:knowledgeBaseId:UpdateContent' :: Text
knowledgeBaseId = Text
pKnowledgeBaseId_
    }

-- | The URI for the article. If the knowledge base has a templateUri,
-- setting this argument overrides it for this piece of content. To remove
-- an existing @overrideLinkOurUri@, exclude this argument and set
-- @removeOverrideLinkOutUri@ to true.
updateContent_overrideLinkOutUri :: Lens.Lens' UpdateContent (Prelude.Maybe Prelude.Text)
updateContent_overrideLinkOutUri :: (Maybe Text -> f (Maybe Text)) -> UpdateContent -> f UpdateContent
updateContent_overrideLinkOutUri = (UpdateContent -> Maybe Text)
-> (UpdateContent -> Maybe Text -> UpdateContent)
-> Lens UpdateContent UpdateContent (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateContent' {Maybe Text
overrideLinkOutUri :: Maybe Text
$sel:overrideLinkOutUri:UpdateContent' :: UpdateContent -> Maybe Text
overrideLinkOutUri} -> Maybe Text
overrideLinkOutUri) (\s :: UpdateContent
s@UpdateContent' {} Maybe Text
a -> UpdateContent
s {$sel:overrideLinkOutUri:UpdateContent' :: Maybe Text
overrideLinkOutUri = Maybe Text
a} :: UpdateContent)

-- | Unset the existing @overrideLinkOutUri@ if it exists.
updateContent_removeOverrideLinkOutUri :: Lens.Lens' UpdateContent (Prelude.Maybe Prelude.Bool)
updateContent_removeOverrideLinkOutUri :: (Maybe Bool -> f (Maybe Bool)) -> UpdateContent -> f UpdateContent
updateContent_removeOverrideLinkOutUri = (UpdateContent -> Maybe Bool)
-> (UpdateContent -> Maybe Bool -> UpdateContent)
-> Lens UpdateContent UpdateContent (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateContent' {Maybe Bool
removeOverrideLinkOutUri :: Maybe Bool
$sel:removeOverrideLinkOutUri:UpdateContent' :: UpdateContent -> Maybe Bool
removeOverrideLinkOutUri} -> Maybe Bool
removeOverrideLinkOutUri) (\s :: UpdateContent
s@UpdateContent' {} Maybe Bool
a -> UpdateContent
s {$sel:removeOverrideLinkOutUri:UpdateContent' :: Maybe Bool
removeOverrideLinkOutUri = Maybe Bool
a} :: UpdateContent)

-- | A key\/value map to store attributes without affecting tagging or
-- recommendations. For example, when synchronizing data between an
-- external system and Wisdom, you can store an external version identifier
-- as metadata to utilize for determining drift.
updateContent_metadata :: Lens.Lens' UpdateContent (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
updateContent_metadata :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> UpdateContent -> f UpdateContent
updateContent_metadata = (UpdateContent -> Maybe (HashMap Text Text))
-> (UpdateContent -> Maybe (HashMap Text Text) -> UpdateContent)
-> Lens
     UpdateContent
     UpdateContent
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateContent' {Maybe (HashMap Text Text)
metadata :: Maybe (HashMap Text Text)
$sel:metadata:UpdateContent' :: UpdateContent -> Maybe (HashMap Text Text)
metadata} -> Maybe (HashMap Text Text)
metadata) (\s :: UpdateContent
s@UpdateContent' {} Maybe (HashMap Text Text)
a -> UpdateContent
s {$sel:metadata:UpdateContent' :: Maybe (HashMap Text Text)
metadata = Maybe (HashMap Text Text)
a} :: UpdateContent) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
 -> UpdateContent -> f UpdateContent)
-> ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
    -> Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> UpdateContent
-> f UpdateContent
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
-> Iso
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text 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
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The title of the content.
updateContent_title :: Lens.Lens' UpdateContent (Prelude.Maybe Prelude.Text)
updateContent_title :: (Maybe Text -> f (Maybe Text)) -> UpdateContent -> f UpdateContent
updateContent_title = (UpdateContent -> Maybe Text)
-> (UpdateContent -> Maybe Text -> UpdateContent)
-> Lens UpdateContent UpdateContent (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateContent' {Maybe Text
title :: Maybe Text
$sel:title:UpdateContent' :: UpdateContent -> Maybe Text
title} -> Maybe Text
title) (\s :: UpdateContent
s@UpdateContent' {} Maybe Text
a -> UpdateContent
s {$sel:title:UpdateContent' :: Maybe Text
title = Maybe Text
a} :: UpdateContent)

-- | The @revisionId@ of the content resource to update, taken from an
-- earlier call to @GetContent@, @GetContentSummary@, @SearchContent@, or
-- @ListContents@. If included, this argument acts as an optimistic lock to
-- ensure content was not modified since it was last read. If it has been
-- modified, this API throws a @PreconditionFailedException@.
updateContent_revisionId :: Lens.Lens' UpdateContent (Prelude.Maybe Prelude.Text)
updateContent_revisionId :: (Maybe Text -> f (Maybe Text)) -> UpdateContent -> f UpdateContent
updateContent_revisionId = (UpdateContent -> Maybe Text)
-> (UpdateContent -> Maybe Text -> UpdateContent)
-> Lens UpdateContent UpdateContent (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateContent' {Maybe Text
revisionId :: Maybe Text
$sel:revisionId:UpdateContent' :: UpdateContent -> Maybe Text
revisionId} -> Maybe Text
revisionId) (\s :: UpdateContent
s@UpdateContent' {} Maybe Text
a -> UpdateContent
s {$sel:revisionId:UpdateContent' :: Maybe Text
revisionId = Maybe Text
a} :: UpdateContent)

-- | A pointer to the uploaded asset. This value is returned by
-- <https://docs.aws.amazon.com/wisdom/latest/APIReference/API_StartContentUpload.html StartContentUpload>.
updateContent_uploadId :: Lens.Lens' UpdateContent (Prelude.Maybe Prelude.Text)
updateContent_uploadId :: (Maybe Text -> f (Maybe Text)) -> UpdateContent -> f UpdateContent
updateContent_uploadId = (UpdateContent -> Maybe Text)
-> (UpdateContent -> Maybe Text -> UpdateContent)
-> Lens UpdateContent UpdateContent (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateContent' {Maybe Text
uploadId :: Maybe Text
$sel:uploadId:UpdateContent' :: UpdateContent -> Maybe Text
uploadId} -> Maybe Text
uploadId) (\s :: UpdateContent
s@UpdateContent' {} Maybe Text
a -> UpdateContent
s {$sel:uploadId:UpdateContent' :: Maybe Text
uploadId = Maybe Text
a} :: UpdateContent)

-- | The identifier of the content. Can be either the ID or the ARN. URLs
-- cannot contain the ARN.
updateContent_contentId :: Lens.Lens' UpdateContent Prelude.Text
updateContent_contentId :: (Text -> f Text) -> UpdateContent -> f UpdateContent
updateContent_contentId = (UpdateContent -> Text)
-> (UpdateContent -> Text -> UpdateContent)
-> Lens UpdateContent UpdateContent Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateContent' {Text
contentId :: Text
$sel:contentId:UpdateContent' :: UpdateContent -> Text
contentId} -> Text
contentId) (\s :: UpdateContent
s@UpdateContent' {} Text
a -> UpdateContent
s {$sel:contentId:UpdateContent' :: Text
contentId = Text
a} :: UpdateContent)

-- | The the identifier of the knowledge base. Can be either the ID or the
-- ARN
updateContent_knowledgeBaseId :: Lens.Lens' UpdateContent Prelude.Text
updateContent_knowledgeBaseId :: (Text -> f Text) -> UpdateContent -> f UpdateContent
updateContent_knowledgeBaseId = (UpdateContent -> Text)
-> (UpdateContent -> Text -> UpdateContent)
-> Lens UpdateContent UpdateContent Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateContent' {Text
knowledgeBaseId :: Text
$sel:knowledgeBaseId:UpdateContent' :: UpdateContent -> Text
knowledgeBaseId} -> Text
knowledgeBaseId) (\s :: UpdateContent
s@UpdateContent' {} Text
a -> UpdateContent
s {$sel:knowledgeBaseId:UpdateContent' :: Text
knowledgeBaseId = Text
a} :: UpdateContent)

instance Core.AWSRequest UpdateContent where
  type
    AWSResponse UpdateContent =
      UpdateContentResponse
  request :: UpdateContent -> Request UpdateContent
request = Service -> UpdateContent -> Request UpdateContent
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy UpdateContent
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UpdateContent)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse UpdateContent))
-> Logger
-> Service
-> Proxy UpdateContent
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UpdateContent)))
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 ContentData -> Int -> UpdateContentResponse
UpdateContentResponse'
            (Maybe ContentData -> Int -> UpdateContentResponse)
-> Either String (Maybe ContentData)
-> Either String (Int -> UpdateContentResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe ContentData)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"content")
            Either String (Int -> UpdateContentResponse)
-> Either String Int -> Either String UpdateContentResponse
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 UpdateContent

instance Prelude.NFData UpdateContent

instance Core.ToHeaders UpdateContent where
  toHeaders :: UpdateContent -> ResponseHeaders
toHeaders =
    ResponseHeaders -> UpdateContent -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ 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 UpdateContent where
  toJSON :: UpdateContent -> Value
toJSON UpdateContent' {Maybe Bool
Maybe Text
Maybe (HashMap Text Text)
Text
knowledgeBaseId :: Text
contentId :: Text
uploadId :: Maybe Text
revisionId :: Maybe Text
title :: Maybe Text
metadata :: Maybe (HashMap Text Text)
removeOverrideLinkOutUri :: Maybe Bool
overrideLinkOutUri :: Maybe Text
$sel:knowledgeBaseId:UpdateContent' :: UpdateContent -> Text
$sel:contentId:UpdateContent' :: UpdateContent -> Text
$sel:uploadId:UpdateContent' :: UpdateContent -> Maybe Text
$sel:revisionId:UpdateContent' :: UpdateContent -> Maybe Text
$sel:title:UpdateContent' :: UpdateContent -> Maybe Text
$sel:metadata:UpdateContent' :: UpdateContent -> Maybe (HashMap Text Text)
$sel:removeOverrideLinkOutUri:UpdateContent' :: UpdateContent -> Maybe Bool
$sel:overrideLinkOutUri:UpdateContent' :: UpdateContent -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"overrideLinkOutUri" 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
overrideLinkOutUri,
            (Text
"removeOverrideLinkOutUri" 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
removeOverrideLinkOutUri,
            (Text
"metadata" Text -> HashMap Text Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (HashMap Text Text -> Pair)
-> Maybe (HashMap Text Text) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (HashMap Text Text)
metadata,
            (Text
"title" 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
title,
            (Text
"revisionId" 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
revisionId,
            (Text
"uploadId" 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
uploadId
          ]
      )

instance Core.ToPath UpdateContent where
  toPath :: UpdateContent -> ByteString
toPath UpdateContent' {Maybe Bool
Maybe Text
Maybe (HashMap Text Text)
Text
knowledgeBaseId :: Text
contentId :: Text
uploadId :: Maybe Text
revisionId :: Maybe Text
title :: Maybe Text
metadata :: Maybe (HashMap Text Text)
removeOverrideLinkOutUri :: Maybe Bool
overrideLinkOutUri :: Maybe Text
$sel:knowledgeBaseId:UpdateContent' :: UpdateContent -> Text
$sel:contentId:UpdateContent' :: UpdateContent -> Text
$sel:uploadId:UpdateContent' :: UpdateContent -> Maybe Text
$sel:revisionId:UpdateContent' :: UpdateContent -> Maybe Text
$sel:title:UpdateContent' :: UpdateContent -> Maybe Text
$sel:metadata:UpdateContent' :: UpdateContent -> Maybe (HashMap Text Text)
$sel:removeOverrideLinkOutUri:UpdateContent' :: UpdateContent -> Maybe Bool
$sel:overrideLinkOutUri:UpdateContent' :: UpdateContent -> Maybe Text
..} =
    [ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/knowledgeBases/",
        Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
knowledgeBaseId,
        ByteString
"/contents/",
        Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
contentId
      ]

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

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

-- |
-- Create a value of 'UpdateContentResponse' 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:
--
-- 'content', 'updateContentResponse_content' - The content.
--
-- 'httpStatus', 'updateContentResponse_httpStatus' - The response's http status code.
newUpdateContentResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  UpdateContentResponse
newUpdateContentResponse :: Int -> UpdateContentResponse
newUpdateContentResponse Int
pHttpStatus_ =
  UpdateContentResponse' :: Maybe ContentData -> Int -> UpdateContentResponse
UpdateContentResponse'
    { $sel:content:UpdateContentResponse' :: Maybe ContentData
content = Maybe ContentData
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:UpdateContentResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The content.
updateContentResponse_content :: Lens.Lens' UpdateContentResponse (Prelude.Maybe ContentData)
updateContentResponse_content :: (Maybe ContentData -> f (Maybe ContentData))
-> UpdateContentResponse -> f UpdateContentResponse
updateContentResponse_content = (UpdateContentResponse -> Maybe ContentData)
-> (UpdateContentResponse
    -> Maybe ContentData -> UpdateContentResponse)
-> Lens
     UpdateContentResponse
     UpdateContentResponse
     (Maybe ContentData)
     (Maybe ContentData)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateContentResponse' {Maybe ContentData
content :: Maybe ContentData
$sel:content:UpdateContentResponse' :: UpdateContentResponse -> Maybe ContentData
content} -> Maybe ContentData
content) (\s :: UpdateContentResponse
s@UpdateContentResponse' {} Maybe ContentData
a -> UpdateContentResponse
s {$sel:content:UpdateContentResponse' :: Maybe ContentData
content = Maybe ContentData
a} :: UpdateContentResponse)

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

instance Prelude.NFData UpdateContentResponse