{-# 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.Connect.StartTaskContact
-- 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)
--
-- Initiates a contact flow to start a new task.
module Amazonka.Connect.StartTaskContact
  ( -- * Creating a Request
    StartTaskContact (..),
    newStartTaskContact,

    -- * Request Lenses
    startTaskContact_clientToken,
    startTaskContact_references,
    startTaskContact_previousContactId,
    startTaskContact_attributes,
    startTaskContact_description,
    startTaskContact_instanceId,
    startTaskContact_contactFlowId,
    startTaskContact_name,

    -- * Destructuring the Response
    StartTaskContactResponse (..),
    newStartTaskContactResponse,

    -- * Response Lenses
    startTaskContactResponse_contactId,
    startTaskContactResponse_httpStatus,
  )
where

import Amazonka.Connect.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:/ 'newStartTaskContact' smart constructor.
data StartTaskContact = StartTaskContact'
  { -- | A unique, case-sensitive identifier that you provide to ensure the
    -- idempotency of the request.
    StartTaskContact -> Maybe Text
clientToken :: Prelude.Maybe Prelude.Text,
    -- | A formatted URL that is shown to an agent in the Contact Control Panel
    -- (CCP).
    StartTaskContact -> Maybe (HashMap Text Reference)
references :: Prelude.Maybe (Prelude.HashMap Prelude.Text Reference),
    -- | The identifier of the previous chat, voice, or task contact.
    StartTaskContact -> Maybe Text
previousContactId :: Prelude.Maybe Prelude.Text,
    -- | A custom key-value pair using an attribute map. The attributes are
    -- standard Amazon Connect attributes, and can be accessed in contact flows
    -- just like any other contact attributes.
    --
    -- There can be up to 32,768 UTF-8 bytes across all key-value pairs per
    -- contact. Attribute keys can include only alphanumeric, dash, and
    -- underscore characters.
    StartTaskContact -> Maybe (HashMap Text Text)
attributes :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
    -- | A description of the task that is shown to an agent in the Contact
    -- Control Panel (CCP).
    StartTaskContact -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | The identifier of the Amazon Connect instance. You can find the
    -- instanceId in the ARN of the instance.
    StartTaskContact -> Text
instanceId :: Prelude.Text,
    -- | The identifier of the contact flow for initiating the tasks. To see the
    -- ContactFlowId in the Amazon Connect console user interface, on the
    -- navigation menu go to __Routing__, __Contact Flows__. Choose the contact
    -- flow. On the contact flow page, under the name of the contact flow,
    -- choose __Show additional flow information__. The ContactFlowId is the
    -- last part of the ARN, shown here in bold:
    --
    -- arn:aws:connect:us-west-2:xxxxxxxxxxxx:instance\/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\/contact-flow\/__846ec553-a005-41c0-8341-xxxxxxxxxxxx__
    StartTaskContact -> Text
contactFlowId :: Prelude.Text,
    -- | The name of a task that is shown to an agent in the Contact Control
    -- Panel (CCP).
    StartTaskContact -> Text
name :: Prelude.Text
  }
  deriving (StartTaskContact -> StartTaskContact -> Bool
(StartTaskContact -> StartTaskContact -> Bool)
-> (StartTaskContact -> StartTaskContact -> Bool)
-> Eq StartTaskContact
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StartTaskContact -> StartTaskContact -> Bool
$c/= :: StartTaskContact -> StartTaskContact -> Bool
== :: StartTaskContact -> StartTaskContact -> Bool
$c== :: StartTaskContact -> StartTaskContact -> Bool
Prelude.Eq, ReadPrec [StartTaskContact]
ReadPrec StartTaskContact
Int -> ReadS StartTaskContact
ReadS [StartTaskContact]
(Int -> ReadS StartTaskContact)
-> ReadS [StartTaskContact]
-> ReadPrec StartTaskContact
-> ReadPrec [StartTaskContact]
-> Read StartTaskContact
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StartTaskContact]
$creadListPrec :: ReadPrec [StartTaskContact]
readPrec :: ReadPrec StartTaskContact
$creadPrec :: ReadPrec StartTaskContact
readList :: ReadS [StartTaskContact]
$creadList :: ReadS [StartTaskContact]
readsPrec :: Int -> ReadS StartTaskContact
$creadsPrec :: Int -> ReadS StartTaskContact
Prelude.Read, Int -> StartTaskContact -> ShowS
[StartTaskContact] -> ShowS
StartTaskContact -> String
(Int -> StartTaskContact -> ShowS)
-> (StartTaskContact -> String)
-> ([StartTaskContact] -> ShowS)
-> Show StartTaskContact
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StartTaskContact] -> ShowS
$cshowList :: [StartTaskContact] -> ShowS
show :: StartTaskContact -> String
$cshow :: StartTaskContact -> String
showsPrec :: Int -> StartTaskContact -> ShowS
$cshowsPrec :: Int -> StartTaskContact -> ShowS
Prelude.Show, (forall x. StartTaskContact -> Rep StartTaskContact x)
-> (forall x. Rep StartTaskContact x -> StartTaskContact)
-> Generic StartTaskContact
forall x. Rep StartTaskContact x -> StartTaskContact
forall x. StartTaskContact -> Rep StartTaskContact x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep StartTaskContact x -> StartTaskContact
$cfrom :: forall x. StartTaskContact -> Rep StartTaskContact x
Prelude.Generic)

-- |
-- Create a value of 'StartTaskContact' 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:
--
-- 'clientToken', 'startTaskContact_clientToken' - A unique, case-sensitive identifier that you provide to ensure the
-- idempotency of the request.
--
-- 'references', 'startTaskContact_references' - A formatted URL that is shown to an agent in the Contact Control Panel
-- (CCP).
--
-- 'previousContactId', 'startTaskContact_previousContactId' - The identifier of the previous chat, voice, or task contact.
--
-- 'attributes', 'startTaskContact_attributes' - A custom key-value pair using an attribute map. The attributes are
-- standard Amazon Connect attributes, and can be accessed in contact flows
-- just like any other contact attributes.
--
-- There can be up to 32,768 UTF-8 bytes across all key-value pairs per
-- contact. Attribute keys can include only alphanumeric, dash, and
-- underscore characters.
--
-- 'description', 'startTaskContact_description' - A description of the task that is shown to an agent in the Contact
-- Control Panel (CCP).
--
-- 'instanceId', 'startTaskContact_instanceId' - The identifier of the Amazon Connect instance. You can find the
-- instanceId in the ARN of the instance.
--
-- 'contactFlowId', 'startTaskContact_contactFlowId' - The identifier of the contact flow for initiating the tasks. To see the
-- ContactFlowId in the Amazon Connect console user interface, on the
-- navigation menu go to __Routing__, __Contact Flows__. Choose the contact
-- flow. On the contact flow page, under the name of the contact flow,
-- choose __Show additional flow information__. The ContactFlowId is the
-- last part of the ARN, shown here in bold:
--
-- arn:aws:connect:us-west-2:xxxxxxxxxxxx:instance\/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\/contact-flow\/__846ec553-a005-41c0-8341-xxxxxxxxxxxx__
--
-- 'name', 'startTaskContact_name' - The name of a task that is shown to an agent in the Contact Control
-- Panel (CCP).
newStartTaskContact ::
  -- | 'instanceId'
  Prelude.Text ->
  -- | 'contactFlowId'
  Prelude.Text ->
  -- | 'name'
  Prelude.Text ->
  StartTaskContact
newStartTaskContact :: Text -> Text -> Text -> StartTaskContact
newStartTaskContact
  Text
pInstanceId_
  Text
pContactFlowId_
  Text
pName_ =
    StartTaskContact' :: Maybe Text
-> Maybe (HashMap Text Reference)
-> Maybe Text
-> Maybe (HashMap Text Text)
-> Maybe Text
-> Text
-> Text
-> Text
-> StartTaskContact
StartTaskContact'
      { $sel:clientToken:StartTaskContact' :: Maybe Text
clientToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:references:StartTaskContact' :: Maybe (HashMap Text Reference)
references = Maybe (HashMap Text Reference)
forall a. Maybe a
Prelude.Nothing,
        $sel:previousContactId:StartTaskContact' :: Maybe Text
previousContactId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:attributes:StartTaskContact' :: Maybe (HashMap Text Text)
attributes = Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing,
        $sel:description:StartTaskContact' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:instanceId:StartTaskContact' :: Text
instanceId = Text
pInstanceId_,
        $sel:contactFlowId:StartTaskContact' :: Text
contactFlowId = Text
pContactFlowId_,
        $sel:name:StartTaskContact' :: Text
name = Text
pName_
      }

-- | A unique, case-sensitive identifier that you provide to ensure the
-- idempotency of the request.
startTaskContact_clientToken :: Lens.Lens' StartTaskContact (Prelude.Maybe Prelude.Text)
startTaskContact_clientToken :: (Maybe Text -> f (Maybe Text))
-> StartTaskContact -> f StartTaskContact
startTaskContact_clientToken = (StartTaskContact -> Maybe Text)
-> (StartTaskContact -> Maybe Text -> StartTaskContact)
-> Lens StartTaskContact StartTaskContact (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartTaskContact' {Maybe Text
clientToken :: Maybe Text
$sel:clientToken:StartTaskContact' :: StartTaskContact -> Maybe Text
clientToken} -> Maybe Text
clientToken) (\s :: StartTaskContact
s@StartTaskContact' {} Maybe Text
a -> StartTaskContact
s {$sel:clientToken:StartTaskContact' :: Maybe Text
clientToken = Maybe Text
a} :: StartTaskContact)

-- | A formatted URL that is shown to an agent in the Contact Control Panel
-- (CCP).
startTaskContact_references :: Lens.Lens' StartTaskContact (Prelude.Maybe (Prelude.HashMap Prelude.Text Reference))
startTaskContact_references :: (Maybe (HashMap Text Reference)
 -> f (Maybe (HashMap Text Reference)))
-> StartTaskContact -> f StartTaskContact
startTaskContact_references = (StartTaskContact -> Maybe (HashMap Text Reference))
-> (StartTaskContact
    -> Maybe (HashMap Text Reference) -> StartTaskContact)
-> Lens
     StartTaskContact
     StartTaskContact
     (Maybe (HashMap Text Reference))
     (Maybe (HashMap Text Reference))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartTaskContact' {Maybe (HashMap Text Reference)
references :: Maybe (HashMap Text Reference)
$sel:references:StartTaskContact' :: StartTaskContact -> Maybe (HashMap Text Reference)
references} -> Maybe (HashMap Text Reference)
references) (\s :: StartTaskContact
s@StartTaskContact' {} Maybe (HashMap Text Reference)
a -> StartTaskContact
s {$sel:references:StartTaskContact' :: Maybe (HashMap Text Reference)
references = Maybe (HashMap Text Reference)
a} :: StartTaskContact) ((Maybe (HashMap Text Reference)
  -> f (Maybe (HashMap Text Reference)))
 -> StartTaskContact -> f StartTaskContact)
-> ((Maybe (HashMap Text Reference)
     -> f (Maybe (HashMap Text Reference)))
    -> Maybe (HashMap Text Reference)
    -> f (Maybe (HashMap Text Reference)))
-> (Maybe (HashMap Text Reference)
    -> f (Maybe (HashMap Text Reference)))
-> StartTaskContact
-> f StartTaskContact
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (HashMap Text Reference)
  (HashMap Text Reference)
  (HashMap Text Reference)
  (HashMap Text Reference)
-> Iso
     (Maybe (HashMap Text Reference))
     (Maybe (HashMap Text Reference))
     (Maybe (HashMap Text Reference))
     (Maybe (HashMap Text Reference))
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
  (HashMap Text Reference)
  (HashMap Text Reference)
  (HashMap Text Reference)
  (HashMap Text Reference)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The identifier of the previous chat, voice, or task contact.
startTaskContact_previousContactId :: Lens.Lens' StartTaskContact (Prelude.Maybe Prelude.Text)
startTaskContact_previousContactId :: (Maybe Text -> f (Maybe Text))
-> StartTaskContact -> f StartTaskContact
startTaskContact_previousContactId = (StartTaskContact -> Maybe Text)
-> (StartTaskContact -> Maybe Text -> StartTaskContact)
-> Lens StartTaskContact StartTaskContact (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartTaskContact' {Maybe Text
previousContactId :: Maybe Text
$sel:previousContactId:StartTaskContact' :: StartTaskContact -> Maybe Text
previousContactId} -> Maybe Text
previousContactId) (\s :: StartTaskContact
s@StartTaskContact' {} Maybe Text
a -> StartTaskContact
s {$sel:previousContactId:StartTaskContact' :: Maybe Text
previousContactId = Maybe Text
a} :: StartTaskContact)

-- | A custom key-value pair using an attribute map. The attributes are
-- standard Amazon Connect attributes, and can be accessed in contact flows
-- just like any other contact attributes.
--
-- There can be up to 32,768 UTF-8 bytes across all key-value pairs per
-- contact. Attribute keys can include only alphanumeric, dash, and
-- underscore characters.
startTaskContact_attributes :: Lens.Lens' StartTaskContact (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
startTaskContact_attributes :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> StartTaskContact -> f StartTaskContact
startTaskContact_attributes = (StartTaskContact -> Maybe (HashMap Text Text))
-> (StartTaskContact
    -> Maybe (HashMap Text Text) -> StartTaskContact)
-> Lens
     StartTaskContact
     StartTaskContact
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartTaskContact' {Maybe (HashMap Text Text)
attributes :: Maybe (HashMap Text Text)
$sel:attributes:StartTaskContact' :: StartTaskContact -> Maybe (HashMap Text Text)
attributes} -> Maybe (HashMap Text Text)
attributes) (\s :: StartTaskContact
s@StartTaskContact' {} Maybe (HashMap Text Text)
a -> StartTaskContact
s {$sel:attributes:StartTaskContact' :: Maybe (HashMap Text Text)
attributes = Maybe (HashMap Text Text)
a} :: StartTaskContact) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
 -> StartTaskContact -> f StartTaskContact)
-> ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
    -> Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> StartTaskContact
-> f StartTaskContact
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
-> Iso
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
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
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | A description of the task that is shown to an agent in the Contact
-- Control Panel (CCP).
startTaskContact_description :: Lens.Lens' StartTaskContact (Prelude.Maybe Prelude.Text)
startTaskContact_description :: (Maybe Text -> f (Maybe Text))
-> StartTaskContact -> f StartTaskContact
startTaskContact_description = (StartTaskContact -> Maybe Text)
-> (StartTaskContact -> Maybe Text -> StartTaskContact)
-> Lens StartTaskContact StartTaskContact (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartTaskContact' {Maybe Text
description :: Maybe Text
$sel:description:StartTaskContact' :: StartTaskContact -> Maybe Text
description} -> Maybe Text
description) (\s :: StartTaskContact
s@StartTaskContact' {} Maybe Text
a -> StartTaskContact
s {$sel:description:StartTaskContact' :: Maybe Text
description = Maybe Text
a} :: StartTaskContact)

-- | The identifier of the Amazon Connect instance. You can find the
-- instanceId in the ARN of the instance.
startTaskContact_instanceId :: Lens.Lens' StartTaskContact Prelude.Text
startTaskContact_instanceId :: (Text -> f Text) -> StartTaskContact -> f StartTaskContact
startTaskContact_instanceId = (StartTaskContact -> Text)
-> (StartTaskContact -> Text -> StartTaskContact)
-> Lens StartTaskContact StartTaskContact Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartTaskContact' {Text
instanceId :: Text
$sel:instanceId:StartTaskContact' :: StartTaskContact -> Text
instanceId} -> Text
instanceId) (\s :: StartTaskContact
s@StartTaskContact' {} Text
a -> StartTaskContact
s {$sel:instanceId:StartTaskContact' :: Text
instanceId = Text
a} :: StartTaskContact)

-- | The identifier of the contact flow for initiating the tasks. To see the
-- ContactFlowId in the Amazon Connect console user interface, on the
-- navigation menu go to __Routing__, __Contact Flows__. Choose the contact
-- flow. On the contact flow page, under the name of the contact flow,
-- choose __Show additional flow information__. The ContactFlowId is the
-- last part of the ARN, shown here in bold:
--
-- arn:aws:connect:us-west-2:xxxxxxxxxxxx:instance\/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\/contact-flow\/__846ec553-a005-41c0-8341-xxxxxxxxxxxx__
startTaskContact_contactFlowId :: Lens.Lens' StartTaskContact Prelude.Text
startTaskContact_contactFlowId :: (Text -> f Text) -> StartTaskContact -> f StartTaskContact
startTaskContact_contactFlowId = (StartTaskContact -> Text)
-> (StartTaskContact -> Text -> StartTaskContact)
-> Lens StartTaskContact StartTaskContact Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartTaskContact' {Text
contactFlowId :: Text
$sel:contactFlowId:StartTaskContact' :: StartTaskContact -> Text
contactFlowId} -> Text
contactFlowId) (\s :: StartTaskContact
s@StartTaskContact' {} Text
a -> StartTaskContact
s {$sel:contactFlowId:StartTaskContact' :: Text
contactFlowId = Text
a} :: StartTaskContact)

-- | The name of a task that is shown to an agent in the Contact Control
-- Panel (CCP).
startTaskContact_name :: Lens.Lens' StartTaskContact Prelude.Text
startTaskContact_name :: (Text -> f Text) -> StartTaskContact -> f StartTaskContact
startTaskContact_name = (StartTaskContact -> Text)
-> (StartTaskContact -> Text -> StartTaskContact)
-> Lens StartTaskContact StartTaskContact Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartTaskContact' {Text
name :: Text
$sel:name:StartTaskContact' :: StartTaskContact -> Text
name} -> Text
name) (\s :: StartTaskContact
s@StartTaskContact' {} Text
a -> StartTaskContact
s {$sel:name:StartTaskContact' :: Text
name = Text
a} :: StartTaskContact)

instance Core.AWSRequest StartTaskContact where
  type
    AWSResponse StartTaskContact =
      StartTaskContactResponse
  request :: StartTaskContact -> Request StartTaskContact
request = Service -> StartTaskContact -> Request StartTaskContact
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.putJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy StartTaskContact
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse StartTaskContact)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse StartTaskContact))
-> Logger
-> Service
-> Proxy StartTaskContact
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse StartTaskContact)))
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 -> Int -> StartTaskContactResponse
StartTaskContactResponse'
            (Maybe Text -> Int -> StartTaskContactResponse)
-> Either String (Maybe Text)
-> Either String (Int -> StartTaskContactResponse)
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
"ContactId")
            Either String (Int -> StartTaskContactResponse)
-> Either String Int -> Either String StartTaskContactResponse
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 StartTaskContact

instance Prelude.NFData StartTaskContact

instance Core.ToHeaders StartTaskContact where
  toHeaders :: StartTaskContact -> ResponseHeaders
toHeaders =
    ResponseHeaders -> StartTaskContact -> 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.ToJSON StartTaskContact where
  toJSON :: StartTaskContact -> Value
toJSON StartTaskContact' {Maybe Text
Maybe (HashMap Text Text)
Maybe (HashMap Text Reference)
Text
name :: Text
contactFlowId :: Text
instanceId :: Text
description :: Maybe Text
attributes :: Maybe (HashMap Text Text)
previousContactId :: Maybe Text
references :: Maybe (HashMap Text Reference)
clientToken :: Maybe Text
$sel:name:StartTaskContact' :: StartTaskContact -> Text
$sel:contactFlowId:StartTaskContact' :: StartTaskContact -> Text
$sel:instanceId:StartTaskContact' :: StartTaskContact -> Text
$sel:description:StartTaskContact' :: StartTaskContact -> Maybe Text
$sel:attributes:StartTaskContact' :: StartTaskContact -> Maybe (HashMap Text Text)
$sel:previousContactId:StartTaskContact' :: StartTaskContact -> Maybe Text
$sel:references:StartTaskContact' :: StartTaskContact -> Maybe (HashMap Text Reference)
$sel:clientToken:StartTaskContact' :: StartTaskContact -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"ClientToken" 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
clientToken,
            (Text
"References" Text -> HashMap Text Reference -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (HashMap Text Reference -> Pair)
-> Maybe (HashMap Text Reference) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (HashMap Text Reference)
references,
            (Text
"PreviousContactId" 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
previousContactId,
            (Text
"Attributes" Text -> HashMap Text Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (HashMap Text Text -> Pair)
-> Maybe (HashMap Text Text) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (HashMap Text Text)
attributes,
            (Text
"Description" 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
description,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"InstanceId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
instanceId),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"ContactFlowId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
contactFlowId),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Name" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
name)
          ]
      )

instance Core.ToPath StartTaskContact where
  toPath :: StartTaskContact -> ByteString
toPath = ByteString -> StartTaskContact -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/contact/task"

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

-- | /See:/ 'newStartTaskContactResponse' smart constructor.
data StartTaskContactResponse = StartTaskContactResponse'
  { -- | The identifier of this contact within the Amazon Connect instance.
    StartTaskContactResponse -> Maybe Text
contactId :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    StartTaskContactResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (StartTaskContactResponse -> StartTaskContactResponse -> Bool
(StartTaskContactResponse -> StartTaskContactResponse -> Bool)
-> (StartTaskContactResponse -> StartTaskContactResponse -> Bool)
-> Eq StartTaskContactResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StartTaskContactResponse -> StartTaskContactResponse -> Bool
$c/= :: StartTaskContactResponse -> StartTaskContactResponse -> Bool
== :: StartTaskContactResponse -> StartTaskContactResponse -> Bool
$c== :: StartTaskContactResponse -> StartTaskContactResponse -> Bool
Prelude.Eq, ReadPrec [StartTaskContactResponse]
ReadPrec StartTaskContactResponse
Int -> ReadS StartTaskContactResponse
ReadS [StartTaskContactResponse]
(Int -> ReadS StartTaskContactResponse)
-> ReadS [StartTaskContactResponse]
-> ReadPrec StartTaskContactResponse
-> ReadPrec [StartTaskContactResponse]
-> Read StartTaskContactResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StartTaskContactResponse]
$creadListPrec :: ReadPrec [StartTaskContactResponse]
readPrec :: ReadPrec StartTaskContactResponse
$creadPrec :: ReadPrec StartTaskContactResponse
readList :: ReadS [StartTaskContactResponse]
$creadList :: ReadS [StartTaskContactResponse]
readsPrec :: Int -> ReadS StartTaskContactResponse
$creadsPrec :: Int -> ReadS StartTaskContactResponse
Prelude.Read, Int -> StartTaskContactResponse -> ShowS
[StartTaskContactResponse] -> ShowS
StartTaskContactResponse -> String
(Int -> StartTaskContactResponse -> ShowS)
-> (StartTaskContactResponse -> String)
-> ([StartTaskContactResponse] -> ShowS)
-> Show StartTaskContactResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StartTaskContactResponse] -> ShowS
$cshowList :: [StartTaskContactResponse] -> ShowS
show :: StartTaskContactResponse -> String
$cshow :: StartTaskContactResponse -> String
showsPrec :: Int -> StartTaskContactResponse -> ShowS
$cshowsPrec :: Int -> StartTaskContactResponse -> ShowS
Prelude.Show, (forall x.
 StartTaskContactResponse -> Rep StartTaskContactResponse x)
-> (forall x.
    Rep StartTaskContactResponse x -> StartTaskContactResponse)
-> Generic StartTaskContactResponse
forall x.
Rep StartTaskContactResponse x -> StartTaskContactResponse
forall x.
StartTaskContactResponse -> Rep StartTaskContactResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep StartTaskContactResponse x -> StartTaskContactResponse
$cfrom :: forall x.
StartTaskContactResponse -> Rep StartTaskContactResponse x
Prelude.Generic)

-- |
-- Create a value of 'StartTaskContactResponse' 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:
--
-- 'contactId', 'startTaskContactResponse_contactId' - The identifier of this contact within the Amazon Connect instance.
--
-- 'httpStatus', 'startTaskContactResponse_httpStatus' - The response's http status code.
newStartTaskContactResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  StartTaskContactResponse
newStartTaskContactResponse :: Int -> StartTaskContactResponse
newStartTaskContactResponse Int
pHttpStatus_ =
  StartTaskContactResponse' :: Maybe Text -> Int -> StartTaskContactResponse
StartTaskContactResponse'
    { $sel:contactId:StartTaskContactResponse' :: Maybe Text
contactId =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:StartTaskContactResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The identifier of this contact within the Amazon Connect instance.
startTaskContactResponse_contactId :: Lens.Lens' StartTaskContactResponse (Prelude.Maybe Prelude.Text)
startTaskContactResponse_contactId :: (Maybe Text -> f (Maybe Text))
-> StartTaskContactResponse -> f StartTaskContactResponse
startTaskContactResponse_contactId = (StartTaskContactResponse -> Maybe Text)
-> (StartTaskContactResponse
    -> Maybe Text -> StartTaskContactResponse)
-> Lens
     StartTaskContactResponse
     StartTaskContactResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartTaskContactResponse' {Maybe Text
contactId :: Maybe Text
$sel:contactId:StartTaskContactResponse' :: StartTaskContactResponse -> Maybe Text
contactId} -> Maybe Text
contactId) (\s :: StartTaskContactResponse
s@StartTaskContactResponse' {} Maybe Text
a -> StartTaskContactResponse
s {$sel:contactId:StartTaskContactResponse' :: Maybe Text
contactId = Maybe Text
a} :: StartTaskContactResponse)

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

instance Prelude.NFData StartTaskContactResponse