{-# 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.AlexaBusiness.CreateContact
-- 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)
--
-- Creates a contact with the specified details.
module Amazonka.AlexaBusiness.CreateContact
  ( -- * Creating a Request
    CreateContact (..),
    newCreateContact,

    -- * Request Lenses
    createContact_lastName,
    createContact_phoneNumbers,
    createContact_phoneNumber,
    createContact_sipAddresses,
    createContact_displayName,
    createContact_clientRequestToken,
    createContact_tags,
    createContact_firstName,

    -- * Destructuring the Response
    CreateContactResponse (..),
    newCreateContactResponse,

    -- * Response Lenses
    createContactResponse_contactArn,
    createContactResponse_httpStatus,
  )
where

import Amazonka.AlexaBusiness.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:/ 'newCreateContact' smart constructor.
data CreateContact = CreateContact'
  { -- | The last name of the contact that is used to call the contact on the
    -- device.
    CreateContact -> Maybe Text
lastName :: Prelude.Maybe Prelude.Text,
    -- | The list of phone numbers for the contact.
    CreateContact -> Maybe [PhoneNumber]
phoneNumbers :: Prelude.Maybe [PhoneNumber],
    -- | The phone number of the contact in E.164 format. The phone number type
    -- defaults to WORK. You can specify PhoneNumber or PhoneNumbers. We
    -- recommend that you use PhoneNumbers, which lets you specify the phone
    -- number type and multiple numbers.
    CreateContact -> Maybe (Sensitive Text)
phoneNumber :: Prelude.Maybe (Core.Sensitive Prelude.Text),
    -- | The list of SIP addresses for the contact.
    CreateContact -> Maybe [SipAddress]
sipAddresses :: Prelude.Maybe [SipAddress],
    -- | The name of the contact to display on the console.
    CreateContact -> Maybe Text
displayName :: Prelude.Maybe Prelude.Text,
    -- | A unique, user-specified identifier for this request that ensures
    -- idempotency.
    CreateContact -> Maybe Text
clientRequestToken :: Prelude.Maybe Prelude.Text,
    -- | The tags to be added to the specified resource. Do not provide system
    -- tags.
    CreateContact -> Maybe [Tag]
tags :: Prelude.Maybe [Tag],
    -- | The first name of the contact that is used to call the contact on the
    -- device.
    CreateContact -> Text
firstName :: Prelude.Text
  }
  deriving (CreateContact -> CreateContact -> Bool
(CreateContact -> CreateContact -> Bool)
-> (CreateContact -> CreateContact -> Bool) -> Eq CreateContact
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateContact -> CreateContact -> Bool
$c/= :: CreateContact -> CreateContact -> Bool
== :: CreateContact -> CreateContact -> Bool
$c== :: CreateContact -> CreateContact -> Bool
Prelude.Eq, Int -> CreateContact -> ShowS
[CreateContact] -> ShowS
CreateContact -> String
(Int -> CreateContact -> ShowS)
-> (CreateContact -> String)
-> ([CreateContact] -> ShowS)
-> Show CreateContact
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateContact] -> ShowS
$cshowList :: [CreateContact] -> ShowS
show :: CreateContact -> String
$cshow :: CreateContact -> String
showsPrec :: Int -> CreateContact -> ShowS
$cshowsPrec :: Int -> CreateContact -> ShowS
Prelude.Show, (forall x. CreateContact -> Rep CreateContact x)
-> (forall x. Rep CreateContact x -> CreateContact)
-> Generic CreateContact
forall x. Rep CreateContact x -> CreateContact
forall x. CreateContact -> Rep CreateContact x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateContact x -> CreateContact
$cfrom :: forall x. CreateContact -> Rep CreateContact x
Prelude.Generic)

