{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- 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_metadata,
    updateContent_overrideLinkOutUri,
    updateContent_removeOverrideLinkOutUri,
    updateContent_revisionId,
    updateContent_title,
    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.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
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'
  { -- | 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 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,
    -- | 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,
    -- | The title of the content.
    UpdateContent -> Maybe Text
title :: 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 identifier of the knowledge base. Can be either the ID or the ARN
    UpdateContent -> Text
knowledgeBaseId :: Prelude.Text
  }
  deriving (UpdateContent -> UpdateContent -> Bool
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]
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
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. 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:
--
-- '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.
--
-- '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.
--
-- '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@.
--
-- 'title', 'updateContent_title' - The title of the content.
--
-- '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 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'
    { $sel:metadata:UpdateContent' :: Maybe (HashMap Text Text)
metadata = forall a. Maybe a
Prelude.Nothing,
      $sel:overrideLinkOutUri:UpdateContent' :: Maybe Text
overrideLinkOutUri = forall a. Maybe a
Prelude.Nothing,
      $sel:removeOverrideLinkOutUri:UpdateContent' :: Maybe Bool
removeOverrideLinkOutUri = forall a. Maybe a
Prelude.Nothing,
      $sel:revisionId:UpdateContent' :: Maybe Text
revisionId = forall a. Maybe a
Prelude.Nothing,
      $sel:title:UpdateContent' :: Maybe Text
title = forall a. Maybe a
Prelude.Nothing,
      $sel:uploadId:UpdateContent' :: Maybe Text
uploadId = forall a. Maybe a
Prelude.Nothing,
      $sel:contentId:UpdateContent' :: Text
contentId = Text
pContentId_,
      $sel:knowledgeBaseId:UpdateContent' :: Text
knowledgeBaseId = Text
pKnowledgeBaseId_
    }

-- | 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 :: Lens' UpdateContent (Maybe (HashMap Text Text))
updateContent_metadata = 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) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | 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 :: Lens' UpdateContent (Maybe Text)
updateContent_overrideLinkOutUri = 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 :: Lens' UpdateContent (Maybe Bool)
updateContent_removeOverrideLinkOutUri = 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)

-- | 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 :: Lens' UpdateContent (Maybe Text)
updateContent_revisionId = 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)

-- | The title of the content.
updateContent_title :: Lens.Lens' UpdateContent (Prelude.Maybe Prelude.Text)
updateContent_title :: Lens' UpdateContent (Maybe Text)
updateContent_title = 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)

-- | 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 :: Lens' UpdateContent (Maybe Text)
updateContent_uploadId = 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 :: Lens' UpdateContent Text
updateContent_contentId = 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 identifier of the knowledge base. Can be either the ID or the ARN
updateContent_knowledgeBaseId :: Lens.Lens' UpdateContent Prelude.Text
updateContent_knowledgeBaseId :: Lens' UpdateContent Text
updateContent_knowledgeBaseId = 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 :: (Service -> Service) -> UpdateContent -> Request UpdateContent
request Service -> Service
overrides =
    forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy UpdateContent
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UpdateContent)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe ContentData -> Int -> UpdateContentResponse
UpdateContentResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"content")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable UpdateContent where
  hashWithSalt :: Int -> UpdateContent -> Int
hashWithSalt Int
_salt UpdateContent' {Maybe Bool
Maybe Text
Maybe (HashMap Text Text)
Text
knowledgeBaseId :: Text
contentId :: Text
uploadId :: Maybe Text
title :: Maybe Text
revisionId :: Maybe Text
removeOverrideLinkOutUri :: Maybe Bool
overrideLinkOutUri :: Maybe Text
metadata :: Maybe (HashMap Text Text)
$sel:knowledgeBaseId:UpdateContent' :: UpdateContent -> Text
$sel:contentId:UpdateContent' :: UpdateContent -> Text
$sel:uploadId:UpdateContent' :: UpdateContent -> Maybe Text
$sel:title:UpdateContent' :: UpdateContent -> Maybe Text
$sel:revisionId:UpdateContent' :: UpdateContent -> Maybe Text
$sel:removeOverrideLinkOutUri:UpdateContent' :: UpdateContent -> Maybe Bool
$sel:overrideLinkOutUri:UpdateContent' :: UpdateContent -> Maybe Text
$sel:metadata:UpdateContent' :: UpdateContent -> Maybe (HashMap Text Text)
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (HashMap Text Text)
metadata
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
overrideLinkOutUri
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
removeOverrideLinkOutUri
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
revisionId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
title
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
uploadId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
contentId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
knowledgeBaseId

instance Prelude.NFData UpdateContent where
  rnf :: UpdateContent -> ()
rnf UpdateContent' {Maybe Bool
Maybe Text
Maybe (HashMap Text Text)
Text
knowledgeBaseId :: Text
contentId :: Text
uploadId :: Maybe Text
title :: Maybe Text
revisionId :: Maybe Text
removeOverrideLinkOutUri :: Maybe Bool
overrideLinkOutUri :: Maybe Text
metadata :: Maybe (HashMap Text Text)
$sel:knowledgeBaseId:UpdateContent' :: UpdateContent -> Text
$sel:contentId:UpdateContent' :: UpdateContent -> Text
$sel:uploadId:UpdateContent' :: UpdateContent -> Maybe Text
$sel:title:UpdateContent' :: UpdateContent -> Maybe Text
$sel:revisionId:UpdateContent' :: UpdateContent -> Maybe Text
$sel:removeOverrideLinkOutUri:UpdateContent' :: UpdateContent -> Maybe Bool
$sel:overrideLinkOutUri:UpdateContent' :: UpdateContent -> Maybe Text
$sel:metadata:UpdateContent' :: UpdateContent -> Maybe (HashMap Text Text)
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe (HashMap Text Text)
metadata
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
overrideLinkOutUri
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
removeOverrideLinkOutUri
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
revisionId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
title
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
uploadId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
contentId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
knowledgeBaseId

instance Data.ToHeaders UpdateContent where
  toHeaders :: UpdateContent -> ResponseHeaders
toHeaders =
    forall a b. a -> b -> a
Prelude.const
      ( forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"Content-Type"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Data.ToJSON UpdateContent where
  toJSON :: UpdateContent -> Value
toJSON UpdateContent' {Maybe Bool
Maybe Text
Maybe (HashMap Text Text)
Text
knowledgeBaseId :: Text
contentId :: Text
uploadId :: Maybe Text
title :: Maybe Text
revisionId :: Maybe Text
removeOverrideLinkOutUri :: Maybe Bool
overrideLinkOutUri :: Maybe Text
metadata :: Maybe (HashMap Text Text)
$sel:knowledgeBaseId:UpdateContent' :: UpdateContent -> Text
$sel:contentId:UpdateContent' :: UpdateContent -> Text
$sel:uploadId:UpdateContent' :: UpdateContent -> Maybe Text
$sel:title:UpdateContent' :: UpdateContent -> Maybe Text
$sel:revisionId:UpdateContent' :: UpdateContent -> Maybe Text
$sel:removeOverrideLinkOutUri:UpdateContent' :: UpdateContent -> Maybe Bool
$sel:overrideLinkOutUri:UpdateContent' :: UpdateContent -> Maybe Text
$sel:metadata:UpdateContent' :: UpdateContent -> Maybe (HashMap Text Text)
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"metadata" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (HashMap Text Text)
metadata,
            (Key
"overrideLinkOutUri" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
overrideLinkOutUri,
            (Key
"removeOverrideLinkOutUri" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
removeOverrideLinkOutUri,
            (Key
"revisionId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
revisionId,
            (Key
"title" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
title,
            (Key
"uploadId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
uploadId
          ]
      )

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

instance Data.ToQuery UpdateContent where
  toQuery :: UpdateContent -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const 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
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
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. 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'
    { $sel:content:UpdateContentResponse' :: Maybe ContentData
content = 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 :: Lens' UpdateContentResponse (Maybe ContentData)
updateContentResponse_content = 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 :: Lens' UpdateContentResponse Int
updateContentResponse_httpStatus = 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 where
  rnf :: UpdateContentResponse -> ()
rnf UpdateContentResponse' {Int
Maybe ContentData
httpStatus :: Int
content :: Maybe ContentData
$sel:httpStatus:UpdateContentResponse' :: UpdateContentResponse -> Int
$sel:content:UpdateContentResponse' :: UpdateContentResponse -> Maybe ContentData
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe ContentData
content
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus