{-# 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.ListChannelMembershipsForAppInstanceUser
-- 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)
--
-- Lists all channels that a particular @AppInstanceUser@ is a part of.
-- Only an @AppInstanceAdmin@ can call the API with a user ARN that is not
-- their own.
--
-- 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.ListChannelMembershipsForAppInstanceUser
  ( -- * Creating a Request
    ListChannelMembershipsForAppInstanceUser (..),
    newListChannelMembershipsForAppInstanceUser,

    -- * Request Lenses
    listChannelMembershipsForAppInstanceUser_appInstanceUserArn,
    listChannelMembershipsForAppInstanceUser_chimeBearer,
    listChannelMembershipsForAppInstanceUser_nextToken,
    listChannelMembershipsForAppInstanceUser_maxResults,

    -- * Destructuring the Response
    ListChannelMembershipsForAppInstanceUserResponse (..),
    newListChannelMembershipsForAppInstanceUserResponse,

    -- * Response Lenses
    listChannelMembershipsForAppInstanceUserResponse_channelMemberships,
    listChannelMembershipsForAppInstanceUserResponse_nextToken,
    listChannelMembershipsForAppInstanceUserResponse_httpStatus,
  )
where

import Amazonka.Chime.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:/ 'newListChannelMembershipsForAppInstanceUser' smart constructor.
data ListChannelMembershipsForAppInstanceUser = ListChannelMembershipsForAppInstanceUser'
  { -- | The ARN of the @AppInstanceUser@s
    ListChannelMembershipsForAppInstanceUser -> Maybe Text
appInstanceUserArn :: Prelude.Maybe Prelude.Text,
    -- | The @AppInstanceUserArn@ of the user that makes the API call.
    ListChannelMembershipsForAppInstanceUser -> Maybe Text
chimeBearer :: Prelude.Maybe Prelude.Text,
    -- | The token returned from previous API requests until the number of
    -- channel memberships is reached.
    ListChannelMembershipsForAppInstanceUser -> Maybe (Sensitive Text)
nextToken :: Prelude.Maybe (Core.Sensitive Prelude.Text),
    -- | The maximum number of users that you want returned.
    ListChannelMembershipsForAppInstanceUser -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural
  }
  deriving (ListChannelMembershipsForAppInstanceUser
-> ListChannelMembershipsForAppInstanceUser -> Bool
(ListChannelMembershipsForAppInstanceUser
 -> ListChannelMembershipsForAppInstanceUser -> Bool)
-> (ListChannelMembershipsForAppInstanceUser
    -> ListChannelMembershipsForAppInstanceUser -> Bool)
-> Eq ListChannelMembershipsForAppInstanceUser
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListChannelMembershipsForAppInstanceUser
-> ListChannelMembershipsForAppInstanceUser -> Bool
$c/= :: ListChannelMembershipsForAppInstanceUser
-> ListChannelMembershipsForAppInstanceUser -> Bool
== :: ListChannelMembershipsForAppInstanceUser
-> ListChannelMembershipsForAppInstanceUser -> Bool
$c== :: ListChannelMembershipsForAppInstanceUser
-> ListChannelMembershipsForAppInstanceUser -> Bool
Prelude.Eq, Int -> ListChannelMembershipsForAppInstanceUser -> ShowS
[ListChannelMembershipsForAppInstanceUser] -> ShowS
ListChannelMembershipsForAppInstanceUser -> String
(Int -> ListChannelMembershipsForAppInstanceUser -> ShowS)
-> (ListChannelMembershipsForAppInstanceUser -> String)
-> ([ListChannelMembershipsForAppInstanceUser] -> ShowS)
-> Show ListChannelMembershipsForAppInstanceUser
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListChannelMembershipsForAppInstanceUser] -> ShowS
$cshowList :: [ListChannelMembershipsForAppInstanceUser] -> ShowS
show :: ListChannelMembershipsForAppInstanceUser -> String
$cshow :: ListChannelMembershipsForAppInstanceUser -> String
showsPrec :: Int -> ListChannelMembershipsForAppInstanceUser -> ShowS
$cshowsPrec :: Int -> ListChannelMembershipsForAppInstanceUser -> ShowS
Prelude.Show, (forall x.
 ListChannelMembershipsForAppInstanceUser
 -> Rep ListChannelMembershipsForAppInstanceUser x)
-> (forall x.
    Rep ListChannelMembershipsForAppInstanceUser x
    -> ListChannelMembershipsForAppInstanceUser)
-> Generic ListChannelMembershipsForAppInstanceUser
forall x.
Rep ListChannelMembershipsForAppInstanceUser x
-> ListChannelMembershipsForAppInstanceUser
forall x.
ListChannelMembershipsForAppInstanceUser
-> Rep ListChannelMembershipsForAppInstanceUser x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListChannelMembershipsForAppInstanceUser x
-> ListChannelMembershipsForAppInstanceUser
$cfrom :: forall x.
ListChannelMembershipsForAppInstanceUser
-> Rep ListChannelMembershipsForAppInstanceUser x
Prelude.Generic)

-- |
-- Create a value of 'ListChannelMembershipsForAppInstanceUser' 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:
--
-- 'appInstanceUserArn', 'listChannelMembershipsForAppInstanceUser_appInstanceUserArn' - The ARN of the @AppInstanceUser@s
--
-- 'chimeBearer', 'listChannelMembershipsForAppInstanceUser_chimeBearer' - The @AppInstanceUserArn@ of the user that makes the API call.
--
-- 'nextToken', 'listChannelMembershipsForAppInstanceUser_nextToken' - The token returned from previous API requests until the number of
-- channel memberships is reached.
--
-- 'maxResults', 'listChannelMembershipsForAppInstanceUser_maxResults' - The maximum number of users that you want returned.
newListChannelMembershipsForAppInstanceUser ::
  ListChannelMembershipsForAppInstanceUser
newListChannelMembershipsForAppInstanceUser :: ListChannelMembershipsForAppInstanceUser
newListChannelMembershipsForAppInstanceUser =
  ListChannelMembershipsForAppInstanceUser' :: Maybe Text
-> Maybe Text
-> Maybe (Sensitive Text)
-> Maybe Natural
-> ListChannelMembershipsForAppInstanceUser
ListChannelMembershipsForAppInstanceUser'
    { $sel:appInstanceUserArn:ListChannelMembershipsForAppInstanceUser' :: Maybe Text
appInstanceUserArn =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:chimeBearer:ListChannelMembershipsForAppInstanceUser' :: Maybe Text
chimeBearer = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListChannelMembershipsForAppInstanceUser' :: Maybe (Sensitive Text)
nextToken = Maybe (Sensitive Text)
forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:ListChannelMembershipsForAppInstanceUser' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing
    }

-- | The ARN of the @AppInstanceUser@s
listChannelMembershipsForAppInstanceUser_appInstanceUserArn :: Lens.Lens' ListChannelMembershipsForAppInstanceUser (Prelude.Maybe Prelude.Text)
listChannelMembershipsForAppInstanceUser_appInstanceUserArn :: (Maybe Text -> f (Maybe Text))
-> ListChannelMembershipsForAppInstanceUser
-> f ListChannelMembershipsForAppInstanceUser
listChannelMembershipsForAppInstanceUser_appInstanceUserArn = (ListChannelMembershipsForAppInstanceUser -> Maybe Text)
-> (ListChannelMembershipsForAppInstanceUser
    -> Maybe Text -> ListChannelMembershipsForAppInstanceUser)
-> Lens
     ListChannelMembershipsForAppInstanceUser
     ListChannelMembershipsForAppInstanceUser
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListChannelMembershipsForAppInstanceUser' {Maybe Text
appInstanceUserArn :: Maybe Text
$sel:appInstanceUserArn:ListChannelMembershipsForAppInstanceUser' :: ListChannelMembershipsForAppInstanceUser -> Maybe Text
appInstanceUserArn} -> Maybe Text
appInstanceUserArn) (\s :: ListChannelMembershipsForAppInstanceUser
s@ListChannelMembershipsForAppInstanceUser' {} Maybe Text
a -> ListChannelMembershipsForAppInstanceUser
s {$sel:appInstanceUserArn:ListChannelMembershipsForAppInstanceUser' :: Maybe Text
appInstanceUserArn = Maybe Text
a} :: ListChannelMembershipsForAppInstanceUser)

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

-- | The token returned from previous API requests until the number of
-- channel memberships is reached.
listChannelMembershipsForAppInstanceUser_nextToken :: Lens.Lens' ListChannelMembershipsForAppInstanceUser (Prelude.Maybe Prelude.Text)
listChannelMembershipsForAppInstanceUser_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListChannelMembershipsForAppInstanceUser
-> f ListChannelMembershipsForAppInstanceUser
listChannelMembershipsForAppInstanceUser_nextToken = (ListChannelMembershipsForAppInstanceUser
 -> Maybe (Sensitive Text))
-> (ListChannelMembershipsForAppInstanceUser
    -> Maybe (Sensitive Text)
    -> ListChannelMembershipsForAppInstanceUser)
-> Lens
     ListChannelMembershipsForAppInstanceUser
     ListChannelMembershipsForAppInstanceUser
     (Maybe (Sensitive Text))
     (Maybe (Sensitive Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListChannelMembershipsForAppInstanceUser' {Maybe (Sensitive Text)
nextToken :: Maybe (Sensitive Text)
$sel:nextToken:ListChannelMembershipsForAppInstanceUser' :: ListChannelMembershipsForAppInstanceUser -> Maybe (Sensitive Text)
nextToken} -> Maybe (Sensitive Text)
nextToken) (\s :: ListChannelMembershipsForAppInstanceUser
s@ListChannelMembershipsForAppInstanceUser' {} Maybe (Sensitive Text)
a -> ListChannelMembershipsForAppInstanceUser
s {$sel:nextToken:ListChannelMembershipsForAppInstanceUser' :: Maybe (Sensitive Text)
nextToken = Maybe (Sensitive Text)
a} :: ListChannelMembershipsForAppInstanceUser) ((Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
 -> ListChannelMembershipsForAppInstanceUser
 -> f ListChannelMembershipsForAppInstanceUser)
-> ((Maybe Text -> f (Maybe Text))
    -> Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
-> (Maybe Text -> f (Maybe Text))
-> ListChannelMembershipsForAppInstanceUser
-> f ListChannelMembershipsForAppInstanceUser
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 maximum number of users that you want returned.
listChannelMembershipsForAppInstanceUser_maxResults :: Lens.Lens' ListChannelMembershipsForAppInstanceUser (Prelude.Maybe Prelude.Natural)
listChannelMembershipsForAppInstanceUser_maxResults :: (Maybe Natural -> f (Maybe Natural))
-> ListChannelMembershipsForAppInstanceUser
-> f ListChannelMembershipsForAppInstanceUser
listChannelMembershipsForAppInstanceUser_maxResults = (ListChannelMembershipsForAppInstanceUser -> Maybe Natural)
-> (ListChannelMembershipsForAppInstanceUser
    -> Maybe Natural -> ListChannelMembershipsForAppInstanceUser)
-> Lens
     ListChannelMembershipsForAppInstanceUser
     ListChannelMembershipsForAppInstanceUser
     (Maybe Natural)
     (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListChannelMembershipsForAppInstanceUser' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListChannelMembershipsForAppInstanceUser' :: ListChannelMembershipsForAppInstanceUser -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListChannelMembershipsForAppInstanceUser
s@ListChannelMembershipsForAppInstanceUser' {} Maybe Natural
a -> ListChannelMembershipsForAppInstanceUser
s {$sel:maxResults:ListChannelMembershipsForAppInstanceUser' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListChannelMembershipsForAppInstanceUser)

instance
  Core.AWSRequest
    ListChannelMembershipsForAppInstanceUser
  where
  type
    AWSResponse
      ListChannelMembershipsForAppInstanceUser =
      ListChannelMembershipsForAppInstanceUserResponse
  request :: ListChannelMembershipsForAppInstanceUser
-> Request ListChannelMembershipsForAppInstanceUser
request = Service
-> ListChannelMembershipsForAppInstanceUser
-> Request ListChannelMembershipsForAppInstanceUser
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
  response :: Logger
-> Service
-> Proxy ListChannelMembershipsForAppInstanceUser
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse
           (AWSResponse ListChannelMembershipsForAppInstanceUser)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either
      String (AWSResponse ListChannelMembershipsForAppInstanceUser))
-> Logger
-> Service
-> Proxy ListChannelMembershipsForAppInstanceUser
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse
           (AWSResponse ListChannelMembershipsForAppInstanceUser)))
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 [ChannelMembershipForAppInstanceUserSummary]
-> Maybe (Sensitive Text)
-> Int
-> ListChannelMembershipsForAppInstanceUserResponse
ListChannelMembershipsForAppInstanceUserResponse'
            (Maybe [ChannelMembershipForAppInstanceUserSummary]
 -> Maybe (Sensitive Text)
 -> Int
 -> ListChannelMembershipsForAppInstanceUserResponse)
-> Either
     String (Maybe [ChannelMembershipForAppInstanceUserSummary])
-> Either
     String
     (Maybe (Sensitive Text)
      -> Int -> ListChannelMembershipsForAppInstanceUserResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( Object
x Object
-> Text
-> Either
     String (Maybe (Maybe [ChannelMembershipForAppInstanceUserSummary]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"ChannelMemberships"
                            Either
  String (Maybe (Maybe [ChannelMembershipForAppInstanceUserSummary]))
-> Maybe [ChannelMembershipForAppInstanceUserSummary]
-> Either
     String (Maybe [ChannelMembershipForAppInstanceUserSummary])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [ChannelMembershipForAppInstanceUserSummary]
forall a. Monoid a => a
Prelude.mempty
                        )
              Either
  String
  (Maybe (Sensitive Text)
   -> Int -> ListChannelMembershipsForAppInstanceUserResponse)
-> Either String (Maybe (Sensitive Text))
-> Either
     String (Int -> ListChannelMembershipsForAppInstanceUserResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe (Sensitive Text))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"NextToken")
              Either
  String (Int -> ListChannelMembershipsForAppInstanceUserResponse)
-> Either String Int
-> Either String ListChannelMembershipsForAppInstanceUserResponse
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
    ListChannelMembershipsForAppInstanceUser

instance
  Prelude.NFData
    ListChannelMembershipsForAppInstanceUser

instance
  Core.ToHeaders
    ListChannelMembershipsForAppInstanceUser
  where
  toHeaders :: ListChannelMembershipsForAppInstanceUser -> ResponseHeaders
toHeaders
    ListChannelMembershipsForAppInstanceUser' {Maybe Natural
Maybe Text
Maybe (Sensitive Text)
maxResults :: Maybe Natural
nextToken :: Maybe (Sensitive Text)
chimeBearer :: Maybe Text
appInstanceUserArn :: Maybe Text
$sel:maxResults:ListChannelMembershipsForAppInstanceUser' :: ListChannelMembershipsForAppInstanceUser -> Maybe Natural
$sel:nextToken:ListChannelMembershipsForAppInstanceUser' :: ListChannelMembershipsForAppInstanceUser -> Maybe (Sensitive Text)
$sel:chimeBearer:ListChannelMembershipsForAppInstanceUser' :: ListChannelMembershipsForAppInstanceUser -> Maybe Text
$sel:appInstanceUserArn:ListChannelMembershipsForAppInstanceUser' :: ListChannelMembershipsForAppInstanceUser -> Maybe Text
..} =
      [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
        [HeaderName
"x-amz-chime-bearer" HeaderName -> Maybe Text -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# Maybe Text
chimeBearer]

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

instance
  Core.ToQuery
    ListChannelMembershipsForAppInstanceUser
  where
  toQuery :: ListChannelMembershipsForAppInstanceUser -> QueryString
toQuery ListChannelMembershipsForAppInstanceUser' {Maybe Natural
Maybe Text
Maybe (Sensitive Text)
maxResults :: Maybe Natural
nextToken :: Maybe (Sensitive Text)
chimeBearer :: Maybe Text
appInstanceUserArn :: Maybe Text
$sel:maxResults:ListChannelMembershipsForAppInstanceUser' :: ListChannelMembershipsForAppInstanceUser -> Maybe Natural
$sel:nextToken:ListChannelMembershipsForAppInstanceUser' :: ListChannelMembershipsForAppInstanceUser -> Maybe (Sensitive Text)
$sel:chimeBearer:ListChannelMembershipsForAppInstanceUser' :: ListChannelMembershipsForAppInstanceUser -> Maybe Text
$sel:appInstanceUserArn:ListChannelMembershipsForAppInstanceUser' :: ListChannelMembershipsForAppInstanceUser -> Maybe Text
..} =
    [QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"app-instance-user-arn" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
appInstanceUserArn,
        ByteString
"next-token" ByteString -> Maybe (Sensitive Text) -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe (Sensitive Text)
nextToken,
        ByteString
"max-results" ByteString -> Maybe Natural -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Natural
maxResults,
        QueryString
"scope=app-instance-user-memberships"
      ]

-- | /See:/ 'newListChannelMembershipsForAppInstanceUserResponse' smart constructor.
data ListChannelMembershipsForAppInstanceUserResponse = ListChannelMembershipsForAppInstanceUserResponse'
  { -- | The token passed by previous API calls until all requested users are
    -- returned.
    ListChannelMembershipsForAppInstanceUserResponse
-> Maybe [ChannelMembershipForAppInstanceUserSummary]
channelMemberships :: Prelude.Maybe [ChannelMembershipForAppInstanceUserSummary],
    -- | The token passed by previous API calls until all requested users are
    -- returned.
    ListChannelMembershipsForAppInstanceUserResponse
-> Maybe (Sensitive Text)
nextToken :: Prelude.Maybe (Core.Sensitive Prelude.Text),
    -- | The response's http status code.
    ListChannelMembershipsForAppInstanceUserResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (ListChannelMembershipsForAppInstanceUserResponse
-> ListChannelMembershipsForAppInstanceUserResponse -> Bool
(ListChannelMembershipsForAppInstanceUserResponse
 -> ListChannelMembershipsForAppInstanceUserResponse -> Bool)
-> (ListChannelMembershipsForAppInstanceUserResponse
    -> ListChannelMembershipsForAppInstanceUserResponse -> Bool)
-> Eq ListChannelMembershipsForAppInstanceUserResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListChannelMembershipsForAppInstanceUserResponse
-> ListChannelMembershipsForAppInstanceUserResponse -> Bool
$c/= :: ListChannelMembershipsForAppInstanceUserResponse
-> ListChannelMembershipsForAppInstanceUserResponse -> Bool
== :: ListChannelMembershipsForAppInstanceUserResponse
-> ListChannelMembershipsForAppInstanceUserResponse -> Bool
$c== :: ListChannelMembershipsForAppInstanceUserResponse
-> ListChannelMembershipsForAppInstanceUserResponse -> Bool
Prelude.Eq, Int -> ListChannelMembershipsForAppInstanceUserResponse -> ShowS
[ListChannelMembershipsForAppInstanceUserResponse] -> ShowS
ListChannelMembershipsForAppInstanceUserResponse -> String
(Int -> ListChannelMembershipsForAppInstanceUserResponse -> ShowS)
-> (ListChannelMembershipsForAppInstanceUserResponse -> String)
-> ([ListChannelMembershipsForAppInstanceUserResponse] -> ShowS)
-> Show ListChannelMembershipsForAppInstanceUserResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListChannelMembershipsForAppInstanceUserResponse] -> ShowS
$cshowList :: [ListChannelMembershipsForAppInstanceUserResponse] -> ShowS
show :: ListChannelMembershipsForAppInstanceUserResponse -> String
$cshow :: ListChannelMembershipsForAppInstanceUserResponse -> String
showsPrec :: Int -> ListChannelMembershipsForAppInstanceUserResponse -> ShowS
$cshowsPrec :: Int -> ListChannelMembershipsForAppInstanceUserResponse -> ShowS
Prelude.Show, (forall x.
 ListChannelMembershipsForAppInstanceUserResponse
 -> Rep ListChannelMembershipsForAppInstanceUserResponse x)
-> (forall x.
    Rep ListChannelMembershipsForAppInstanceUserResponse x
    -> ListChannelMembershipsForAppInstanceUserResponse)
-> Generic ListChannelMembershipsForAppInstanceUserResponse
forall x.
Rep ListChannelMembershipsForAppInstanceUserResponse x
-> ListChannelMembershipsForAppInstanceUserResponse
forall x.
ListChannelMembershipsForAppInstanceUserResponse
-> Rep ListChannelMembershipsForAppInstanceUserResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListChannelMembershipsForAppInstanceUserResponse x
-> ListChannelMembershipsForAppInstanceUserResponse
$cfrom :: forall x.
ListChannelMembershipsForAppInstanceUserResponse
-> Rep ListChannelMembershipsForAppInstanceUserResponse x
Prelude.Generic)

-- |
-- Create a value of 'ListChannelMembershipsForAppInstanceUserResponse' 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:
--
-- 'channelMemberships', 'listChannelMembershipsForAppInstanceUserResponse_channelMemberships' - The token passed by previous API calls until all requested users are
-- returned.
--
-- 'nextToken', 'listChannelMembershipsForAppInstanceUserResponse_nextToken' - The token passed by previous API calls until all requested users are
-- returned.
--
-- 'httpStatus', 'listChannelMembershipsForAppInstanceUserResponse_httpStatus' - The response's http status code.
newListChannelMembershipsForAppInstanceUserResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListChannelMembershipsForAppInstanceUserResponse
newListChannelMembershipsForAppInstanceUserResponse :: Int -> ListChannelMembershipsForAppInstanceUserResponse
newListChannelMembershipsForAppInstanceUserResponse
  Int
pHttpStatus_ =
    ListChannelMembershipsForAppInstanceUserResponse' :: Maybe [ChannelMembershipForAppInstanceUserSummary]
-> Maybe (Sensitive Text)
-> Int
-> ListChannelMembershipsForAppInstanceUserResponse
ListChannelMembershipsForAppInstanceUserResponse'
      { $sel:channelMemberships:ListChannelMembershipsForAppInstanceUserResponse' :: Maybe [ChannelMembershipForAppInstanceUserSummary]
channelMemberships =
          Maybe [ChannelMembershipForAppInstanceUserSummary]
forall a. Maybe a
Prelude.Nothing,
        $sel:nextToken:ListChannelMembershipsForAppInstanceUserResponse' :: Maybe (Sensitive Text)
nextToken =
          Maybe (Sensitive Text)
forall a. Maybe a
Prelude.Nothing,
        $sel:httpStatus:ListChannelMembershipsForAppInstanceUserResponse' :: Int
httpStatus = Int
pHttpStatus_
      }

-- | The token passed by previous API calls until all requested users are
-- returned.
listChannelMembershipsForAppInstanceUserResponse_channelMemberships :: Lens.Lens' ListChannelMembershipsForAppInstanceUserResponse (Prelude.Maybe [ChannelMembershipForAppInstanceUserSummary])
listChannelMembershipsForAppInstanceUserResponse_channelMemberships :: (Maybe [ChannelMembershipForAppInstanceUserSummary]
 -> f (Maybe [ChannelMembershipForAppInstanceUserSummary]))
-> ListChannelMembershipsForAppInstanceUserResponse
-> f ListChannelMembershipsForAppInstanceUserResponse
listChannelMembershipsForAppInstanceUserResponse_channelMemberships = (ListChannelMembershipsForAppInstanceUserResponse
 -> Maybe [ChannelMembershipForAppInstanceUserSummary])
-> (ListChannelMembershipsForAppInstanceUserResponse
    -> Maybe [ChannelMembershipForAppInstanceUserSummary]
    -> ListChannelMembershipsForAppInstanceUserResponse)
-> Lens
     ListChannelMembershipsForAppInstanceUserResponse
     ListChannelMembershipsForAppInstanceUserResponse
     (Maybe [ChannelMembershipForAppInstanceUserSummary])
     (Maybe [ChannelMembershipForAppInstanceUserSummary])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListChannelMembershipsForAppInstanceUserResponse' {Maybe [ChannelMembershipForAppInstanceUserSummary]
channelMemberships :: Maybe [ChannelMembershipForAppInstanceUserSummary]
$sel:channelMemberships:ListChannelMembershipsForAppInstanceUserResponse' :: ListChannelMembershipsForAppInstanceUserResponse
-> Maybe [ChannelMembershipForAppInstanceUserSummary]
channelMemberships} -> Maybe [ChannelMembershipForAppInstanceUserSummary]
channelMemberships) (\s :: ListChannelMembershipsForAppInstanceUserResponse
s@ListChannelMembershipsForAppInstanceUserResponse' {} Maybe [ChannelMembershipForAppInstanceUserSummary]
a -> ListChannelMembershipsForAppInstanceUserResponse
s {$sel:channelMemberships:ListChannelMembershipsForAppInstanceUserResponse' :: Maybe [ChannelMembershipForAppInstanceUserSummary]
channelMemberships = Maybe [ChannelMembershipForAppInstanceUserSummary]
a} :: ListChannelMembershipsForAppInstanceUserResponse) ((Maybe [ChannelMembershipForAppInstanceUserSummary]
  -> f (Maybe [ChannelMembershipForAppInstanceUserSummary]))
 -> ListChannelMembershipsForAppInstanceUserResponse
 -> f ListChannelMembershipsForAppInstanceUserResponse)
-> ((Maybe [ChannelMembershipForAppInstanceUserSummary]
     -> f (Maybe [ChannelMembershipForAppInstanceUserSummary]))
    -> Maybe [ChannelMembershipForAppInstanceUserSummary]
    -> f (Maybe [ChannelMembershipForAppInstanceUserSummary]))
-> (Maybe [ChannelMembershipForAppInstanceUserSummary]
    -> f (Maybe [ChannelMembershipForAppInstanceUserSummary]))
-> ListChannelMembershipsForAppInstanceUserResponse
-> f ListChannelMembershipsForAppInstanceUserResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [ChannelMembershipForAppInstanceUserSummary]
  [ChannelMembershipForAppInstanceUserSummary]
  [ChannelMembershipForAppInstanceUserSummary]
  [ChannelMembershipForAppInstanceUserSummary]
-> Iso
     (Maybe [ChannelMembershipForAppInstanceUserSummary])
     (Maybe [ChannelMembershipForAppInstanceUserSummary])
     (Maybe [ChannelMembershipForAppInstanceUserSummary])
     (Maybe [ChannelMembershipForAppInstanceUserSummary])
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
  [ChannelMembershipForAppInstanceUserSummary]
  [ChannelMembershipForAppInstanceUserSummary]
  [ChannelMembershipForAppInstanceUserSummary]
  [ChannelMembershipForAppInstanceUserSummary]
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 users are
-- returned.
listChannelMembershipsForAppInstanceUserResponse_nextToken :: Lens.Lens' ListChannelMembershipsForAppInstanceUserResponse (Prelude.Maybe Prelude.Text)
listChannelMembershipsForAppInstanceUserResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListChannelMembershipsForAppInstanceUserResponse
-> f ListChannelMembershipsForAppInstanceUserResponse
listChannelMembershipsForAppInstanceUserResponse_nextToken = (ListChannelMembershipsForAppInstanceUserResponse
 -> Maybe (Sensitive Text))
-> (ListChannelMembershipsForAppInstanceUserResponse
    -> Maybe (Sensitive Text)
    -> ListChannelMembershipsForAppInstanceUserResponse)
-> Lens
     ListChannelMembershipsForAppInstanceUserResponse
     ListChannelMembershipsForAppInstanceUserResponse
     (Maybe (Sensitive Text))
     (Maybe (Sensitive Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListChannelMembershipsForAppInstanceUserResponse' {Maybe (Sensitive Text)
nextToken :: Maybe (Sensitive Text)
$sel:nextToken:ListChannelMembershipsForAppInstanceUserResponse' :: ListChannelMembershipsForAppInstanceUserResponse
-> Maybe (Sensitive Text)
nextToken} -> Maybe (Sensitive Text)
nextToken) (\s :: ListChannelMembershipsForAppInstanceUserResponse
s@ListChannelMembershipsForAppInstanceUserResponse' {} Maybe (Sensitive Text)
a -> ListChannelMembershipsForAppInstanceUserResponse
s {$sel:nextToken:ListChannelMembershipsForAppInstanceUserResponse' :: Maybe (Sensitive Text)
nextToken = Maybe (Sensitive Text)
a} :: ListChannelMembershipsForAppInstanceUserResponse) ((Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
 -> ListChannelMembershipsForAppInstanceUserResponse
 -> f ListChannelMembershipsForAppInstanceUserResponse)
-> ((Maybe Text -> f (Maybe Text))
    -> Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
-> (Maybe Text -> f (Maybe Text))
-> ListChannelMembershipsForAppInstanceUserResponse
-> f ListChannelMembershipsForAppInstanceUserResponse
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 response's http status code.
listChannelMembershipsForAppInstanceUserResponse_httpStatus :: Lens.Lens' ListChannelMembershipsForAppInstanceUserResponse Prelude.Int
listChannelMembershipsForAppInstanceUserResponse_httpStatus :: (Int -> f Int)
-> ListChannelMembershipsForAppInstanceUserResponse
-> f ListChannelMembershipsForAppInstanceUserResponse
listChannelMembershipsForAppInstanceUserResponse_httpStatus = (ListChannelMembershipsForAppInstanceUserResponse -> Int)
-> (ListChannelMembershipsForAppInstanceUserResponse
    -> Int -> ListChannelMembershipsForAppInstanceUserResponse)
-> Lens
     ListChannelMembershipsForAppInstanceUserResponse
     ListChannelMembershipsForAppInstanceUserResponse
     Int
     Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListChannelMembershipsForAppInstanceUserResponse' {Int
httpStatus :: Int
$sel:httpStatus:ListChannelMembershipsForAppInstanceUserResponse' :: ListChannelMembershipsForAppInstanceUserResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ListChannelMembershipsForAppInstanceUserResponse
s@ListChannelMembershipsForAppInstanceUserResponse' {} Int
a -> ListChannelMembershipsForAppInstanceUserResponse
s {$sel:httpStatus:ListChannelMembershipsForAppInstanceUserResponse' :: Int
httpStatus = Int
a} :: ListChannelMembershipsForAppInstanceUserResponse)

instance
  Prelude.NFData
    ListChannelMembershipsForAppInstanceUserResponse