-- |
-- Create a value of 'CreateContact' 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:
--
-- 'lastName', 'createContact_lastName' - The last name of the contact that is used to call the contact on the
-- device.
--
-- 'phoneNumbers', 'createContact_phoneNumbers' - The list of phone numbers for the contact.
--
-- 'phoneNumber', 'createContact_phoneNumber' - The phone number of the contact in E.164 format. The phone number type
-- defaults to WORK. You can specify PhoneNumber or PhoneNumbers. We
-- recommend that you use PhoneNumbers, which lets you specify the phone
-- number type and multiple numbers.
--
-- 'sipAddresses', 'createContact_sipAddresses' - The list of SIP addresses for the contact.
--
-- 'displayName', 'createContact_displayName' - The name of the contact to display on the console.
--
-- 'clientRequestToken', 'createContact_clientRequestToken' - A unique, user-specified identifier for this request that ensures
-- idempotency.
--
-- 'tags', 'createContact_tags' - The tags to be added to the specified resource. Do not provide system
-- tags.
--
-- 'firstName', 'createContact_firstName' - The first name of the contact that is used to call the contact on the
-- device.
newCreateContact ::
  -- | 'firstName'
  Prelude.Text ->
  CreateContact
newCreateContact :: Text -> CreateContact
newCreateContact Text
pFirstName_ =
  CreateContact' :: Maybe Text
-> Maybe [PhoneNumber]
-> Maybe (Sensitive Text)
-> Maybe [SipAddress]
-> Maybe Text
-> Maybe Text
-> Maybe [Tag]
-> Text
-> CreateContact
CreateContact'
    { $sel:lastName:CreateContact' :: Maybe Text
lastName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:phoneNumbers:CreateContact' :: Maybe [PhoneNumber]
phoneNumbers = Maybe [PhoneNumber]
forall a. Maybe a
Prelude.Nothing,
      $sel:phoneNumber:CreateContact' :: Maybe (Sensitive Text)
phoneNumber = Maybe (Sensitive Text)
forall a. Maybe a
Prelude.Nothing,
      $sel:sipAddresses:CreateContact' :: Maybe [SipAddress]
sipAddresses = Maybe [SipAddress]
forall a. Maybe a
Prelude.Nothing,
      $sel:displayName:CreateContact' :: Maybe Text
displayName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:clientRequestToken:CreateContact' :: Maybe Text
clientRequestToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:tags:CreateContact' :: Maybe [Tag]
tags = Maybe [Tag]
forall a. Maybe a
Prelude.Nothing,
      $sel:firstName:CreateContact' :: Text
firstName = Text
pFirstName_
    }

-- | The last name of the contact that is used to call the contact on the
-- device.
createContact_lastName :: Lens.Lens' CreateContact (Prelude.Maybe Prelude.Text)
createContact_lastName :: (Maybe Text -> f (Maybe Text)) -> CreateContact -> f CreateContact
createContact_lastName = (CreateContact -> Maybe Text)
-> (CreateContact -> Maybe Text -> CreateContact)
-> Lens CreateContact CreateContact (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateContact' {Maybe Text
lastName :: Maybe Text
$sel:lastName:CreateContact' :: CreateContact -> Maybe Text
lastName} -> Maybe Text
lastName) (\s :: CreateContact
s@CreateContact' {} Maybe Text
a -> CreateContact
s {$sel:lastName:CreateContact' :: Maybe Text
lastName = Maybe Text
a} :: CreateContact)

-- | The list of phone numbers for the contact.
createContact_phoneNumbers :: Lens.Lens' CreateContact (Prelude.Maybe [PhoneNumber])
createContact_phoneNumbers :: (Maybe [PhoneNumber] -> f (Maybe [PhoneNumber]))
-> CreateContact -> f CreateContact
createContact_phoneNumbers = (CreateContact -> Maybe [PhoneNumber])
-> (CreateContact -> Maybe [PhoneNumber] -> CreateContact)
-> Lens
     CreateContact
     CreateContact
     (Maybe [PhoneNumber])
     (Maybe [PhoneNumber])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateContact' {Maybe [PhoneNumber]
phoneNumbers :: Maybe [PhoneNumber]
$sel:phoneNumbers:CreateContact' :: CreateContact -> Maybe [PhoneNumber]
phoneNumbers} -> Maybe [PhoneNumber]
phoneNumbers) (\s :: CreateContact
s@CreateContact' {} Maybe [PhoneNumber]
a -> CreateContact
s {$sel:phoneNumbers:CreateContact' :: Maybe [PhoneNumber]
phoneNumbers = Maybe [PhoneNumber]
a} :: CreateContact) ((Maybe [PhoneNumber] -> f (Maybe [PhoneNumber]))
 -> CreateContact -> f CreateContact)
-> ((Maybe [PhoneNumber] -> f (Maybe [PhoneNumber]))
    -> Maybe [PhoneNumber] -> f (Maybe [PhoneNumber]))
-> (Maybe [PhoneNumber] -> f (Maybe [PhoneNumber]))
-> CreateContact
-> f CreateContact
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [PhoneNumber] [PhoneNumber] [PhoneNumber] [PhoneNumber]
-> Iso
     (Maybe [PhoneNumber])
     (Maybe [PhoneNumber])
     (Maybe [PhoneNumber])
     (Maybe [PhoneNumber])
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 [PhoneNumber] [PhoneNumber] [PhoneNumber] [PhoneNumber]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The phone number of the contact in E.164 format. The phone number type
-- defaults to WORK. You can specify PhoneNumber or PhoneNumbers. We
-- recommend that you use PhoneNumbers, which lets you specify the phone
-- number type and multiple numbers.
createContact_phoneNumber :: Lens.Lens' CreateContact (Prelude.Maybe Prelude.Text)
createContact_phoneNumber :: (Maybe Text -> f (Maybe Text)) -> CreateContact -> f CreateContact
createContact_phoneNumber = (CreateContact -> Maybe (Sensitive Text))
-> (CreateContact -> Maybe (Sensitive Text) -> CreateContact)
-> Lens
     CreateContact
     CreateContact
     (Maybe (Sensitive Text))
     (Maybe (Sensitive Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateContact' {Maybe (Sensitive Text)
phoneNumber :: Maybe (Sensitive Text)
$sel:phoneNumber:CreateContact' :: CreateContact -> Maybe (Sensitive Text)
phoneNumber} -> Maybe (Sensitive Text)
phoneNumber) (\s :: CreateContact
s@CreateContact' {} Maybe (Sensitive Text)
a -> CreateContact
s {$sel:phoneNumber:CreateContact' :: Maybe (Sensitive Text)
phoneNumber = Maybe (Sensitive Text)
a} :: CreateContact) ((Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
 -> CreateContact -> f CreateContact)
-> ((Maybe Text -> f (Maybe Text))
    -> Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
-> (Maybe Text -> f (Maybe Text))
-> CreateContact
-> f CreateContact
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso (Sensitive Text) (Sensitive Text) Text Text
-> Iso
     (Maybe (Sensitive Text))
     (Maybe (Sensitive Text))
     (Maybe Text)
     (Maybe 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 (Sensitive Text) (Sensitive Text) Text Text
forall a. Iso' (Sensitive a) a
Core._Sensitive

-- | The list of SIP addresses for the contact.
createContact_sipAddresses :: Lens.Lens' CreateContact (Prelude.Maybe [SipAddress])
createContact_sipAddresses :: (Maybe [SipAddress] -> f (Maybe [SipAddress]))
-> CreateContact -> f CreateContact
createContact_sipAddresses = (CreateContact -> Maybe [SipAddress])
-> (CreateContact -> Maybe [SipAddress] -> CreateContact)
-> Lens
     CreateContact
     CreateContact
     (Maybe [SipAddress])
     (Maybe [SipAddress])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateContact' {Maybe [SipAddress]
sipAddresses :: Maybe [SipAddress]
$sel:sipAddresses:CreateContact' :: CreateContact -> Maybe [SipAddress]
sipAddresses} -> Maybe [SipAddress]
sipAddresses) (\s :: CreateContact
s@CreateContact' {} Maybe [SipAddress]
a -> CreateContact
s {$sel:sipAddresses:CreateContact' :: Maybe [SipAddress]
sipAddresses = Maybe [SipAddress]
a} :: CreateContact) ((Maybe [SipAddress] -> f (Maybe [SipAddress]))
 -> CreateContact -> f CreateContact)
-> ((Maybe [SipAddress] -> f (Maybe [SipAddress]))
    -> Maybe [SipAddress] -> f (Maybe [SipAddress]))
-> (Maybe [SipAddress] -> f (Maybe [SipAddress]))
-> CreateContact
-> f CreateContact
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [SipAddress] [SipAddress] [SipAddress] [SipAddress]
-> Iso
     (Maybe [SipAddress])
     (Maybe [SipAddress])
     (Maybe [SipAddress])
     (Maybe [SipAddress])
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 [SipAddress] [SipAddress] [SipAddress] [SipAddress]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The name of the contact to display on the console.
createContact_displayName :: Lens.Lens' CreateContact (Prelude.Maybe Prelude.Text)
createContact_displayName :: (Maybe Text -> f (Maybe Text)) -> CreateContact -> f CreateContact
createContact_displayName = (CreateContact -> Maybe Text)
-> (CreateContact -> Maybe Text -> CreateContact)
-> Lens CreateContact CreateContact (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateContact' {Maybe Text
displayName :: Maybe Text
$sel:displayName:CreateContact' :: CreateContact -> Maybe Text
displayName} -> Maybe Text
displayName) (\s :: CreateContact
s@CreateContact' {} Maybe Text
a -> CreateContact
s {$sel:displayName:CreateContact' :: Maybe Text
displayName = Maybe Text
a} :: CreateContact)

-- | A unique, user-specified identifier for this request that ensures
-- idempotency.
createContact_clientRequestToken :: Lens.Lens' CreateContact (Prelude.Maybe Prelude.Text)
createContact_clientRequestToken :: (Maybe Text -> f (Maybe Text)) -> CreateContact -> f CreateContact
createContact_clientRequestToken = (CreateContact -> Maybe Text)
-> (CreateContact -> Maybe Text -> CreateContact)
-> Lens CreateContact CreateContact (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateContact' {Maybe Text
clientRequestToken :: Maybe Text
$sel:clientRequestToken:CreateContact' :: CreateContact -> Maybe Text
clientRequestToken} -> Maybe Text
clientRequestToken) (\s :: CreateContact
s@CreateContact' {} Maybe Text
a -> CreateContact
s {$sel:clientRequestToken:CreateContact' :: Maybe Text
clientRequestToken = Maybe Text
a} :: CreateContact)

-- | The tags to be added to the specified resource. Do not provide system
-- tags.
createContact_tags :: Lens.Lens' CreateContact (Prelude.Maybe [Tag])
createContact_tags :: (Maybe [Tag] -> f (Maybe [Tag]))
-> CreateContact -> f CreateContact
createContact_tags = (CreateContact -> Maybe [Tag])
-> (CreateContact -> Maybe [Tag] -> CreateContact)
-> Lens CreateContact CreateContact (Maybe [Tag]) (Maybe [Tag])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateContact' {Maybe [Tag]
tags :: Maybe [Tag]
$sel:tags:CreateContact' :: CreateContact -> Maybe [Tag]
tags} -> Maybe [Tag]
tags) (\s :: CreateContact
s@CreateContact' {} Maybe [Tag]
a -> CreateContact
s {$sel:tags:CreateContact' :: Maybe [Tag]
tags = Maybe [Tag]
a} :: CreateContact) ((Maybe [Tag] -> f (Maybe [Tag]))
 -> CreateContact -> f CreateContact)
-> ((Maybe [Tag] -> f (Maybe [Tag]))
    -> Maybe [Tag] -> f (Maybe [Tag]))
-> (Maybe [Tag] -> f (Maybe [Tag]))
-> CreateContact
-> f CreateContact
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Tag] [Tag] [Tag] [Tag]
-> Iso (Maybe [Tag]) (Maybe [Tag]) (Maybe [Tag]) (Maybe [Tag])
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 [Tag] [Tag] [Tag] [Tag]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The first name of the contact that is used to call the contact on the
-- device.
createContact_firstName :: Lens.Lens' CreateContact Prelude.Text
createContact_firstName :: (Text -> f Text) -> CreateContact -> f CreateContact
createContact_firstName = (CreateContact -> Text)
-> (CreateContact -> Text -> CreateContact)
-> Lens CreateContact CreateContact Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateContact' {Text
firstName :: Text
$sel:firstName:CreateContact' :: CreateContact -> Text
firstName} -> Text
firstName) (\s :: CreateContact
s@CreateContact' {} Text
a -> CreateContact
s {$sel:firstName:CreateContact' :: Text
firstName = Text
a} :: CreateContact)

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

instance Prelude.NFData CreateContact

instance Core.ToHeaders CreateContact where
  toHeaders :: CreateContact -> ResponseHeaders
toHeaders =
    ResponseHeaders -> CreateContact -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"AlexaForBusiness.CreateContact" ::
                          Prelude.ByteString
                      ),
            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 CreateContact where
  toJSON :: CreateContact -> Value
toJSON CreateContact' {Maybe [PhoneNumber]
Maybe [SipAddress]
Maybe [Tag]
Maybe Text
Maybe (Sensitive Text)
Text
firstName :: Text
tags :: Maybe [Tag]
clientRequestToken :: Maybe Text
displayName :: Maybe Text
sipAddresses :: Maybe [SipAddress]
phoneNumber :: Maybe (Sensitive Text)
phoneNumbers :: Maybe [PhoneNumber]
lastName :: Maybe Text
$sel:firstName:CreateContact' :: CreateContact -> Text
$sel:tags:CreateContact' :: CreateContact -> Maybe [Tag]
$sel:clientRequestToken:CreateContact' :: CreateContact -> Maybe Text
$sel:displayName:CreateContact' :: CreateContact -> Maybe Text
$sel:sipAddresses:CreateContact' :: CreateContact -> Maybe [SipAddress]
$sel:phoneNumber:CreateContact' :: CreateContact -> Maybe (Sensitive Text)
$sel:phoneNumbers:CreateContact' :: CreateContact -> Maybe [PhoneNumber]
$sel:lastName:CreateContact' :: CreateContact -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"LastName" 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
lastName,
            (Text
"PhoneNumbers" Text -> [PhoneNumber] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([PhoneNumber] -> Pair) -> Maybe [PhoneNumber] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [PhoneNumber]
phoneNumbers,
            (Text
"PhoneNumber" Text -> Sensitive Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Sensitive Text -> Pair) -> Maybe (Sensitive Text) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (Sensitive Text)
phoneNumber,
            (Text
"SipAddresses" Text -> [SipAddress] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([SipAddress] -> Pair) -> Maybe [SipAddress] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [SipAddress]
sipAddresses,
            (Text
"DisplayName" 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
displayName,
            (Text
"ClientRequestToken" 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
clientRequestToken,
            (Text
"Tags" Text -> [Tag] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([Tag] -> Pair) -> Maybe [Tag] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Tag]
tags,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"FirstName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
firstName)
          ]
      )

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

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

-- | /See:/ 'newCreateContactResponse' smart constructor.
data CreateContactResponse = CreateContactResponse'
  { -- | The ARN of the newly created address book.
    CreateContactResponse -> Maybe Text
contactArn :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    CreateContactResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (CreateContactResponse -> CreateContactResponse -> Bool
(CreateContactResponse -> CreateContactResponse -> Bool)
-> (CreateContactResponse -> CreateContactResponse -> Bool)
-> Eq CreateContactResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateContactResponse -> CreateContactResponse -> Bool
$c/= :: CreateContactResponse -> CreateContactResponse -> Bool
== :: CreateContactResponse -> CreateContactResponse -> Bool
$c== :: CreateContactResponse -> CreateContactResponse -> Bool
Prelude.Eq, ReadPrec [CreateContactResponse]
ReadPrec CreateContactResponse
Int -> ReadS CreateContactResponse
ReadS [CreateContactResponse]
(Int -> ReadS CreateContactResponse)
-> ReadS [CreateContactResponse]
-> ReadPrec CreateContactResponse
-> ReadPrec [CreateContactResponse]
-> Read CreateContactResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateContactResponse]
$creadListPrec :: ReadPrec [CreateContactResponse]
readPrec :: ReadPrec CreateContactResponse
$creadPrec :: ReadPrec CreateContactResponse
readList :: ReadS [CreateContactResponse]
$creadList :: ReadS [CreateContactResponse]
readsPrec :: Int -> ReadS CreateContactResponse
$creadsPrec :: Int -> ReadS CreateContactResponse
Prelude.Read, Int -> CreateContactResponse -> ShowS
[CreateContactResponse] -> ShowS
CreateContactResponse -> String
(Int -> CreateContactResponse -> ShowS)
-> (CreateContactResponse -> String)
-> ([CreateContactResponse] -> ShowS)
-> Show CreateContactResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateContactResponse] -> ShowS
$cshowList :: [CreateContactResponse] -> ShowS
show :: CreateContactResponse -> String
$cshow :: CreateContactResponse -> String
showsPrec :: Int -> CreateContactResponse -> ShowS
$cshowsPrec :: Int -> CreateContactResponse -> ShowS
Prelude.Show, (forall x. CreateContactResponse -> Rep CreateContactResponse x)
-> (forall x. Rep CreateContactResponse x -> CreateContactResponse)
-> Generic CreateContactResponse
forall x. Rep CreateContactResponse x -> CreateContactResponse
forall x. CreateContactResponse -> Rep CreateContactResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateContactResponse x -> CreateContactResponse
$cfrom :: forall x. CreateContactResponse -> Rep CreateContactResponse x
Prelude.Generic)

-- |
-- Create a value of 'CreateContactResponse' 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:
--
-- 'contactArn', 'createContactResponse_contactArn' - The ARN of the newly created address book.
--
-- 'httpStatus', 'createContactResponse_httpStatus' - The response's http status code.
newCreateContactResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  CreateContactResponse
newCreateContactResponse :: Int -> CreateContactResponse
newCreateContactResponse Int
pHttpStatus_ =
  CreateContactResponse' :: Maybe Text -> Int -> CreateContactResponse
CreateContactResponse'
    { $sel:contactArn:CreateContactResponse' :: Maybe Text
contactArn =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:CreateContactResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The ARN of the newly created address book.
createContactResponse_contactArn :: Lens.Lens' CreateContactResponse (Prelude.Maybe Prelude.Text)
createContactResponse_contactArn :: (Maybe Text -> f (Maybe Text))
-> CreateContactResponse -> f CreateContactResponse
createContactResponse_contactArn = (CreateContactResponse -> Maybe Text)
-> (CreateContactResponse -> Maybe Text -> CreateContactResponse)
-> Lens
     CreateContactResponse
     CreateContactResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateContactResponse' {Maybe Text
contactArn :: Maybe Text
$sel:contactArn:CreateContactResponse' :: CreateContactResponse -> Maybe Text
contactArn} -> Maybe Text
contactArn) (\s :: CreateContactResponse
s@CreateContactResponse' {} Maybe Text
a -> CreateContactResponse
s {$sel:contactArn:CreateContactResponse' :: Maybe Text
contactArn = Maybe Text
a} :: CreateContactResponse)

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

instance Prelude.NFData CreateContactResponse