{-# 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.Chime.ListChannelMessages
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- List all the messages in a channel. Returns a paginated list of
-- @ChannelMessages@. By default, sorted by creation timestamp in
-- descending order.
--
-- Redacted messages appear in the results as empty, since they are only
-- redacted, not deleted. Deleted messages do not appear in the results.
-- This action always returns the latest version of an edited message.
--
-- Also, the x-amz-chime-bearer request header is mandatory. Use the
-- @AppInstanceUserArn@ of the user that makes the API call as the value in
-- the header.
module Amazonka.Chime.ListChannelMessages
  ( -- * Creating a Request
    ListChannelMessages (..),
    newListChannelMessages,

    -- * Request Lenses
    listChannelMessages_chimeBearer,
    listChannelMessages_maxResults,
    listChannelMessages_nextToken,
    listChannelMessages_notAfter,
    listChannelMessages_notBefore,
    listChannelMessages_sortOrder,
    listChannelMessages_channelArn,

    -- * Destructuring the Response
    ListChannelMessagesResponse (..),
    newListChannelMessagesResponse,

    -- * Response Lenses
    listChannelMessagesResponse_channelArn,
    listChannelMessagesResponse_channelMessages,
    listChannelMessagesResponse_nextToken,
    listChannelMessagesResponse_httpStatus,
  )
where

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

-- | /See:/ 'newListChannelMessages' smart constructor.
data ListChannelMessages = ListChannelMessages'
  { -- | The @AppInstanceUserArn@ of the user that makes the API call.
    ListChannelMessages -> Maybe Text
chimeBearer :: Prelude.Maybe Prelude.Text,
    -- | The maximum number of messages that you want returned.
    ListChannelMessages -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
    -- | The token passed by previous API calls until all requested messages are
    -- returned.
    ListChannelMessages -> Maybe (Sensitive Text)
nextToken :: Prelude.Maybe (Data.Sensitive Prelude.Text),
    -- | The final or ending time stamp for your requested messages.
    ListChannelMessages -> Maybe POSIX
notAfter :: Prelude.Maybe Data.POSIX,
    -- | The initial or starting time stamp for your requested messages.
    ListChannelMessages -> Maybe POSIX
notBefore :: Prelude.Maybe Data.POSIX,
    -- | The order in which you want messages sorted. Default is Descending,
    -- based on time created.
    ListChannelMessages -> Maybe SortOrder
sortOrder :: Prelude.Maybe SortOrder,
    -- | The ARN of the channel.
    ListChannelMessages -> Text
channelArn :: Prelude.Text
  }
  deriving (ListChannelMessages -> ListChannelMessages -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListChannelMessages -> ListChannelMessages -> Bool
$c/= :: ListChannelMessages -> ListChannelMessages -> Bool
== :: ListChannelMessages -> ListChannelMessages -> Bool
$c== :: ListChannelMessages -> ListChannelMessages -> Bool
Prelude.Eq, Int -> ListChannelMessages -> ShowS
[ListChannelMessages] -> ShowS
ListChannelMessages -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListChannelMessages] -> ShowS
$cshowList :: [ListChannelMessages] -> ShowS
show :: ListChannelMessages -> String
$cshow :: ListChannelMessages -> String
showsPrec :: Int -> ListChannelMessages -> ShowS
$cshowsPrec :: Int -> ListChannelMessages -> ShowS
Prelude.Show, forall x. Rep ListChannelMessages x -> ListChannelMessages
forall x. ListChannelMessages -> Rep ListChannelMessages x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListChannelMessages x -> ListChannelMessages
$cfrom :: forall x. ListChannelMessages -> Rep ListChannelMessages x
Prelude.Generic)

-- |
-- Create a value of 'ListChannelMessages' 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:
--
-- 'chimeBearer', 'listChannelMessages_chimeBearer' - The @AppInstanceUserArn@ of the user that makes the API call.
--
-- 'maxResults', 'listChannelMessages_maxResults' - The maximum number of messages that you want returned.
--
-- 'nextToken', 'listChannelMessages_nextToken' - The token passed by previous API calls until all requested messages are
-- returned.
--
-- 'notAfter', 'listChannelMessages_notAfter' - The final or ending time stamp for your requested messages.
--
-- 'notBefore', 'listChannelMessages_notBefore' - The initial or starting time stamp for your requested messages.
--
-- 'sortOrder', 'listChannelMessages_sortOrder' - The order in which you want messages sorted. Default is Descending,
-- based on time created.
--
-- 'channelArn', 'listChannelMessages_channelArn' - The ARN of the channel.
newListChannelMessages ::
  -- | 'channelArn'
  Prelude.Text ->
  ListChannelMessages
newListChannelMessages :: Text -> ListChannelMessages
newListChannelMessages Text
pChannelArn_ =
  ListChannelMessages'
    { $sel:chimeBearer:ListChannelMessages' :: Maybe Text
chimeBearer = forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:ListChannelMessages' :: Maybe Natural
maxResults = forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListChannelMessages' :: Maybe (Sensitive Text)
nextToken = forall a. Maybe a
Prelude.Nothing,
      $sel:notAfter:ListChannelMessages' :: Maybe POSIX
notAfter = forall a. Maybe a
Prelude.Nothing,
      $sel:notBefore:ListChannelMessages' :: Maybe POSIX
notBefore = forall a. Maybe a
Prelude.Nothing,
      $sel:sortOrder:ListChannelMessages' :: Maybe SortOrder
sortOrder = forall a. Maybe a
Prelude.Nothing,
      $sel:channelArn:ListChannelMessages' :: Text
channelArn = Text
pChannelArn_
    }

-- | The @AppInstanceUserArn@ of the user that makes the API call.
listChannelMessages_chimeBearer :: Lens.Lens' ListChannelMessages (Prelude.Maybe Prelude.Text)
listChannelMessages_chimeBearer :: Lens' ListChannelMessages (Maybe Text)
listChannelMessages_chimeBearer = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListChannelMessages' {Maybe Text
chimeBearer :: Maybe Text
$sel:chimeBearer:ListChannelMessages' :: ListChannelMessages -> Maybe Text
chimeBearer} -> Maybe Text
chimeBearer) (\s :: ListChannelMessages
s@ListChannelMessages' {} Maybe Text
a -> ListChannelMessages
s {$sel:chimeBearer:ListChannelMessages' :: Maybe Text
chimeBearer = Maybe Text
a} :: ListChannelMessages)

-- | The maximum number of messages that you want returned.
listChannelMessages_maxResults :: Lens.Lens' ListChannelMessages (Prelude.Maybe Prelude.Natural)
listChannelMessages_maxResults :: Lens' ListChannelMessages (Maybe Natural)
listChannelMessages_maxResults = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListChannelMessages' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListChannelMessages' :: ListChannelMessages -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListChannelMessages
s@ListChannelMessages' {} Maybe Natural
a -> ListChannelMessages
s {$sel:maxResults:ListChannelMessages' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListChannelMessages)

-- | The token passed by previous API calls until all requested messages are
-- returned.
listChannelMessages_nextToken :: Lens.Lens' ListChannelMessages (Prelude.Maybe Prelude.Text)
listChannelMessages_nextToken :: Lens' ListChannelMessages (Maybe Text)
listChannelMessages_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListChannelMessages' {Maybe (Sensitive Text)
nextToken :: Maybe (Sensitive Text)
$sel:nextToken:ListChannelMessages' :: ListChannelMessages -> Maybe (Sensitive Text)
nextToken} -> Maybe (Sensitive Text)
nextToken) (\s :: ListChannelMessages
s@ListChannelMessages' {} Maybe (Sensitive Text)
a -> ListChannelMessages
s {$sel:nextToken:ListChannelMessages' :: Maybe (Sensitive Text)
nextToken = Maybe (Sensitive Text)
a} :: ListChannelMessages) 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 a. Iso' (Sensitive a) a
Data._Sensitive

-- | The final or ending time stamp for your requested messages.
listChannelMessages_notAfter :: Lens.Lens' ListChannelMessages (Prelude.Maybe Prelude.UTCTime)
listChannelMessages_notAfter :: Lens' ListChannelMessages (Maybe UTCTime)
listChannelMessages_notAfter = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListChannelMessages' {Maybe POSIX
notAfter :: Maybe POSIX
$sel:notAfter:ListChannelMessages' :: ListChannelMessages -> Maybe POSIX
notAfter} -> Maybe POSIX
notAfter) (\s :: ListChannelMessages
s@ListChannelMessages' {} Maybe POSIX
a -> ListChannelMessages
s {$sel:notAfter:ListChannelMessages' :: Maybe POSIX
notAfter = Maybe POSIX
a} :: ListChannelMessages) 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 (a :: Format). Iso' (Time a) UTCTime
Data._Time

-- | The initial or starting time stamp for your requested messages.
listChannelMessages_notBefore :: Lens.Lens' ListChannelMessages (Prelude.Maybe Prelude.UTCTime)
listChannelMessages_notBefore :: Lens' ListChannelMessages (Maybe UTCTime)
listChannelMessages_notBefore = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListChannelMessages' {Maybe POSIX
notBefore :: Maybe POSIX
$sel:notBefore:ListChannelMessages' :: ListChannelMessages -> Maybe POSIX
notBefore} -> Maybe POSIX
notBefore) (\s :: ListChannelMessages
s@ListChannelMessages' {} Maybe POSIX
a -> ListChannelMessages
s {$sel:notBefore:ListChannelMessages' :: Maybe POSIX
notBefore = Maybe POSIX
a} :: ListChannelMessages) 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 (a :: Format). Iso' (Time a) UTCTime
Data._Time

-- | The order in which you want messages sorted. Default is Descending,
-- based on time created.
listChannelMessages_sortOrder :: Lens.Lens' ListChannelMessages (Prelude.Maybe SortOrder)
listChannelMessages_sortOrder :: Lens' ListChannelMessages (Maybe SortOrder)
listChannelMessages_sortOrder = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListChannelMessages' {Maybe SortOrder
sortOrder :: Maybe SortOrder
$sel:sortOrder:ListChannelMessages' :: ListChannelMessages -> Maybe SortOrder
sortOrder} -> Maybe SortOrder
sortOrder) (\s :: ListChannelMessages
s@ListChannelMessages' {} Maybe SortOrder
a -> ListChannelMessages
s {$sel:sortOrder:ListChannelMessages' :: Maybe SortOrder
sortOrder = Maybe SortOrder
a} :: ListChannelMessages)

-- | The ARN of the channel.
listChannelMessages_channelArn :: Lens.Lens' ListChannelMessages Prelude.Text
listChannelMessages_channelArn :: Lens' ListChannelMessages Text
listChannelMessages_channelArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListChannelMessages' {Text
channelArn :: Text
$sel:channelArn:ListChannelMessages' :: ListChannelMessages -> Text
channelArn} -> Text
channelArn) (\s :: ListChannelMessages
s@ListChannelMessages' {} Text
a -> ListChannelMessages
s {$sel:channelArn:ListChannelMessages' :: Text
channelArn = Text
a} :: ListChannelMessages)

instance Core.AWSRequest ListChannelMessages where
  type
    AWSResponse ListChannelMessages =
      ListChannelMessagesResponse
  request :: (Service -> Service)
-> ListChannelMessages -> Request ListChannelMessages
request Service -> Service
overrides =
    forall a. ToRequest a => Service -> a -> Request a
Request.get (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy ListChannelMessages
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse ListChannelMessages)))
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 Text
-> Maybe [ChannelMessageSummary]
-> Maybe (Sensitive Text)
-> Int
-> ListChannelMessagesResponse
ListChannelMessagesResponse'
            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
"ChannelArn")
            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
"ChannelMessages"
                            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 ListChannelMessages where
  hashWithSalt :: Int -> ListChannelMessages -> Int
hashWithSalt Int
_salt ListChannelMessages' {Maybe Natural
Maybe Text
Maybe (Sensitive Text)
Maybe POSIX
Maybe SortOrder
Text
channelArn :: Text
sortOrder :: Maybe SortOrder
notBefore :: Maybe POSIX
notAfter :: Maybe POSIX
nextToken :: Maybe (Sensitive Text)
maxResults :: Maybe Natural
chimeBearer :: Maybe Text
$sel:channelArn:ListChannelMessages' :: ListChannelMessages -> Text
$sel:sortOrder:ListChannelMessages' :: ListChannelMessages -> Maybe SortOrder
$sel:notBefore:ListChannelMessages' :: ListChannelMessages -> Maybe POSIX
$sel:notAfter:ListChannelMessages' :: ListChannelMessages -> Maybe POSIX
$sel:nextToken:ListChannelMessages' :: ListChannelMessages -> Maybe (Sensitive Text)
$sel:maxResults:ListChannelMessages' :: ListChannelMessages -> Maybe Natural
$sel:chimeBearer:ListChannelMessages' :: ListChannelMessages -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
chimeBearer
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
maxResults
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (Sensitive Text)
nextToken
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
notAfter
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
notBefore
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe SortOrder
sortOrder
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
channelArn

instance Prelude.NFData ListChannelMessages where
  rnf :: ListChannelMessages -> ()
rnf ListChannelMessages' {Maybe Natural
Maybe Text
Maybe (Sensitive Text)
Maybe POSIX
Maybe SortOrder
Text
channelArn :: Text
sortOrder :: Maybe SortOrder
notBefore :: Maybe POSIX
notAfter :: Maybe POSIX
nextToken :: Maybe (Sensitive Text)
maxResults :: Maybe Natural
chimeBearer :: Maybe Text
$sel:channelArn:ListChannelMessages' :: ListChannelMessages -> Text
$sel:sortOrder:ListChannelMessages' :: ListChannelMessages -> Maybe SortOrder
$sel:notBefore:ListChannelMessages' :: ListChannelMessages -> Maybe POSIX
$sel:notAfter:ListChannelMessages' :: ListChannelMessages -> Maybe POSIX
$sel:nextToken:ListChannelMessages' :: ListChannelMessages -> Maybe (Sensitive Text)
$sel:maxResults:ListChannelMessages' :: ListChannelMessages -> Maybe Natural
$sel:chimeBearer:ListChannelMessages' :: ListChannelMessages -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
chimeBearer
      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 (Sensitive Text)
nextToken
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
notAfter
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
notBefore
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe SortOrder
sortOrder
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
channelArn

instance Data.ToHeaders ListChannelMessages where
  toHeaders :: ListChannelMessages -> ResponseHeaders
toHeaders ListChannelMessages' {Maybe Natural
Maybe Text
Maybe (Sensitive Text)
Maybe POSIX
Maybe SortOrder
Text
channelArn :: Text
sortOrder :: Maybe SortOrder
notBefore :: Maybe POSIX
notAfter :: Maybe POSIX
nextToken :: Maybe (Sensitive Text)
maxResults :: Maybe Natural
chimeBearer :: Maybe Text
$sel:channelArn:ListChannelMessages' :: ListChannelMessages -> Text
$sel:sortOrder:ListChannelMessages' :: ListChannelMessages -> Maybe SortOrder
$sel:notBefore:ListChannelMessages' :: ListChannelMessages -> Maybe POSIX
$sel:notAfter:ListChannelMessages' :: ListChannelMessages -> Maybe POSIX
$sel:nextToken:ListChannelMessages' :: ListChannelMessages -> Maybe (Sensitive Text)
$sel:maxResults:ListChannelMessages' :: ListChannelMessages -> Maybe Natural
$sel:chimeBearer:ListChannelMessages' :: ListChannelMessages -> Maybe Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [HeaderName
"x-amz-chime-bearer" forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# Maybe Text
chimeBearer]

instance Data.ToPath ListChannelMessages where
  toPath :: ListChannelMessages -> ByteString
toPath ListChannelMessages' {Maybe Natural
Maybe Text
Maybe (Sensitive Text)
Maybe POSIX
Maybe SortOrder
Text
channelArn :: Text
sortOrder :: Maybe SortOrder
notBefore :: Maybe POSIX
notAfter :: Maybe POSIX
nextToken :: Maybe (Sensitive Text)
maxResults :: Maybe Natural
chimeBearer :: Maybe Text
$sel:channelArn:ListChannelMessages' :: ListChannelMessages -> Text
$sel:sortOrder:ListChannelMessages' :: ListChannelMessages -> Maybe SortOrder
$sel:notBefore:ListChannelMessages' :: ListChannelMessages -> Maybe POSIX
$sel:notAfter:ListChannelMessages' :: ListChannelMessages -> Maybe POSIX
$sel:nextToken:ListChannelMessages' :: ListChannelMessages -> Maybe (Sensitive Text)
$sel:maxResults:ListChannelMessages' :: ListChannelMessages -> Maybe Natural
$sel:chimeBearer:ListChannelMessages' :: ListChannelMessages -> Maybe Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ByteString
"/channels/", forall a. ToByteString a => a -> ByteString
Data.toBS Text
channelArn, ByteString
"/messages"]

instance Data.ToQuery ListChannelMessages where
  toQuery :: ListChannelMessages -> QueryString
toQuery ListChannelMessages' {Maybe Natural
Maybe Text
Maybe (Sensitive Text)
Maybe POSIX
Maybe SortOrder
Text
channelArn :: Text
sortOrder :: Maybe SortOrder
notBefore :: Maybe POSIX
notAfter :: Maybe POSIX
nextToken :: Maybe (Sensitive Text)
maxResults :: Maybe Natural
chimeBearer :: Maybe Text
$sel:channelArn:ListChannelMessages' :: ListChannelMessages -> Text
$sel:sortOrder:ListChannelMessages' :: ListChannelMessages -> Maybe SortOrder
$sel:notBefore:ListChannelMessages' :: ListChannelMessages -> Maybe POSIX
$sel:notAfter:ListChannelMessages' :: ListChannelMessages -> Maybe POSIX
$sel:nextToken:ListChannelMessages' :: ListChannelMessages -> Maybe (Sensitive Text)
$sel:maxResults:ListChannelMessages' :: ListChannelMessages -> Maybe Natural
$sel:chimeBearer:ListChannelMessages' :: ListChannelMessages -> Maybe Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"max-results" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Natural
maxResults,
        ByteString
"next-token" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe (Sensitive Text)
nextToken,
        ByteString
"not-after" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe POSIX
notAfter,
        ByteString
"not-before" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe POSIX
notBefore,
        ByteString
"sort-order" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe SortOrder
sortOrder
      ]

-- | /See:/ 'newListChannelMessagesResponse' smart constructor.
data ListChannelMessagesResponse = ListChannelMessagesResponse'
  { -- | The ARN of the channel containing the requested messages.
    ListChannelMessagesResponse -> Maybe Text
channelArn :: Prelude.Maybe Prelude.Text,
    -- | The information about, and content of, each requested message.
    ListChannelMessagesResponse -> Maybe [ChannelMessageSummary]
channelMessages :: Prelude.Maybe [ChannelMessageSummary],
    -- | The token passed by previous API calls until all requested messages are
    -- returned.
    ListChannelMessagesResponse -> Maybe (Sensitive Text)
nextToken :: Prelude.Maybe (Data.Sensitive Prelude.Text),
    -- | The response's http status code.
    ListChannelMessagesResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (ListChannelMessagesResponse -> ListChannelMessagesResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListChannelMessagesResponse -> ListChannelMessagesResponse -> Bool
$c/= :: ListChannelMessagesResponse -> ListChannelMessagesResponse -> Bool
== :: ListChannelMessagesResponse -> ListChannelMessagesResponse -> Bool
$c== :: ListChannelMessagesResponse -> ListChannelMessagesResponse -> Bool
Prelude.Eq, Int -> ListChannelMessagesResponse -> ShowS
[ListChannelMessagesResponse] -> ShowS
ListChannelMessagesResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListChannelMessagesResponse] -> ShowS
$cshowList :: [ListChannelMessagesResponse] -> ShowS
show :: ListChannelMessagesResponse -> String
$cshow :: ListChannelMessagesResponse -> String
showsPrec :: Int -> ListChannelMessagesResponse -> ShowS
$cshowsPrec :: Int -> ListChannelMessagesResponse -> ShowS
Prelude.Show, forall x.
Rep ListChannelMessagesResponse x -> ListChannelMessagesResponse
forall x.
ListChannelMessagesResponse -> Rep ListChannelMessagesResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListChannelMessagesResponse x -> ListChannelMessagesResponse
$cfrom :: forall x.
ListChannelMessagesResponse -> Rep ListChannelMessagesResponse x
Prelude.Generic)

-- |
-- Create a value of 'ListChannelMessagesResponse' 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:
--
-- 'channelArn', 'listChannelMessagesResponse_channelArn' - The ARN of the channel containing the requested messages.
--
-- 'channelMessages', 'listChannelMessagesResponse_channelMessages' - The information about, and content of, each requested message.
--
-- 'nextToken', 'listChannelMessagesResponse_nextToken' - The token passed by previous API calls until all requested messages are
-- returned.
--
-- 'httpStatus', 'listChannelMessagesResponse_httpStatus' - The response's http status code.
newListChannelMessagesResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListChannelMessagesResponse
newListChannelMessagesResponse :: Int -> ListChannelMessagesResponse
newListChannelMessagesResponse Int
pHttpStatus_ =
  ListChannelMessagesResponse'
    { $sel:channelArn:ListChannelMessagesResponse' :: Maybe Text
channelArn =
        forall a. Maybe a
Prelude.Nothing,
      $sel:channelMessages:ListChannelMessagesResponse' :: Maybe [ChannelMessageSummary]
channelMessages = forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListChannelMessagesResponse' :: Maybe (Sensitive Text)
nextToken = forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListChannelMessagesResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The ARN of the channel containing the requested messages.
listChannelMessagesResponse_channelArn :: Lens.Lens' ListChannelMessagesResponse (Prelude.Maybe Prelude.Text)
listChannelMessagesResponse_channelArn :: Lens' ListChannelMessagesResponse (Maybe Text)
listChannelMessagesResponse_channelArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListChannelMessagesResponse' {Maybe Text
channelArn :: Maybe Text
$sel:channelArn:ListChannelMessagesResponse' :: ListChannelMessagesResponse -> Maybe Text
channelArn} -> Maybe Text
channelArn) (\s :: ListChannelMessagesResponse
s@ListChannelMessagesResponse' {} Maybe Text
a -> ListChannelMessagesResponse
s {$sel:channelArn:ListChannelMessagesResponse' :: Maybe Text
channelArn = Maybe Text
a} :: ListChannelMessagesResponse)

-- | The information about, and content of, each requested message.
listChannelMessagesResponse_channelMessages :: Lens.Lens' ListChannelMessagesResponse (Prelude.Maybe [ChannelMessageSummary])
listChannelMessagesResponse_channelMessages :: Lens' ListChannelMessagesResponse (Maybe [ChannelMessageSummary])
listChannelMessagesResponse_channelMessages = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListChannelMessagesResponse' {Maybe [ChannelMessageSummary]
channelMessages :: Maybe [ChannelMessageSummary]
$sel:channelMessages:ListChannelMessagesResponse' :: ListChannelMessagesResponse -> Maybe [ChannelMessageSummary]
channelMessages} -> Maybe [ChannelMessageSummary]
channelMessages) (\s :: ListChannelMessagesResponse
s@ListChannelMessagesResponse' {} Maybe [ChannelMessageSummary]
a -> ListChannelMessagesResponse
s {$sel:channelMessages:ListChannelMessagesResponse' :: Maybe [ChannelMessageSummary]
channelMessages = Maybe [ChannelMessageSummary]
a} :: ListChannelMessagesResponse) 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 token passed by previous API calls until all requested messages are
-- returned.
listChannelMessagesResponse_nextToken :: Lens.Lens' ListChannelMessagesResponse (Prelude.Maybe Prelude.Text)
listChannelMessagesResponse_nextToken :: Lens' ListChannelMessagesResponse (Maybe Text)
listChannelMessagesResponse_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListChannelMessagesResponse' {Maybe (Sensitive Text)
nextToken :: Maybe (Sensitive Text)
$sel:nextToken:ListChannelMessagesResponse' :: ListChannelMessagesResponse -> Maybe (Sensitive Text)
nextToken} -> Maybe (Sensitive Text)
nextToken) (\s :: ListChannelMessagesResponse
s@ListChannelMessagesResponse' {} Maybe (Sensitive Text)
a -> ListChannelMessagesResponse
s {$sel:nextToken:ListChannelMessagesResponse' :: Maybe (Sensitive Text)
nextToken = Maybe (Sensitive Text)
a} :: ListChannelMessagesResponse) 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 a. Iso' (Sensitive a) a
Data._Sensitive

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

instance Prelude.NFData ListChannelMessagesResponse where
  rnf :: ListChannelMessagesResponse -> ()
rnf ListChannelMessagesResponse' {Int
Maybe [ChannelMessageSummary]
Maybe Text
Maybe (Sensitive Text)
httpStatus :: Int
nextToken :: Maybe (Sensitive Text)
channelMessages :: Maybe [ChannelMessageSummary]
channelArn :: Maybe Text
$sel:httpStatus:ListChannelMessagesResponse' :: ListChannelMessagesResponse -> Int
$sel:nextToken:ListChannelMessagesResponse' :: ListChannelMessagesResponse -> Maybe (Sensitive Text)
$sel:channelMessages:ListChannelMessagesResponse' :: ListChannelMessagesResponse -> Maybe [ChannelMessageSummary]
$sel:channelArn:ListChannelMessagesResponse' :: ListChannelMessagesResponse -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
channelArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [ChannelMessageSummary]
channelMessages
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (Sensitive Text)
nextToken
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus