{-# 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.Support.DescribeCommunications
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Returns communications and attachments for one or more support cases.
-- Use the @afterTime@ and @beforeTime@ parameters to filter by date. You
-- can use the @caseId@ parameter to restrict the results to a specific
-- case.
--
-- Case data is available for 12 months after creation. If a case was
-- created more than 12 months ago, a request for data might cause an
-- error.
--
-- You can use the @maxResults@ and @nextToken@ parameters to control the
-- pagination of the results. Set @maxResults@ to the number of cases that
-- you want to display on each page, and use @nextToken@ to specify the
-- resumption of pagination.
--
-- -   You must have a Business, Enterprise On-Ramp, or Enterprise Support
--     plan to use the Amazon Web Services Support API.
--
-- -   If you call the Amazon Web Services Support API from an account that
--     doesn\'t have a Business, Enterprise On-Ramp, or Enterprise Support
--     plan, the @SubscriptionRequiredException@ error message appears. For
--     information about changing your support plan, see
--     <http://aws.amazon.com/premiumsupport/ Amazon Web Services Support>.
--
-- This operation returns paginated results.
module Amazonka.Support.DescribeCommunications
  ( -- * Creating a Request
    DescribeCommunications (..),
    newDescribeCommunications,

    -- * Request Lenses
    describeCommunications_afterTime,
    describeCommunications_beforeTime,
    describeCommunications_maxResults,
    describeCommunications_nextToken,
    describeCommunications_caseId,

    -- * Destructuring the Response
    DescribeCommunicationsResponse (..),
    newDescribeCommunicationsResponse,

    -- * Response Lenses
    describeCommunicationsResponse_communications,
    describeCommunicationsResponse_nextToken,
    describeCommunicationsResponse_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.Support.Types

-- | /See:/ 'newDescribeCommunications' smart constructor.
data DescribeCommunications = DescribeCommunications'
  { -- | The start date for a filtered date search on support case
    -- communications. Case communications are available for 12 months after
    -- creation.
    DescribeCommunications -> Maybe Text
afterTime :: Prelude.Maybe Prelude.Text,
    -- | The end date for a filtered date search on support case communications.
    -- Case communications are available for 12 months after creation.
    DescribeCommunications -> Maybe Text
beforeTime :: Prelude.Maybe Prelude.Text,
    -- | The maximum number of results to return before paginating.
    DescribeCommunications -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
    -- | A resumption point for pagination.
    DescribeCommunications -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The support case ID requested or returned in the call. The case ID is an
    -- alphanumeric string formatted as shown in this example:
    -- case-/12345678910-2013-c4c1d2bf33c5cf47/
    DescribeCommunications -> Text
caseId :: Prelude.Text
  }
  deriving (DescribeCommunications -> DescribeCommunications -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeCommunications -> DescribeCommunications -> Bool
$c/= :: DescribeCommunications -> DescribeCommunications -> Bool
== :: DescribeCommunications -> DescribeCommunications -> Bool
$c== :: DescribeCommunications -> DescribeCommunications -> Bool
Prelude.Eq, ReadPrec [DescribeCommunications]
ReadPrec DescribeCommunications
Int -> ReadS DescribeCommunications
ReadS [DescribeCommunications]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeCommunications]
$creadListPrec :: ReadPrec [DescribeCommunications]
readPrec :: ReadPrec DescribeCommunications
$creadPrec :: ReadPrec DescribeCommunications
readList :: ReadS [DescribeCommunications]
$creadList :: ReadS [DescribeCommunications]
readsPrec :: Int -> ReadS DescribeCommunications
$creadsPrec :: Int -> ReadS DescribeCommunications
Prelude.Read, Int -> DescribeCommunications -> ShowS
[DescribeCommunications] -> ShowS
DescribeCommunications -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeCommunications] -> ShowS
$cshowList :: [DescribeCommunications] -> ShowS
show :: DescribeCommunications -> String
$cshow :: DescribeCommunications -> String
showsPrec :: Int -> DescribeCommunications -> ShowS
$cshowsPrec :: Int -> DescribeCommunications -> ShowS
Prelude.Show, forall x. Rep DescribeCommunications x -> DescribeCommunications
forall x. DescribeCommunications -> Rep DescribeCommunications x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribeCommunications x -> DescribeCommunications
$cfrom :: forall x. DescribeCommunications -> Rep DescribeCommunications x
Prelude.Generic)

-- |
-- Create a value of 'DescribeCommunications' 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:
--
-- 'afterTime', 'describeCommunications_afterTime' - The start date for a filtered date search on support case
-- communications. Case communications are available for 12 months after
-- creation.
--
-- 'beforeTime', 'describeCommunications_beforeTime' - The end date for a filtered date search on support case communications.
-- Case communications are available for 12 months after creation.
--
-- 'maxResults', 'describeCommunications_maxResults' - The maximum number of results to return before paginating.
--
-- 'nextToken', 'describeCommunications_nextToken' - A resumption point for pagination.
--
-- 'caseId', 'describeCommunications_caseId' - The support case ID requested or returned in the call. The case ID is an
-- alphanumeric string formatted as shown in this example:
-- case-/12345678910-2013-c4c1d2bf33c5cf47/
newDescribeCommunications ::
  -- | 'caseId'
  Prelude.Text ->
  DescribeCommunications
newDescribeCommunications :: Text -> DescribeCommunications
newDescribeCommunications Text
pCaseId_ =
  DescribeCommunications'
    { $sel:afterTime:DescribeCommunications' :: Maybe Text
afterTime =
        forall a. Maybe a
Prelude.Nothing,
      $sel:beforeTime:DescribeCommunications' :: Maybe Text
beforeTime = forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:DescribeCommunications' :: Maybe Natural
maxResults = forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:DescribeCommunications' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
      $sel:caseId:DescribeCommunications' :: Text
caseId = Text
pCaseId_
    }

-- | The start date for a filtered date search on support case
-- communications. Case communications are available for 12 months after
-- creation.
describeCommunications_afterTime :: Lens.Lens' DescribeCommunications (Prelude.Maybe Prelude.Text)
describeCommunications_afterTime :: Lens' DescribeCommunications (Maybe Text)
describeCommunications_afterTime = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeCommunications' {Maybe Text
afterTime :: Maybe Text
$sel:afterTime:DescribeCommunications' :: DescribeCommunications -> Maybe Text
afterTime} -> Maybe Text
afterTime) (\s :: DescribeCommunications
s@DescribeCommunications' {} Maybe Text
a -> DescribeCommunications
s {$sel:afterTime:DescribeCommunications' :: Maybe Text
afterTime = Maybe Text
a} :: DescribeCommunications)

-- | The end date for a filtered date search on support case communications.
-- Case communications are available for 12 months after creation.
describeCommunications_beforeTime :: Lens.Lens' DescribeCommunications (Prelude.Maybe Prelude.Text)
describeCommunications_beforeTime :: Lens' DescribeCommunications (Maybe Text)
describeCommunications_beforeTime = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeCommunications' {Maybe Text
beforeTime :: Maybe Text
$sel:beforeTime:DescribeCommunications' :: DescribeCommunications -> Maybe Text
beforeTime} -> Maybe Text
beforeTime) (\s :: DescribeCommunications
s@DescribeCommunications' {} Maybe Text
a -> DescribeCommunications
s {$sel:beforeTime:DescribeCommunications' :: Maybe Text
beforeTime = Maybe Text
a} :: DescribeCommunications)

-- | The maximum number of results to return before paginating.
describeCommunications_maxResults :: Lens.Lens' DescribeCommunications (Prelude.Maybe Prelude.Natural)
describeCommunications_maxResults :: Lens' DescribeCommunications (Maybe Natural)
describeCommunications_maxResults = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeCommunications' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:DescribeCommunications' :: DescribeCommunications -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: DescribeCommunications
s@DescribeCommunications' {} Maybe Natural
a -> DescribeCommunications
s {$sel:maxResults:DescribeCommunications' :: Maybe Natural
maxResults = Maybe Natural
a} :: DescribeCommunications)

-- | A resumption point for pagination.
describeCommunications_nextToken :: Lens.Lens' DescribeCommunications (Prelude.Maybe Prelude.Text)
describeCommunications_nextToken :: Lens' DescribeCommunications (Maybe Text)
describeCommunications_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeCommunications' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:DescribeCommunications' :: DescribeCommunications -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: DescribeCommunications
s@DescribeCommunications' {} Maybe Text
a -> DescribeCommunications
s {$sel:nextToken:DescribeCommunications' :: Maybe Text
nextToken = Maybe Text
a} :: DescribeCommunications)

-- | The support case ID requested or returned in the call. The case ID is an
-- alphanumeric string formatted as shown in this example:
-- case-/12345678910-2013-c4c1d2bf33c5cf47/
describeCommunications_caseId :: Lens.Lens' DescribeCommunications Prelude.Text
describeCommunications_caseId :: Lens' DescribeCommunications Text
describeCommunications_caseId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeCommunications' {Text
caseId :: Text
$sel:caseId:DescribeCommunications' :: DescribeCommunications -> Text
caseId} -> Text
caseId) (\s :: DescribeCommunications
s@DescribeCommunications' {} Text
a -> DescribeCommunications
s {$sel:caseId:DescribeCommunications' :: Text
caseId = Text
a} :: DescribeCommunications)

instance Core.AWSPager DescribeCommunications where
  page :: DescribeCommunications
-> AWSResponse DescribeCommunications
-> Maybe DescribeCommunications
page DescribeCommunications
rq AWSResponse DescribeCommunications
rs
    | forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse DescribeCommunications
rs
            forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' DescribeCommunicationsResponse (Maybe Text)
describeCommunicationsResponse_nextToken
            forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
        forall a. Maybe a
Prelude.Nothing
    | forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse DescribeCommunications
rs
            forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' DescribeCommunicationsResponse (Maybe [Communication])
describeCommunicationsResponse_communications
            forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
        forall a. Maybe a
Prelude.Nothing
    | Bool
Prelude.otherwise =
        forall a. a -> Maybe a
Prelude.Just
          forall a b. (a -> b) -> a -> b
Prelude.$ DescribeCommunications
rq
          forall a b. a -> (a -> b) -> b
Prelude.& Lens' DescribeCommunications (Maybe Text)
describeCommunications_nextToken
          forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse DescribeCommunications
rs
          forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' DescribeCommunicationsResponse (Maybe Text)
describeCommunicationsResponse_nextToken
          forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just

instance Core.AWSRequest DescribeCommunications where
  type
    AWSResponse DescribeCommunications =
      DescribeCommunicationsResponse
  request :: (Service -> Service)
-> DescribeCommunications -> Request DescribeCommunications
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 DescribeCommunications
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DescribeCommunications)))
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 [Communication]
-> Maybe Text -> Int -> DescribeCommunicationsResponse
DescribeCommunicationsResponse'
            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
"communications" forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty)
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"nextToken")
            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 DescribeCommunications where
  hashWithSalt :: Int -> DescribeCommunications -> Int
hashWithSalt Int
_salt DescribeCommunications' {Maybe Natural
Maybe Text
Text
caseId :: Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
beforeTime :: Maybe Text
afterTime :: Maybe Text
$sel:caseId:DescribeCommunications' :: DescribeCommunications -> Text
$sel:nextToken:DescribeCommunications' :: DescribeCommunications -> Maybe Text
$sel:maxResults:DescribeCommunications' :: DescribeCommunications -> Maybe Natural
$sel:beforeTime:DescribeCommunications' :: DescribeCommunications -> Maybe Text
$sel:afterTime:DescribeCommunications' :: DescribeCommunications -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
afterTime
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
beforeTime
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
maxResults
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
nextToken
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
caseId

instance Prelude.NFData DescribeCommunications where
  rnf :: DescribeCommunications -> ()
rnf DescribeCommunications' {Maybe Natural
Maybe Text
Text
caseId :: Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
beforeTime :: Maybe Text
afterTime :: Maybe Text
$sel:caseId:DescribeCommunications' :: DescribeCommunications -> Text
$sel:nextToken:DescribeCommunications' :: DescribeCommunications -> Maybe Text
$sel:maxResults:DescribeCommunications' :: DescribeCommunications -> Maybe Natural
$sel:beforeTime:DescribeCommunications' :: DescribeCommunications -> Maybe Text
$sel:afterTime:DescribeCommunications' :: DescribeCommunications -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
afterTime
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
beforeTime
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
maxResults
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
nextToken
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
caseId

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

instance Data.ToJSON DescribeCommunications where
  toJSON :: DescribeCommunications -> Value
toJSON DescribeCommunications' {Maybe Natural
Maybe Text
Text
caseId :: Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
beforeTime :: Maybe Text
afterTime :: Maybe Text
$sel:caseId:DescribeCommunications' :: DescribeCommunications -> Text
$sel:nextToken:DescribeCommunications' :: DescribeCommunications -> Maybe Text
$sel:maxResults:DescribeCommunications' :: DescribeCommunications -> Maybe Natural
$sel:beforeTime:DescribeCommunications' :: DescribeCommunications -> Maybe Text
$sel:afterTime:DescribeCommunications' :: DescribeCommunications -> Maybe Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"afterTime" 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
afterTime,
            (Key
"beforeTime" 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
beforeTime,
            (Key
"maxResults" 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 Natural
maxResults,
            (Key
"nextToken" 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
nextToken,
            forall a. a -> Maybe a
Prelude.Just (Key
"caseId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
caseId)
          ]
      )

instance Data.ToPath DescribeCommunications where
  toPath :: DescribeCommunications -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"

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

-- | The communications returned by the DescribeCommunications operation.
--
-- /See:/ 'newDescribeCommunicationsResponse' smart constructor.
data DescribeCommunicationsResponse = DescribeCommunicationsResponse'
  { -- | The communications for the case.
    DescribeCommunicationsResponse -> Maybe [Communication]
communications :: Prelude.Maybe [Communication],
    -- | A resumption point for pagination.
    DescribeCommunicationsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    DescribeCommunicationsResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (DescribeCommunicationsResponse
-> DescribeCommunicationsResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeCommunicationsResponse
-> DescribeCommunicationsResponse -> Bool
$c/= :: DescribeCommunicationsResponse
-> DescribeCommunicationsResponse -> Bool
== :: DescribeCommunicationsResponse
-> DescribeCommunicationsResponse -> Bool
$c== :: DescribeCommunicationsResponse
-> DescribeCommunicationsResponse -> Bool
Prelude.Eq, ReadPrec [DescribeCommunicationsResponse]
ReadPrec DescribeCommunicationsResponse
Int -> ReadS DescribeCommunicationsResponse
ReadS [DescribeCommunicationsResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeCommunicationsResponse]
$creadListPrec :: ReadPrec [DescribeCommunicationsResponse]
readPrec :: ReadPrec DescribeCommunicationsResponse
$creadPrec :: ReadPrec DescribeCommunicationsResponse
readList :: ReadS [DescribeCommunicationsResponse]
$creadList :: ReadS [DescribeCommunicationsResponse]
readsPrec :: Int -> ReadS DescribeCommunicationsResponse
$creadsPrec :: Int -> ReadS DescribeCommunicationsResponse
Prelude.Read, Int -> DescribeCommunicationsResponse -> ShowS
[DescribeCommunicationsResponse] -> ShowS
DescribeCommunicationsResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeCommunicationsResponse] -> ShowS
$cshowList :: [DescribeCommunicationsResponse] -> ShowS
show :: DescribeCommunicationsResponse -> String
$cshow :: DescribeCommunicationsResponse -> String
showsPrec :: Int -> DescribeCommunicationsResponse -> ShowS
$cshowsPrec :: Int -> DescribeCommunicationsResponse -> ShowS
Prelude.Show, forall x.
Rep DescribeCommunicationsResponse x
-> DescribeCommunicationsResponse
forall x.
DescribeCommunicationsResponse
-> Rep DescribeCommunicationsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeCommunicationsResponse x
-> DescribeCommunicationsResponse
$cfrom :: forall x.
DescribeCommunicationsResponse
-> Rep DescribeCommunicationsResponse x
Prelude.Generic)

-- |
-- Create a value of 'DescribeCommunicationsResponse' 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:
--
-- 'communications', 'describeCommunicationsResponse_communications' - The communications for the case.
--
-- 'nextToken', 'describeCommunicationsResponse_nextToken' - A resumption point for pagination.
--
-- 'httpStatus', 'describeCommunicationsResponse_httpStatus' - The response's http status code.
newDescribeCommunicationsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DescribeCommunicationsResponse
newDescribeCommunicationsResponse :: Int -> DescribeCommunicationsResponse
newDescribeCommunicationsResponse Int
pHttpStatus_ =
  DescribeCommunicationsResponse'
    { $sel:communications:DescribeCommunicationsResponse' :: Maybe [Communication]
communications =
        forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:DescribeCommunicationsResponse' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DescribeCommunicationsResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The communications for the case.
describeCommunicationsResponse_communications :: Lens.Lens' DescribeCommunicationsResponse (Prelude.Maybe [Communication])
describeCommunicationsResponse_communications :: Lens' DescribeCommunicationsResponse (Maybe [Communication])
describeCommunicationsResponse_communications = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeCommunicationsResponse' {Maybe [Communication]
communications :: Maybe [Communication]
$sel:communications:DescribeCommunicationsResponse' :: DescribeCommunicationsResponse -> Maybe [Communication]
communications} -> Maybe [Communication]
communications) (\s :: DescribeCommunicationsResponse
s@DescribeCommunicationsResponse' {} Maybe [Communication]
a -> DescribeCommunicationsResponse
s {$sel:communications:DescribeCommunicationsResponse' :: Maybe [Communication]
communications = Maybe [Communication]
a} :: DescribeCommunicationsResponse) 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

-- | A resumption point for pagination.
describeCommunicationsResponse_nextToken :: Lens.Lens' DescribeCommunicationsResponse (Prelude.Maybe Prelude.Text)
describeCommunicationsResponse_nextToken :: Lens' DescribeCommunicationsResponse (Maybe Text)
describeCommunicationsResponse_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeCommunicationsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:DescribeCommunicationsResponse' :: DescribeCommunicationsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: DescribeCommunicationsResponse
s@DescribeCommunicationsResponse' {} Maybe Text
a -> DescribeCommunicationsResponse
s {$sel:nextToken:DescribeCommunicationsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: DescribeCommunicationsResponse)

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

instance
  Prelude.NFData
    DescribeCommunicationsResponse
  where
  rnf :: DescribeCommunicationsResponse -> ()
rnf DescribeCommunicationsResponse' {Int
Maybe [Communication]
Maybe Text
httpStatus :: Int
nextToken :: Maybe Text
communications :: Maybe [Communication]
$sel:httpStatus:DescribeCommunicationsResponse' :: DescribeCommunicationsResponse -> Int
$sel:nextToken:DescribeCommunicationsResponse' :: DescribeCommunicationsResponse -> Maybe Text
$sel:communications:DescribeCommunicationsResponse' :: DescribeCommunicationsResponse -> Maybe [Communication]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe [Communication]
communications
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
nextToken
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus