{-# 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.ConnectParticipant.GetTranscript
-- 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)
--
-- Retrieves a transcript of the session, including details about any
-- attachments. Note that ConnectionToken is used for invoking this API
-- instead of ParticipantToken.
--
-- The Amazon Connect Participant Service APIs do not use
-- <https://docs.aws.amazon.com/general/latest/gr/signature-version-4.html Signature Version 4 authentication>.
module Amazonka.ConnectParticipant.GetTranscript
  ( -- * Creating a Request
    GetTranscript (..),
    newGetTranscript,

    -- * Request Lenses
    getTranscript_scanDirection,
    getTranscript_nextToken,
    getTranscript_sortOrder,
    getTranscript_contactId,
    getTranscript_maxResults,
    getTranscript_startPosition,
    getTranscript_connectionToken,

    -- * Destructuring the Response
    GetTranscriptResponse (..),
    newGetTranscriptResponse,

    -- * Response Lenses
    getTranscriptResponse_nextToken,
    getTranscriptResponse_initialContactId,
    getTranscriptResponse_transcript,
    getTranscriptResponse_httpStatus,
  )
where

import Amazonka.ConnectParticipant.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:/ 'newGetTranscript' smart constructor.
data GetTranscript = GetTranscript'
  { -- | The direction from StartPosition from which to retrieve message.
    -- Default: BACKWARD when no StartPosition is provided, FORWARD with
    -- StartPosition.
    GetTranscript -> Maybe ScanDirection
scanDirection :: Prelude.Maybe ScanDirection,
    -- | The pagination token. Use the value returned previously in the next
    -- subsequent request to retrieve the next set of results.
    GetTranscript -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The sort order for the records. Default: DESCENDING.
    GetTranscript -> Maybe SortKey
sortOrder :: Prelude.Maybe SortKey,
    -- | The contactId from the current contact chain for which transcript is
    -- needed.
    GetTranscript -> Maybe Text
contactId :: Prelude.Maybe Prelude.Text,
    -- | The maximum number of results to return in the page. Default: 10.
    GetTranscript -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
    -- | A filtering option for where to start.
    GetTranscript -> Maybe StartPosition
startPosition :: Prelude.Maybe StartPosition,
    -- | The authentication token associated with the participant\'s connection.
    GetTranscript -> Text
connectionToken :: Prelude.Text
  }
  deriving (GetTranscript -> GetTranscript -> Bool
(GetTranscript -> GetTranscript -> Bool)
-> (GetTranscript -> GetTranscript -> Bool) -> Eq GetTranscript
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetTranscript -> GetTranscript -> Bool
$c/= :: GetTranscript -> GetTranscript -> Bool
== :: GetTranscript -> GetTranscript -> Bool
$c== :: GetTranscript -> GetTranscript -> Bool
Prelude.Eq, ReadPrec [GetTranscript]
ReadPrec GetTranscript
Int -> ReadS GetTranscript
ReadS [GetTranscript]
(Int -> ReadS GetTranscript)
-> ReadS [GetTranscript]
-> ReadPrec GetTranscript
-> ReadPrec [GetTranscript]
-> Read GetTranscript
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetTranscript]
$creadListPrec :: ReadPrec [GetTranscript]
readPrec :: ReadPrec GetTranscript
$creadPrec :: ReadPrec GetTranscript
readList :: ReadS [GetTranscript]
$creadList :: ReadS [GetTranscript]
readsPrec :: Int -> ReadS GetTranscript
$creadsPrec :: Int -> ReadS GetTranscript
Prelude.Read, Int -> GetTranscript -> ShowS
[GetTranscript] -> ShowS
GetTranscript -> String
(Int -> GetTranscript -> ShowS)
-> (GetTranscript -> String)
-> ([GetTranscript] -> ShowS)
-> Show GetTranscript
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetTranscript] -> ShowS
$cshowList :: [GetTranscript] -> ShowS
show :: GetTranscript -> String
$cshow :: GetTranscript -> String
showsPrec :: Int -> GetTranscript -> ShowS
$cshowsPrec :: Int -> GetTranscript -> ShowS
Prelude.Show, (forall x. GetTranscript -> Rep GetTranscript x)
-> (forall x. Rep GetTranscript x -> GetTranscript)
-> Generic GetTranscript
forall x. Rep GetTranscript x -> GetTranscript
forall x. GetTranscript -> Rep GetTranscript x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetTranscript x -> GetTranscript
$cfrom :: forall x. GetTranscript -> Rep GetTranscript x
Prelude.Generic)

-- |
-- Create a value of 'GetTranscript' 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:
--
-- 'scanDirection', 'getTranscript_scanDirection' - The direction from StartPosition from which to retrieve message.
-- Default: BACKWARD when no StartPosition is provided, FORWARD with
-- StartPosition.
--
-- 'nextToken', 'getTranscript_nextToken' - The pagination token. Use the value returned previously in the next
-- subsequent request to retrieve the next set of results.
--
-- 'sortOrder', 'getTranscript_sortOrder' - The sort order for the records. Default: DESCENDING.
--
-- 'contactId', 'getTranscript_contactId' - The contactId from the current contact chain for which transcript is
-- needed.
--
-- 'maxResults', 'getTranscript_maxResults' - The maximum number of results to return in the page. Default: 10.
--
-- 'startPosition', 'getTranscript_startPosition' - A filtering option for where to start.
--
-- 'connectionToken', 'getTranscript_connectionToken' - The authentication token associated with the participant\'s connection.
newGetTranscript ::
  -- | 'connectionToken'
  Prelude.Text ->
  GetTranscript
newGetTranscript :: Text -> GetTranscript
newGetTranscript Text
pConnectionToken_ =
  GetTranscript' :: Maybe ScanDirection
-> Maybe Text
-> Maybe SortKey
-> Maybe Text
-> Maybe Natural
-> Maybe StartPosition
-> Text
-> GetTranscript
GetTranscript'
    { $sel:scanDirection:GetTranscript' :: Maybe ScanDirection
scanDirection = Maybe ScanDirection
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:GetTranscript' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:sortOrder:GetTranscript' :: Maybe SortKey
sortOrder = Maybe SortKey
forall a. Maybe a
Prelude.Nothing,
      $sel:contactId:GetTranscript' :: Maybe Text
contactId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:GetTranscript' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:startPosition:GetTranscript' :: Maybe StartPosition
startPosition = Maybe StartPosition
forall a. Maybe a
Prelude.Nothing,
      $sel:connectionToken:GetTranscript' :: Text
connectionToken = Text
pConnectionToken_
    }

-- | The direction from StartPosition from which to retrieve message.
-- Default: BACKWARD when no StartPosition is provided, FORWARD with
-- StartPosition.
getTranscript_scanDirection :: Lens.Lens' GetTranscript (Prelude.Maybe ScanDirection)
getTranscript_scanDirection :: (Maybe ScanDirection -> f (Maybe ScanDirection))
-> GetTranscript -> f GetTranscript
getTranscript_scanDirection = (GetTranscript -> Maybe ScanDirection)
-> (GetTranscript -> Maybe ScanDirection -> GetTranscript)
-> Lens
     GetTranscript
     GetTranscript
     (Maybe ScanDirection)
     (Maybe ScanDirection)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetTranscript' {Maybe ScanDirection
scanDirection :: Maybe ScanDirection
$sel:scanDirection:GetTranscript' :: GetTranscript -> Maybe ScanDirection
scanDirection} -> Maybe ScanDirection
scanDirection) (\s :: GetTranscript
s@GetTranscript' {} Maybe ScanDirection
a -> GetTranscript
s {$sel:scanDirection:GetTranscript' :: Maybe ScanDirection
scanDirection = Maybe ScanDirection
a} :: GetTranscript)

-- | The pagination token. Use the value returned previously in the next
-- subsequent request to retrieve the next set of results.
getTranscript_nextToken :: Lens.Lens' GetTranscript (Prelude.Maybe Prelude.Text)
getTranscript_nextToken :: (Maybe Text -> f (Maybe Text)) -> GetTranscript -> f GetTranscript
getTranscript_nextToken = (GetTranscript -> Maybe Text)
-> (GetTranscript -> Maybe Text -> GetTranscript)
-> Lens GetTranscript GetTranscript (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetTranscript' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:GetTranscript' :: GetTranscript -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: GetTranscript
s@GetTranscript' {} Maybe Text
a -> GetTranscript
s {$sel:nextToken:GetTranscript' :: Maybe Text
nextToken = Maybe Text
a} :: GetTranscript)

-- | The sort order for the records. Default: DESCENDING.
getTranscript_sortOrder :: Lens.Lens' GetTranscript (Prelude.Maybe SortKey)
getTranscript_sortOrder :: (Maybe SortKey -> f (Maybe SortKey))
-> GetTranscript -> f GetTranscript
getTranscript_sortOrder = (GetTranscript -> Maybe SortKey)
-> (GetTranscript -> Maybe SortKey -> GetTranscript)
-> Lens GetTranscript GetTranscript (Maybe SortKey) (Maybe SortKey)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetTranscript' {Maybe SortKey
sortOrder :: Maybe SortKey
$sel:sortOrder:GetTranscript' :: GetTranscript -> Maybe SortKey
sortOrder} -> Maybe SortKey
sortOrder) (\s :: GetTranscript
s@GetTranscript' {} Maybe SortKey
a -> GetTranscript
s {$sel:sortOrder:GetTranscript' :: Maybe SortKey
sortOrder = Maybe SortKey
a} :: GetTranscript)

-- | The contactId from the current contact chain for which transcript is
-- needed.
getTranscript_contactId :: Lens.Lens' GetTranscript (Prelude.Maybe Prelude.Text)
getTranscript_contactId :: (Maybe Text -> f (Maybe Text)) -> GetTranscript -> f GetTranscript
getTranscript_contactId = (GetTranscript -> Maybe Text)
-> (GetTranscript -> Maybe Text -> GetTranscript)
-> Lens GetTranscript GetTranscript (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetTranscript' {Maybe Text
contactId :: Maybe Text
$sel:contactId:GetTranscript' :: GetTranscript -> Maybe Text
contactId} -> Maybe Text
contactId) (\s :: GetTranscript
s@GetTranscript' {} Maybe Text
a -> GetTranscript
s {$sel:contactId:GetTranscript' :: Maybe Text
contactId = Maybe Text
a} :: GetTranscript)

-- | The maximum number of results to return in the page. Default: 10.
getTranscript_maxResults :: Lens.Lens' GetTranscript (Prelude.Maybe Prelude.Natural)
getTranscript_maxResults :: (Maybe Natural -> f (Maybe Natural))
-> GetTranscript -> f GetTranscript
getTranscript_maxResults = (GetTranscript -> Maybe Natural)
-> (GetTranscript -> Maybe Natural -> GetTranscript)
-> Lens GetTranscript GetTranscript (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetTranscript' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:GetTranscript' :: GetTranscript -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: GetTranscript
s@GetTranscript' {} Maybe Natural
a -> GetTranscript
s {$sel:maxResults:GetTranscript' :: Maybe Natural
maxResults = Maybe Natural
a} :: GetTranscript)

-- | A filtering option for where to start.
getTranscript_startPosition :: Lens.Lens' GetTranscript (Prelude.Maybe StartPosition)
getTranscript_startPosition :: (Maybe StartPosition -> f (Maybe StartPosition))
-> GetTranscript -> f GetTranscript
getTranscript_startPosition = (GetTranscript -> Maybe StartPosition)
-> (GetTranscript -> Maybe StartPosition -> GetTranscript)
-> Lens
     GetTranscript
     GetTranscript
     (Maybe StartPosition)
     (Maybe StartPosition)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetTranscript' {Maybe StartPosition
startPosition :: Maybe StartPosition
$sel:startPosition:GetTranscript' :: GetTranscript -> Maybe StartPosition
startPosition} -> Maybe StartPosition
startPosition) (\s :: GetTranscript
s@GetTranscript' {} Maybe StartPosition
a -> GetTranscript
s {$sel:startPosition:GetTranscript' :: Maybe StartPosition
startPosition = Maybe StartPosition
a} :: GetTranscript)

-- | The authentication token associated with the participant\'s connection.
getTranscript_connectionToken :: Lens.Lens' GetTranscript Prelude.Text
getTranscript_connectionToken :: (Text -> f Text) -> GetTranscript -> f GetTranscript
getTranscript_connectionToken = (GetTranscript -> Text)
-> (GetTranscript -> Text -> GetTranscript)
-> Lens GetTranscript GetTranscript Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetTranscript' {Text
connectionToken :: Text
$sel:connectionToken:GetTranscript' :: GetTranscript -> Text
connectionToken} -> Text
connectionToken) (\s :: GetTranscript
s@GetTranscript' {} Text
a -> GetTranscript
s {$sel:connectionToken:GetTranscript' :: Text
connectionToken = Text
a} :: GetTranscript)

instance Core.AWSRequest GetTranscript where
  type
    AWSResponse GetTranscript =
      GetTranscriptResponse
  request :: GetTranscript -> Request GetTranscript
request = Service -> GetTranscript -> Request GetTranscript
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy GetTranscript
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetTranscript)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse GetTranscript))
-> Logger
-> Service
-> Proxy GetTranscript
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetTranscript)))
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 Text -> Maybe [Item] -> Int -> GetTranscriptResponse
GetTranscriptResponse'
            (Maybe Text
 -> Maybe Text -> Maybe [Item] -> Int -> GetTranscriptResponse)
-> Either String (Maybe Text)
-> Either
     String (Maybe Text -> Maybe [Item] -> Int -> GetTranscriptResponse)
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
"NextToken")
            Either
  String (Maybe Text -> Maybe [Item] -> Int -> GetTranscriptResponse)
-> Either String (Maybe Text)
-> Either String (Maybe [Item] -> Int -> GetTranscriptResponse)
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
"InitialContactId")
            Either String (Maybe [Item] -> Int -> GetTranscriptResponse)
-> Either String (Maybe [Item])
-> Either String (Int -> GetTranscriptResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe (Maybe [Item]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"Transcript" Either String (Maybe (Maybe [Item]))
-> Maybe [Item] -> Either String (Maybe [Item])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [Item]
forall a. Monoid a => a
Prelude.mempty)
            Either String (Int -> GetTranscriptResponse)
-> Either String Int -> Either String GetTranscriptResponse
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 GetTranscript

instance Prelude.NFData GetTranscript

instance Core.ToHeaders GetTranscript where
  toHeaders :: GetTranscript -> ResponseHeaders
toHeaders GetTranscript' {Maybe Natural
Maybe Text
Maybe ScanDirection
Maybe SortKey
Maybe StartPosition
Text
connectionToken :: Text
startPosition :: Maybe StartPosition
maxResults :: Maybe Natural
contactId :: Maybe Text
sortOrder :: Maybe SortKey
nextToken :: Maybe Text
scanDirection :: Maybe ScanDirection
$sel:connectionToken:GetTranscript' :: GetTranscript -> Text
$sel:startPosition:GetTranscript' :: GetTranscript -> Maybe StartPosition
$sel:maxResults:GetTranscript' :: GetTranscript -> Maybe Natural
$sel:contactId:GetTranscript' :: GetTranscript -> Maybe Text
$sel:sortOrder:GetTranscript' :: GetTranscript -> Maybe SortKey
$sel:nextToken:GetTranscript' :: GetTranscript -> Maybe Text
$sel:scanDirection:GetTranscript' :: GetTranscript -> Maybe ScanDirection
..} =
    [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ HeaderName
"X-Amz-Bearer" HeaderName -> Text -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# Text
connectionToken,
        HeaderName
"Content-Type"
          HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# (ByteString
"application/x-amz-json-1.1" :: Prelude.ByteString)
      ]

instance Core.ToJSON GetTranscript where
  toJSON :: GetTranscript -> Value
toJSON GetTranscript' {Maybe Natural
Maybe Text
Maybe ScanDirection
Maybe SortKey
Maybe StartPosition
Text
connectionToken :: Text
startPosition :: Maybe StartPosition
maxResults :: Maybe Natural
contactId :: Maybe Text
sortOrder :: Maybe SortKey
nextToken :: Maybe Text
scanDirection :: Maybe ScanDirection
$sel:connectionToken:GetTranscript' :: GetTranscript -> Text
$sel:startPosition:GetTranscript' :: GetTranscript -> Maybe StartPosition
$sel:maxResults:GetTranscript' :: GetTranscript -> Maybe Natural
$sel:contactId:GetTranscript' :: GetTranscript -> Maybe Text
$sel:sortOrder:GetTranscript' :: GetTranscript -> Maybe SortKey
$sel:nextToken:GetTranscript' :: GetTranscript -> Maybe Text
$sel:scanDirection:GetTranscript' :: GetTranscript -> Maybe ScanDirection
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"ScanDirection" Text -> ScanDirection -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (ScanDirection -> Pair) -> Maybe ScanDirection -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe ScanDirection
scanDirection,
            (Text
"NextToken" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
nextToken,
            (Text
"SortOrder" Text -> SortKey -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (SortKey -> Pair) -> Maybe SortKey -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe SortKey
sortOrder,
            (Text
"ContactId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
contactId,
            (Text
"MaxResults" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Natural -> Pair) -> Maybe Natural -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
maxResults,
            (Text
"StartPosition" Text -> StartPosition -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (StartPosition -> Pair) -> Maybe StartPosition -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe StartPosition
startPosition
          ]
      )

instance Core.ToPath GetTranscript where
  toPath :: GetTranscript -> ByteString
toPath = ByteString -> GetTranscript -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/participant/transcript"

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

-- | /See:/ 'newGetTranscriptResponse' smart constructor.
data GetTranscriptResponse = GetTranscriptResponse'
  { -- | The pagination token. Use the value returned previously in the next
    -- subsequent request to retrieve the next set of results.
    GetTranscriptResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The initial contact ID for the contact.
    GetTranscriptResponse -> Maybe Text
initialContactId :: Prelude.Maybe Prelude.Text,
    -- | The list of messages in the session.
    GetTranscriptResponse -> Maybe [Item]
transcript :: Prelude.Maybe [Item],
    -- | The response's http status code.
    GetTranscriptResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (GetTranscriptResponse -> GetTranscriptResponse -> Bool
(GetTranscriptResponse -> GetTranscriptResponse -> Bool)
-> (GetTranscriptResponse -> GetTranscriptResponse -> Bool)
-> Eq GetTranscriptResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetTranscriptResponse -> GetTranscriptResponse -> Bool
$c/= :: GetTranscriptResponse -> GetTranscriptResponse -> Bool
== :: GetTranscriptResponse -> GetTranscriptResponse -> Bool
$c== :: GetTranscriptResponse -> GetTranscriptResponse -> Bool
Prelude.Eq, ReadPrec [GetTranscriptResponse]
ReadPrec GetTranscriptResponse
Int -> ReadS GetTranscriptResponse
ReadS [GetTranscriptResponse]
(Int -> ReadS GetTranscriptResponse)
-> ReadS [GetTranscriptResponse]
-> ReadPrec GetTranscriptResponse
-> ReadPrec [GetTranscriptResponse]
-> Read GetTranscriptResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetTranscriptResponse]
$creadListPrec :: ReadPrec [GetTranscriptResponse]
readPrec :: ReadPrec GetTranscriptResponse
$creadPrec :: ReadPrec GetTranscriptResponse
readList :: ReadS [GetTranscriptResponse]
$creadList :: ReadS [GetTranscriptResponse]
readsPrec :: Int -> ReadS GetTranscriptResponse
$creadsPrec :: Int -> ReadS GetTranscriptResponse
Prelude.Read, Int -> GetTranscriptResponse -> ShowS
[GetTranscriptResponse] -> ShowS
GetTranscriptResponse -> String
(Int -> GetTranscriptResponse -> ShowS)
-> (GetTranscriptResponse -> String)
-> ([GetTranscriptResponse] -> ShowS)
-> Show GetTranscriptResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetTranscriptResponse] -> ShowS
$cshowList :: [GetTranscriptResponse] -> ShowS
show :: GetTranscriptResponse -> String
$cshow :: GetTranscriptResponse -> String
showsPrec :: Int -> GetTranscriptResponse -> ShowS
$cshowsPrec :: Int -> GetTranscriptResponse -> ShowS
Prelude.Show, (forall x. GetTranscriptResponse -> Rep GetTranscriptResponse x)
-> (forall x. Rep GetTranscriptResponse x -> GetTranscriptResponse)
-> Generic GetTranscriptResponse
forall x. Rep GetTranscriptResponse x -> GetTranscriptResponse
forall x. GetTranscriptResponse -> Rep GetTranscriptResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetTranscriptResponse x -> GetTranscriptResponse
$cfrom :: forall x. GetTranscriptResponse -> Rep GetTranscriptResponse x
Prelude.Generic)

-- |
-- Create a value of 'GetTranscriptResponse' 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:
--
-- 'nextToken', 'getTranscriptResponse_nextToken' - The pagination token. Use the value returned previously in the next
-- subsequent request to retrieve the next set of results.
--
-- 'initialContactId', 'getTranscriptResponse_initialContactId' - The initial contact ID for the contact.
--
-- 'transcript', 'getTranscriptResponse_transcript' - The list of messages in the session.
--
-- 'httpStatus', 'getTranscriptResponse_httpStatus' - The response's http status code.
newGetTranscriptResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  GetTranscriptResponse
newGetTranscriptResponse :: Int -> GetTranscriptResponse
newGetTranscriptResponse Int
pHttpStatus_ =
  GetTranscriptResponse' :: Maybe Text
-> Maybe Text -> Maybe [Item] -> Int -> GetTranscriptResponse
GetTranscriptResponse'
    { $sel:nextToken:GetTranscriptResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:initialContactId:GetTranscriptResponse' :: Maybe Text
initialContactId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:transcript:GetTranscriptResponse' :: Maybe [Item]
transcript = Maybe [Item]
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:GetTranscriptResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The pagination token. Use the value returned previously in the next
-- subsequent request to retrieve the next set of results.
getTranscriptResponse_nextToken :: Lens.Lens' GetTranscriptResponse (Prelude.Maybe Prelude.Text)
getTranscriptResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> GetTranscriptResponse -> f GetTranscriptResponse
getTranscriptResponse_nextToken = (GetTranscriptResponse -> Maybe Text)
-> (GetTranscriptResponse -> Maybe Text -> GetTranscriptResponse)
-> Lens
     GetTranscriptResponse
     GetTranscriptResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetTranscriptResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:GetTranscriptResponse' :: GetTranscriptResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: GetTranscriptResponse
s@GetTranscriptResponse' {} Maybe Text
a -> GetTranscriptResponse
s {$sel:nextToken:GetTranscriptResponse' :: Maybe Text
nextToken = Maybe Text
a} :: GetTranscriptResponse)

-- | The initial contact ID for the contact.
getTranscriptResponse_initialContactId :: Lens.Lens' GetTranscriptResponse (Prelude.Maybe Prelude.Text)
getTranscriptResponse_initialContactId :: (Maybe Text -> f (Maybe Text))
-> GetTranscriptResponse -> f GetTranscriptResponse
getTranscriptResponse_initialContactId = (GetTranscriptResponse -> Maybe Text)
-> (GetTranscriptResponse -> Maybe Text -> GetTranscriptResponse)
-> Lens
     GetTranscriptResponse
     GetTranscriptResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetTranscriptResponse' {Maybe Text
initialContactId :: Maybe Text
$sel:initialContactId:GetTranscriptResponse' :: GetTranscriptResponse -> Maybe Text
initialContactId} -> Maybe Text
initialContactId) (\s :: GetTranscriptResponse
s@GetTranscriptResponse' {} Maybe Text
a -> GetTranscriptResponse
s {$sel:initialContactId:GetTranscriptResponse' :: Maybe Text
initialContactId = Maybe Text
a} :: GetTranscriptResponse)

-- | The list of messages in the session.
getTranscriptResponse_transcript :: Lens.Lens' GetTranscriptResponse (Prelude.Maybe [Item])
getTranscriptResponse_transcript :: (Maybe [Item] -> f (Maybe [Item]))
-> GetTranscriptResponse -> f GetTranscriptResponse
getTranscriptResponse_transcript = (GetTranscriptResponse -> Maybe [Item])
-> (GetTranscriptResponse -> Maybe [Item] -> GetTranscriptResponse)
-> Lens
     GetTranscriptResponse
     GetTranscriptResponse
     (Maybe [Item])
     (Maybe [Item])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetTranscriptResponse' {Maybe [Item]
transcript :: Maybe [Item]
$sel:transcript:GetTranscriptResponse' :: GetTranscriptResponse -> Maybe [Item]
transcript} -> Maybe [Item]
transcript) (\s :: GetTranscriptResponse
s@GetTranscriptResponse' {} Maybe [Item]
a -> GetTranscriptResponse
s {$sel:transcript:GetTranscriptResponse' :: Maybe [Item]
transcript = Maybe [Item]
a} :: GetTranscriptResponse) ((Maybe [Item] -> f (Maybe [Item]))
 -> GetTranscriptResponse -> f GetTranscriptResponse)
-> ((Maybe [Item] -> f (Maybe [Item]))
    -> Maybe [Item] -> f (Maybe [Item]))
-> (Maybe [Item] -> f (Maybe [Item]))
-> GetTranscriptResponse
-> f GetTranscriptResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Item] [Item] [Item] [Item]
-> Iso (Maybe [Item]) (Maybe [Item]) (Maybe [Item]) (Maybe [Item])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso [Item] [Item] [Item] [Item]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

instance Prelude.NFData GetTranscriptResponse