{-# 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.CodeArtifact.GetPackageVersionReadme
-- 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)
--
-- Gets the readme file or descriptive text for a package version. For
-- packages that do not contain a readme file, CodeArtifact extracts a
-- description from a metadata file. For example, from the @\<description>@
-- element in the @pom.xml@ file of a Maven package.
--
-- The returned text might contain formatting. For example, it might
-- contain formatting for Markdown or reStructuredText.
module Amazonka.CodeArtifact.GetPackageVersionReadme
  ( -- * Creating a Request
    GetPackageVersionReadme (..),
    newGetPackageVersionReadme,

    -- * Request Lenses
    getPackageVersionReadme_namespace,
    getPackageVersionReadme_domainOwner,
    getPackageVersionReadme_domain,
    getPackageVersionReadme_repository,
    getPackageVersionReadme_format,
    getPackageVersionReadme_package,
    getPackageVersionReadme_packageVersion,

    -- * Destructuring the Response
    GetPackageVersionReadmeResponse (..),
    newGetPackageVersionReadmeResponse,

    -- * Response Lenses
    getPackageVersionReadmeResponse_readme,
    getPackageVersionReadmeResponse_format,
    getPackageVersionReadmeResponse_namespace,
    getPackageVersionReadmeResponse_versionRevision,
    getPackageVersionReadmeResponse_version,
    getPackageVersionReadmeResponse_package,
    getPackageVersionReadmeResponse_httpStatus,
  )
where

import Amazonka.CodeArtifact.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

-- | /See:/ 'newGetPackageVersionReadme' smart constructor.
data GetPackageVersionReadme = GetPackageVersionReadme'
  { -- | The namespace of the package. The package component that specifies its
    -- namespace depends on its type. For example:
    --
    -- -   The namespace of a Maven package is its @groupId@.
    --
    -- -   The namespace of an npm package is its @scope@.
    --
    -- -   A Python package does not contain a corresponding component, so
    --     Python packages do not have a namespace.
    GetPackageVersionReadme -> Maybe Text
namespace :: Prelude.Maybe Prelude.Text,
    -- | The 12-digit account number of the AWS account that owns the domain. It
    -- does not include dashes or spaces.
    GetPackageVersionReadme -> Maybe Text
domainOwner :: Prelude.Maybe Prelude.Text,
    -- | The name of the domain that contains the repository that contains the
    -- package version with the requested readme file.
    GetPackageVersionReadme -> Text
domain :: Prelude.Text,
    -- | The repository that contains the package with the requested readme file.
    GetPackageVersionReadme -> Text
repository :: Prelude.Text,
    -- | A format that specifies the type of the package version with the
    -- requested readme file. The valid values are:
    --
    -- -   @npm@
    --
    -- -   @pypi@
    --
    -- -   @maven@
    GetPackageVersionReadme -> PackageFormat
format :: PackageFormat,
    -- | The name of the package version that contains the requested readme file.
    GetPackageVersionReadme -> Text
package :: Prelude.Text,
    -- | A string that contains the package version (for example, @3.5.2@).
    GetPackageVersionReadme -> Text
packageVersion :: Prelude.Text
  }
  deriving (GetPackageVersionReadme -> GetPackageVersionReadme -> Bool
(GetPackageVersionReadme -> GetPackageVersionReadme -> Bool)
-> (GetPackageVersionReadme -> GetPackageVersionReadme -> Bool)
-> Eq GetPackageVersionReadme
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetPackageVersionReadme -> GetPackageVersionReadme -> Bool
$c/= :: GetPackageVersionReadme -> GetPackageVersionReadme -> Bool
== :: GetPackageVersionReadme -> GetPackageVersionReadme -> Bool
$c== :: GetPackageVersionReadme -> GetPackageVersionReadme -> Bool
Prelude.Eq, ReadPrec [GetPackageVersionReadme]
ReadPrec GetPackageVersionReadme
Int -> ReadS GetPackageVersionReadme
ReadS [GetPackageVersionReadme]
(Int -> ReadS GetPackageVersionReadme)
-> ReadS [GetPackageVersionReadme]
-> ReadPrec GetPackageVersionReadme
-> ReadPrec [GetPackageVersionReadme]
-> Read GetPackageVersionReadme
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetPackageVersionReadme]
$creadListPrec :: ReadPrec [GetPackageVersionReadme]
readPrec :: ReadPrec GetPackageVersionReadme
$creadPrec :: ReadPrec GetPackageVersionReadme
readList :: ReadS [GetPackageVersionReadme]
$creadList :: ReadS [GetPackageVersionReadme]
readsPrec :: Int -> ReadS GetPackageVersionReadme
$creadsPrec :: Int -> ReadS GetPackageVersionReadme
Prelude.Read, Int -> GetPackageVersionReadme -> ShowS
[GetPackageVersionReadme] -> ShowS
GetPackageVersionReadme -> String
(Int -> GetPackageVersionReadme -> ShowS)
-> (GetPackageVersionReadme -> String)
-> ([GetPackageVersionReadme] -> ShowS)
-> Show GetPackageVersionReadme
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetPackageVersionReadme] -> ShowS
$cshowList :: [GetPackageVersionReadme] -> ShowS
show :: GetPackageVersionReadme -> String
$cshow :: GetPackageVersionReadme -> String
showsPrec :: Int -> GetPackageVersionReadme -> ShowS
$cshowsPrec :: Int -> GetPackageVersionReadme -> ShowS
Prelude.Show, (forall x.
 GetPackageVersionReadme -> Rep GetPackageVersionReadme x)
-> (forall x.
    Rep GetPackageVersionReadme x -> GetPackageVersionReadme)
-> Generic GetPackageVersionReadme
forall x. Rep GetPackageVersionReadme x -> GetPackageVersionReadme
forall x. GetPackageVersionReadme -> Rep GetPackageVersionReadme x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetPackageVersionReadme x -> GetPackageVersionReadme
$cfrom :: forall x. GetPackageVersionReadme -> Rep GetPackageVersionReadme x
Prelude.Generic)

-- |
-- Create a value of 'GetPackageVersionReadme' 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:
--
-- 'namespace', 'getPackageVersionReadme_namespace' - The namespace of the package. The package component that specifies its
-- namespace depends on its type. For example:
--
-- -   The namespace of a Maven package is its @groupId@.
--
-- -   The namespace of an npm package is its @scope@.
--
-- -   A Python package does not contain a corresponding component, so
--     Python packages do not have a namespace.
--
-- 'domainOwner', 'getPackageVersionReadme_domainOwner' - The 12-digit account number of the AWS account that owns the domain. It
-- does not include dashes or spaces.
--
-- 'domain', 'getPackageVersionReadme_domain' - The name of the domain that contains the repository that contains the
-- package version with the requested readme file.
--
-- 'repository', 'getPackageVersionReadme_repository' - The repository that contains the package with the requested readme file.
--
-- 'format', 'getPackageVersionReadme_format' - A format that specifies the type of the package version with the
-- requested readme file. The valid values are:
--
-- -   @npm@
--
-- -   @pypi@
--
-- -   @maven@
--
-- 'package', 'getPackageVersionReadme_package' - The name of the package version that contains the requested readme file.
--
-- 'packageVersion', 'getPackageVersionReadme_packageVersion' - A string that contains the package version (for example, @3.5.2@).
newGetPackageVersionReadme ::
  -- | 'domain'
  Prelude.Text ->
  -- | 'repository'
  Prelude.Text ->
  -- | 'format'
  PackageFormat ->
  -- | 'package'
  Prelude.Text ->
  -- | 'packageVersion'
  Prelude.Text ->
  GetPackageVersionReadme
newGetPackageVersionReadme :: Text
-> Text -> PackageFormat -> Text -> Text -> GetPackageVersionReadme
newGetPackageVersionReadme
  Text
pDomain_
  Text
pRepository_
  PackageFormat
pFormat_
  Text
pPackage_
  Text
pPackageVersion_ =
    GetPackageVersionReadme' :: Maybe Text
-> Maybe Text
-> Text
-> Text
-> PackageFormat
-> Text
-> Text
-> GetPackageVersionReadme
GetPackageVersionReadme'
      { $sel:namespace:GetPackageVersionReadme' :: Maybe Text
namespace =
          Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:domainOwner:GetPackageVersionReadme' :: Maybe Text
domainOwner = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:domain:GetPackageVersionReadme' :: Text
domain = Text
pDomain_,
        $sel:repository:GetPackageVersionReadme' :: Text
repository = Text
pRepository_,
        $sel:format:GetPackageVersionReadme' :: PackageFormat
format = PackageFormat
pFormat_,
        $sel:package:GetPackageVersionReadme' :: Text
package = Text
pPackage_,
        $sel:packageVersion:GetPackageVersionReadme' :: Text
packageVersion = Text
pPackageVersion_
      }

-- | The namespace of the package. The package component that specifies its
-- namespace depends on its type. For example:
--
-- -   The namespace of a Maven package is its @groupId@.
--
-- -   The namespace of an npm package is its @scope@.
--
-- -   A Python package does not contain a corresponding component, so
--     Python packages do not have a namespace.
getPackageVersionReadme_namespace :: Lens.Lens' GetPackageVersionReadme (Prelude.Maybe Prelude.Text)
getPackageVersionReadme_namespace :: (Maybe Text -> f (Maybe Text))
-> GetPackageVersionReadme -> f GetPackageVersionReadme
getPackageVersionReadme_namespace = (GetPackageVersionReadme -> Maybe Text)
-> (GetPackageVersionReadme
    -> Maybe Text -> GetPackageVersionReadme)
-> Lens
     GetPackageVersionReadme
     GetPackageVersionReadme
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetPackageVersionReadme' {Maybe Text
namespace :: Maybe Text
$sel:namespace:GetPackageVersionReadme' :: GetPackageVersionReadme -> Maybe Text
namespace} -> Maybe Text
namespace) (\s :: GetPackageVersionReadme
s@GetPackageVersionReadme' {} Maybe Text
a -> GetPackageVersionReadme
s {$sel:namespace:GetPackageVersionReadme' :: Maybe Text
namespace = Maybe Text
a} :: GetPackageVersionReadme)

-- | The 12-digit account number of the AWS account that owns the domain. It
-- does not include dashes or spaces.
getPackageVersionReadme_domainOwner :: Lens.Lens' GetPackageVersionReadme (Prelude.Maybe Prelude.Text)
getPackageVersionReadme_domainOwner :: (Maybe Text -> f (Maybe Text))
-> GetPackageVersionReadme -> f GetPackageVersionReadme
getPackageVersionReadme_domainOwner = (GetPackageVersionReadme -> Maybe Text)
-> (GetPackageVersionReadme
    -> Maybe Text -> GetPackageVersionReadme)
-> Lens
     GetPackageVersionReadme
     GetPackageVersionReadme
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetPackageVersionReadme' {Maybe Text
domainOwner :: Maybe Text
$sel:domainOwner:GetPackageVersionReadme' :: GetPackageVersionReadme -> Maybe Text
domainOwner} -> Maybe Text
domainOwner) (\s :: GetPackageVersionReadme
s@GetPackageVersionReadme' {} Maybe Text
a -> GetPackageVersionReadme
s {$sel:domainOwner:GetPackageVersionReadme' :: Maybe Text
domainOwner = Maybe Text
a} :: GetPackageVersionReadme)

-- | The name of the domain that contains the repository that contains the
-- package version with the requested readme file.
getPackageVersionReadme_domain :: Lens.Lens' GetPackageVersionReadme Prelude.Text
getPackageVersionReadme_domain :: (Text -> f Text)
-> GetPackageVersionReadme -> f GetPackageVersionReadme
getPackageVersionReadme_domain = (GetPackageVersionReadme -> Text)
-> (GetPackageVersionReadme -> Text -> GetPackageVersionReadme)
-> Lens GetPackageVersionReadme GetPackageVersionReadme Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetPackageVersionReadme' {Text
domain :: Text
$sel:domain:GetPackageVersionReadme' :: GetPackageVersionReadme -> Text
domain} -> Text
domain) (\s :: GetPackageVersionReadme
s@GetPackageVersionReadme' {} Text
a -> GetPackageVersionReadme
s {$sel:domain:GetPackageVersionReadme' :: Text
domain = Text
a} :: GetPackageVersionReadme)

-- | The repository that contains the package with the requested readme file.
getPackageVersionReadme_repository :: Lens.Lens' GetPackageVersionReadme Prelude.Text
getPackageVersionReadme_repository :: (Text -> f Text)
-> GetPackageVersionReadme -> f GetPackageVersionReadme
getPackageVersionReadme_repository = (GetPackageVersionReadme -> Text)
-> (GetPackageVersionReadme -> Text -> GetPackageVersionReadme)
-> Lens GetPackageVersionReadme GetPackageVersionReadme Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetPackageVersionReadme' {Text
repository :: Text
$sel:repository:GetPackageVersionReadme' :: GetPackageVersionReadme -> Text
repository} -> Text
repository) (\s :: GetPackageVersionReadme
s@GetPackageVersionReadme' {} Text
a -> GetPackageVersionReadme
s {$sel:repository:GetPackageVersionReadme' :: Text
repository = Text
a} :: GetPackageVersionReadme)

-- | A format that specifies the type of the package version with the
-- requested readme file. The valid values are:
--
-- -   @npm@
--
-- -   @pypi@
--
-- -   @maven@
getPackageVersionReadme_format :: Lens.Lens' GetPackageVersionReadme PackageFormat
getPackageVersionReadme_format :: (PackageFormat -> f PackageFormat)
-> GetPackageVersionReadme -> f GetPackageVersionReadme
getPackageVersionReadme_format = (GetPackageVersionReadme -> PackageFormat)
-> (GetPackageVersionReadme
    -> PackageFormat -> GetPackageVersionReadme)
-> Lens
     GetPackageVersionReadme
     GetPackageVersionReadme
     PackageFormat
     PackageFormat
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetPackageVersionReadme' {PackageFormat
format :: PackageFormat
$sel:format:GetPackageVersionReadme' :: GetPackageVersionReadme -> PackageFormat
format} -> PackageFormat
format) (\s :: GetPackageVersionReadme
s@GetPackageVersionReadme' {} PackageFormat
a -> GetPackageVersionReadme
s {$sel:format:GetPackageVersionReadme' :: PackageFormat
format = PackageFormat
a} :: GetPackageVersionReadme)

-- | The name of the package version that contains the requested readme file.
getPackageVersionReadme_package :: Lens.Lens' GetPackageVersionReadme Prelude.Text
getPackageVersionReadme_package :: (Text -> f Text)
-> GetPackageVersionReadme -> f GetPackageVersionReadme
getPackageVersionReadme_package = (GetPackageVersionReadme -> Text)
-> (GetPackageVersionReadme -> Text -> GetPackageVersionReadme)
-> Lens GetPackageVersionReadme GetPackageVersionReadme Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetPackageVersionReadme' {Text
package :: Text
$sel:package:GetPackageVersionReadme' :: GetPackageVersionReadme -> Text
package} -> Text
package) (\s :: GetPackageVersionReadme
s@GetPackageVersionReadme' {} Text
a -> GetPackageVersionReadme
s {$sel:package:GetPackageVersionReadme' :: Text
package = Text
a} :: GetPackageVersionReadme)

-- | A string that contains the package version (for example, @3.5.2@).
getPackageVersionReadme_packageVersion :: Lens.Lens' GetPackageVersionReadme Prelude.Text
getPackageVersionReadme_packageVersion :: (Text -> f Text)
-> GetPackageVersionReadme -> f GetPackageVersionReadme
getPackageVersionReadme_packageVersion = (GetPackageVersionReadme -> Text)
-> (GetPackageVersionReadme -> Text -> GetPackageVersionReadme)
-> Lens GetPackageVersionReadme GetPackageVersionReadme Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetPackageVersionReadme' {Text
packageVersion :: Text
$sel:packageVersion:GetPackageVersionReadme' :: GetPackageVersionReadme -> Text
packageVersion} -> Text
packageVersion) (\s :: GetPackageVersionReadme
s@GetPackageVersionReadme' {} Text
a -> GetPackageVersionReadme
s {$sel:packageVersion:GetPackageVersionReadme' :: Text
packageVersion = Text
a} :: GetPackageVersionReadme)

instance Core.AWSRequest GetPackageVersionReadme where
  type
    AWSResponse GetPackageVersionReadme =
      GetPackageVersionReadmeResponse
  request :: GetPackageVersionReadme -> Request GetPackageVersionReadme
request = Service
-> GetPackageVersionReadme -> Request GetPackageVersionReadme
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
  response :: Logger
-> Service
-> Proxy GetPackageVersionReadme
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse GetPackageVersionReadme)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse GetPackageVersionReadme))
-> Logger
-> Service
-> Proxy GetPackageVersionReadme
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse GetPackageVersionReadme)))
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 Text
-> Maybe PackageFormat
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Int
-> GetPackageVersionReadmeResponse
GetPackageVersionReadmeResponse'
            (Maybe Text
 -> Maybe PackageFormat
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Int
 -> GetPackageVersionReadmeResponse)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe PackageFormat
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Int
      -> GetPackageVersionReadmeResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"readme")
            Either
  String
  (Maybe PackageFormat
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Int
   -> GetPackageVersionReadmeResponse)
-> Either String (Maybe PackageFormat)
-> Either
     String
     (Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Int
      -> GetPackageVersionReadmeResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe PackageFormat)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"format")
            Either
  String
  (Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Int
   -> GetPackageVersionReadmeResponse)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Int
      -> GetPackageVersionReadmeResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"namespace")
            Either
  String
  (Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Int
   -> GetPackageVersionReadmeResponse)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe Text
      -> Maybe Text -> Int -> GetPackageVersionReadmeResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"versionRevision")
            Either
  String
  (Maybe Text
   -> Maybe Text -> Int -> GetPackageVersionReadmeResponse)
-> Either String (Maybe Text)
-> Either
     String (Maybe Text -> Int -> GetPackageVersionReadmeResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"version")
            Either
  String (Maybe Text -> Int -> GetPackageVersionReadmeResponse)
-> Either String (Maybe Text)
-> Either String (Int -> GetPackageVersionReadmeResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"package")
            Either String (Int -> GetPackageVersionReadmeResponse)
-> Either String Int
-> Either String GetPackageVersionReadmeResponse
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 GetPackageVersionReadme

instance Prelude.NFData GetPackageVersionReadme

instance Core.ToHeaders GetPackageVersionReadme where
  toHeaders :: GetPackageVersionReadme -> ResponseHeaders
toHeaders =
    ResponseHeaders -> GetPackageVersionReadme -> 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.ToPath GetPackageVersionReadme where
  toPath :: GetPackageVersionReadme -> ByteString
toPath = ByteString -> GetPackageVersionReadme -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/v1/package/version/readme"

instance Core.ToQuery GetPackageVersionReadme where
  toQuery :: GetPackageVersionReadme -> QueryString
toQuery GetPackageVersionReadme' {Maybe Text
Text
PackageFormat
packageVersion :: Text
package :: Text
format :: PackageFormat
repository :: Text
domain :: Text
domainOwner :: Maybe Text
namespace :: Maybe Text
$sel:packageVersion:GetPackageVersionReadme' :: GetPackageVersionReadme -> Text
$sel:package:GetPackageVersionReadme' :: GetPackageVersionReadme -> Text
$sel:format:GetPackageVersionReadme' :: GetPackageVersionReadme -> PackageFormat
$sel:repository:GetPackageVersionReadme' :: GetPackageVersionReadme -> Text
$sel:domain:GetPackageVersionReadme' :: GetPackageVersionReadme -> Text
$sel:domainOwner:GetPackageVersionReadme' :: GetPackageVersionReadme -> Maybe Text
$sel:namespace:GetPackageVersionReadme' :: GetPackageVersionReadme -> Maybe Text
..} =
    [QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"namespace" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
namespace,
        ByteString
"domain-owner" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
domainOwner,
        ByteString
"domain" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
domain,
        ByteString
"repository" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
repository,
        ByteString
"format" ByteString -> PackageFormat -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: PackageFormat
format,
        ByteString
"package" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
package,
        ByteString
"version" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
packageVersion
      ]

-- | /See:/ 'newGetPackageVersionReadmeResponse' smart constructor.
data GetPackageVersionReadmeResponse = GetPackageVersionReadmeResponse'
  { -- | The text of the returned readme file.
    GetPackageVersionReadmeResponse -> Maybe Text
readme :: Prelude.Maybe Prelude.Text,
    -- | The format of the package with the requested readme file. Valid format
    -- types are:
    --
    -- -   @npm@
    --
    -- -   @pypi@
    --
    -- -   @maven@
    GetPackageVersionReadmeResponse -> Maybe PackageFormat
format :: Prelude.Maybe PackageFormat,
    -- | The namespace of the package. The package component that specifies its
    -- namespace depends on its type. For example:
    --
    -- -   The namespace of a Maven package is its @groupId@.
    --
    -- -   The namespace of an npm package is its @scope@.
    --
    -- -   A Python package does not contain a corresponding component, so
    --     Python packages do not have a namespace.
    GetPackageVersionReadmeResponse -> Maybe Text
namespace :: Prelude.Maybe Prelude.Text,
    -- | The current revision associated with the package version.
    GetPackageVersionReadmeResponse -> Maybe Text
versionRevision :: Prelude.Maybe Prelude.Text,
    -- | The version of the package with the requested readme file.
    GetPackageVersionReadmeResponse -> Maybe Text
version :: Prelude.Maybe Prelude.Text,
    -- | The name of the package that contains the returned readme file.
    GetPackageVersionReadmeResponse -> Maybe Text
package :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    GetPackageVersionReadmeResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (GetPackageVersionReadmeResponse
-> GetPackageVersionReadmeResponse -> Bool
(GetPackageVersionReadmeResponse
 -> GetPackageVersionReadmeResponse -> Bool)
-> (GetPackageVersionReadmeResponse
    -> GetPackageVersionReadmeResponse -> Bool)
-> Eq GetPackageVersionReadmeResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetPackageVersionReadmeResponse
-> GetPackageVersionReadmeResponse -> Bool
$c/= :: GetPackageVersionReadmeResponse
-> GetPackageVersionReadmeResponse -> Bool
== :: GetPackageVersionReadmeResponse
-> GetPackageVersionReadmeResponse -> Bool
$c== :: GetPackageVersionReadmeResponse
-> GetPackageVersionReadmeResponse -> Bool
Prelude.Eq, ReadPrec [GetPackageVersionReadmeResponse]
ReadPrec GetPackageVersionReadmeResponse
Int -> ReadS GetPackageVersionReadmeResponse
ReadS [GetPackageVersionReadmeResponse]
(Int -> ReadS GetPackageVersionReadmeResponse)
-> ReadS [GetPackageVersionReadmeResponse]
-> ReadPrec GetPackageVersionReadmeResponse
-> ReadPrec [GetPackageVersionReadmeResponse]
-> Read GetPackageVersionReadmeResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetPackageVersionReadmeResponse]
$creadListPrec :: ReadPrec [GetPackageVersionReadmeResponse]
readPrec :: ReadPrec GetPackageVersionReadmeResponse
$creadPrec :: ReadPrec GetPackageVersionReadmeResponse
readList :: ReadS [GetPackageVersionReadmeResponse]
$creadList :: ReadS [GetPackageVersionReadmeResponse]
readsPrec :: Int -> ReadS GetPackageVersionReadmeResponse
$creadsPrec :: Int -> ReadS GetPackageVersionReadmeResponse
Prelude.Read, Int -> GetPackageVersionReadmeResponse -> ShowS
[GetPackageVersionReadmeResponse] -> ShowS
GetPackageVersionReadmeResponse -> String
(Int -> GetPackageVersionReadmeResponse -> ShowS)
-> (GetPackageVersionReadmeResponse -> String)
-> ([GetPackageVersionReadmeResponse] -> ShowS)
-> Show GetPackageVersionReadmeResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetPackageVersionReadmeResponse] -> ShowS
$cshowList :: [GetPackageVersionReadmeResponse] -> ShowS
show :: GetPackageVersionReadmeResponse -> String
$cshow :: GetPackageVersionReadmeResponse -> String
showsPrec :: Int -> GetPackageVersionReadmeResponse -> ShowS
$cshowsPrec :: Int -> GetPackageVersionReadmeResponse -> ShowS
Prelude.Show, (forall x.
 GetPackageVersionReadmeResponse
 -> Rep GetPackageVersionReadmeResponse x)
-> (forall x.
    Rep GetPackageVersionReadmeResponse x
    -> GetPackageVersionReadmeResponse)
-> Generic GetPackageVersionReadmeResponse
forall x.
Rep GetPackageVersionReadmeResponse x
-> GetPackageVersionReadmeResponse
forall x.
GetPackageVersionReadmeResponse
-> Rep GetPackageVersionReadmeResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetPackageVersionReadmeResponse x
-> GetPackageVersionReadmeResponse
$cfrom :: forall x.
GetPackageVersionReadmeResponse
-> Rep GetPackageVersionReadmeResponse x
Prelude.Generic)

-- |
-- Create a value of 'GetPackageVersionReadmeResponse' 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:
--
-- 'readme', 'getPackageVersionReadmeResponse_readme' - The text of the returned readme file.
--
-- 'format', 'getPackageVersionReadmeResponse_format' - The format of the package with the requested readme file. Valid format
-- types are:
--
-- -   @npm@
--
-- -   @pypi@
--
-- -   @maven@
--
-- 'namespace', 'getPackageVersionReadmeResponse_namespace' - The namespace of the package. The package component that specifies its
-- namespace depends on its type. For example:
--
-- -   The namespace of a Maven package is its @groupId@.
--
-- -   The namespace of an npm package is its @scope@.
--
-- -   A Python package does not contain a corresponding component, so
--     Python packages do not have a namespace.
--
-- 'versionRevision', 'getPackageVersionReadmeResponse_versionRevision' - The current revision associated with the package version.
--
-- 'version', 'getPackageVersionReadmeResponse_version' - The version of the package with the requested readme file.
--
-- 'package', 'getPackageVersionReadmeResponse_package' - The name of the package that contains the returned readme file.
--
-- 'httpStatus', 'getPackageVersionReadmeResponse_httpStatus' - The response's http status code.
newGetPackageVersionReadmeResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  GetPackageVersionReadmeResponse
newGetPackageVersionReadmeResponse :: Int -> GetPackageVersionReadmeResponse
newGetPackageVersionReadmeResponse Int
pHttpStatus_ =
  GetPackageVersionReadmeResponse' :: Maybe Text
-> Maybe PackageFormat
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Int
-> GetPackageVersionReadmeResponse
GetPackageVersionReadmeResponse'
    { $sel:readme:GetPackageVersionReadmeResponse' :: Maybe Text
readme =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:format:GetPackageVersionReadmeResponse' :: Maybe PackageFormat
format = Maybe PackageFormat
forall a. Maybe a
Prelude.Nothing,
      $sel:namespace:GetPackageVersionReadmeResponse' :: Maybe Text
namespace = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:versionRevision:GetPackageVersionReadmeResponse' :: Maybe Text
versionRevision = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:version:GetPackageVersionReadmeResponse' :: Maybe Text
version = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:package:GetPackageVersionReadmeResponse' :: Maybe Text
package = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:GetPackageVersionReadmeResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The text of the returned readme file.
getPackageVersionReadmeResponse_readme :: Lens.Lens' GetPackageVersionReadmeResponse (Prelude.Maybe Prelude.Text)
getPackageVersionReadmeResponse_readme :: (Maybe Text -> f (Maybe Text))
-> GetPackageVersionReadmeResponse
-> f GetPackageVersionReadmeResponse
getPackageVersionReadmeResponse_readme = (GetPackageVersionReadmeResponse -> Maybe Text)
-> (GetPackageVersionReadmeResponse
    -> Maybe Text -> GetPackageVersionReadmeResponse)
-> Lens
     GetPackageVersionReadmeResponse
     GetPackageVersionReadmeResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetPackageVersionReadmeResponse' {Maybe Text
readme :: Maybe Text
$sel:readme:GetPackageVersionReadmeResponse' :: GetPackageVersionReadmeResponse -> Maybe Text
readme} -> Maybe Text
readme) (\s :: GetPackageVersionReadmeResponse
s@GetPackageVersionReadmeResponse' {} Maybe Text
a -> GetPackageVersionReadmeResponse
s {$sel:readme:GetPackageVersionReadmeResponse' :: Maybe Text
readme = Maybe Text
a} :: GetPackageVersionReadmeResponse)

-- | The format of the package with the requested readme file. Valid format
-- types are:
--
-- -   @npm@
--
-- -   @pypi@
--
-- -   @maven@
getPackageVersionReadmeResponse_format :: Lens.Lens' GetPackageVersionReadmeResponse (Prelude.Maybe PackageFormat)
getPackageVersionReadmeResponse_format :: (Maybe PackageFormat -> f (Maybe PackageFormat))
-> GetPackageVersionReadmeResponse
-> f GetPackageVersionReadmeResponse
getPackageVersionReadmeResponse_format = (GetPackageVersionReadmeResponse -> Maybe PackageFormat)
-> (GetPackageVersionReadmeResponse
    -> Maybe PackageFormat -> GetPackageVersionReadmeResponse)
-> Lens
     GetPackageVersionReadmeResponse
     GetPackageVersionReadmeResponse
     (Maybe PackageFormat)
     (Maybe PackageFormat)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetPackageVersionReadmeResponse' {Maybe PackageFormat
format :: Maybe PackageFormat
$sel:format:GetPackageVersionReadmeResponse' :: GetPackageVersionReadmeResponse -> Maybe PackageFormat
format} -> Maybe PackageFormat
format) (\s :: GetPackageVersionReadmeResponse
s@GetPackageVersionReadmeResponse' {} Maybe PackageFormat
a -> GetPackageVersionReadmeResponse
s {$sel:format:GetPackageVersionReadmeResponse' :: Maybe PackageFormat
format = Maybe PackageFormat
a} :: GetPackageVersionReadmeResponse)

-- | The namespace of the package. The package component that specifies its
-- namespace depends on its type. For example:
--
-- -   The namespace of a Maven package is its @groupId@.
--
-- -   The namespace of an npm package is its @scope@.
--
-- -   A Python package does not contain a corresponding component, so
--     Python packages do not have a namespace.
getPackageVersionReadmeResponse_namespace :: Lens.Lens' GetPackageVersionReadmeResponse (Prelude.Maybe Prelude.Text)
getPackageVersionReadmeResponse_namespace :: (Maybe Text -> f (Maybe Text))
-> GetPackageVersionReadmeResponse
-> f GetPackageVersionReadmeResponse
getPackageVersionReadmeResponse_namespace = (GetPackageVersionReadmeResponse -> Maybe Text)
-> (GetPackageVersionReadmeResponse
    -> Maybe Text -> GetPackageVersionReadmeResponse)
-> Lens
     GetPackageVersionReadmeResponse
     GetPackageVersionReadmeResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetPackageVersionReadmeResponse' {Maybe Text
namespace :: Maybe Text
$sel:namespace:GetPackageVersionReadmeResponse' :: GetPackageVersionReadmeResponse -> Maybe Text
namespace} -> Maybe Text
namespace) (\s :: GetPackageVersionReadmeResponse
s@GetPackageVersionReadmeResponse' {} Maybe Text
a -> GetPackageVersionReadmeResponse
s {$sel:namespace:GetPackageVersionReadmeResponse' :: Maybe Text
namespace = Maybe Text
a} :: GetPackageVersionReadmeResponse)

-- | The current revision associated with the package version.
getPackageVersionReadmeResponse_versionRevision :: Lens.Lens' GetPackageVersionReadmeResponse (Prelude.Maybe Prelude.Text)
getPackageVersionReadmeResponse_versionRevision :: (Maybe Text -> f (Maybe Text))
-> GetPackageVersionReadmeResponse
-> f GetPackageVersionReadmeResponse
getPackageVersionReadmeResponse_versionRevision = (GetPackageVersionReadmeResponse -> Maybe Text)
-> (GetPackageVersionReadmeResponse
    -> Maybe Text -> GetPackageVersionReadmeResponse)
-> Lens
     GetPackageVersionReadmeResponse
     GetPackageVersionReadmeResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetPackageVersionReadmeResponse' {Maybe Text
versionRevision :: Maybe Text
$sel:versionRevision:GetPackageVersionReadmeResponse' :: GetPackageVersionReadmeResponse -> Maybe Text
versionRevision} -> Maybe Text
versionRevision) (\s :: GetPackageVersionReadmeResponse
s@GetPackageVersionReadmeResponse' {} Maybe Text
a -> GetPackageVersionReadmeResponse
s {$sel:versionRevision:GetPackageVersionReadmeResponse' :: Maybe Text
versionRevision = Maybe Text
a} :: GetPackageVersionReadmeResponse)

-- | The version of the package with the requested readme file.
getPackageVersionReadmeResponse_version :: Lens.Lens' GetPackageVersionReadmeResponse (Prelude.Maybe Prelude.Text)
getPackageVersionReadmeResponse_version :: (Maybe Text -> f (Maybe Text))
-> GetPackageVersionReadmeResponse
-> f GetPackageVersionReadmeResponse
getPackageVersionReadmeResponse_version = (GetPackageVersionReadmeResponse -> Maybe Text)
-> (GetPackageVersionReadmeResponse
    -> Maybe Text -> GetPackageVersionReadmeResponse)
-> Lens
     GetPackageVersionReadmeResponse
     GetPackageVersionReadmeResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetPackageVersionReadmeResponse' {Maybe Text
version :: Maybe Text
$sel:version:GetPackageVersionReadmeResponse' :: GetPackageVersionReadmeResponse -> Maybe Text
version} -> Maybe Text
version) (\s :: GetPackageVersionReadmeResponse
s@GetPackageVersionReadmeResponse' {} Maybe Text
a -> GetPackageVersionReadmeResponse
s {$sel:version:GetPackageVersionReadmeResponse' :: Maybe Text
version = Maybe Text
a} :: GetPackageVersionReadmeResponse)

-- | The name of the package that contains the returned readme file.
getPackageVersionReadmeResponse_package :: Lens.Lens' GetPackageVersionReadmeResponse (Prelude.Maybe Prelude.Text)
getPackageVersionReadmeResponse_package :: (Maybe Text -> f (Maybe Text))
-> GetPackageVersionReadmeResponse
-> f GetPackageVersionReadmeResponse
getPackageVersionReadmeResponse_package = (GetPackageVersionReadmeResponse -> Maybe Text)
-> (GetPackageVersionReadmeResponse
    -> Maybe Text -> GetPackageVersionReadmeResponse)
-> Lens
     GetPackageVersionReadmeResponse
     GetPackageVersionReadmeResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetPackageVersionReadmeResponse' {Maybe Text
package :: Maybe Text
$sel:package:GetPackageVersionReadmeResponse' :: GetPackageVersionReadmeResponse -> Maybe Text
package} -> Maybe Text
package) (\s :: GetPackageVersionReadmeResponse
s@GetPackageVersionReadmeResponse' {} Maybe Text
a -> GetPackageVersionReadmeResponse
s {$sel:package:GetPackageVersionReadmeResponse' :: Maybe Text
package = Maybe Text
a} :: GetPackageVersionReadmeResponse)

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

instance
  Prelude.NFData
    GetPackageVersionReadmeResponse