{-# 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.Comprehend.ListSentimentDetectionJobs
-- 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)
--
-- Gets a list of sentiment detection jobs that you have submitted.
--
-- This operation returns paginated results.
module Amazonka.Comprehend.ListSentimentDetectionJobs
  ( -- * Creating a Request
    ListSentimentDetectionJobs (..),
    newListSentimentDetectionJobs,

    -- * Request Lenses
    listSentimentDetectionJobs_nextToken,
    listSentimentDetectionJobs_filter,
    listSentimentDetectionJobs_maxResults,

    -- * Destructuring the Response
    ListSentimentDetectionJobsResponse (..),
    newListSentimentDetectionJobsResponse,

    -- * Response Lenses
    listSentimentDetectionJobsResponse_nextToken,
    listSentimentDetectionJobsResponse_sentimentDetectionJobPropertiesList,
    listSentimentDetectionJobsResponse_httpStatus,
  )
where

import Amazonka.Comprehend.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:/ 'newListSentimentDetectionJobs' smart constructor.
data ListSentimentDetectionJobs = ListSentimentDetectionJobs'
  { -- | Identifies the next page of results to return.
    ListSentimentDetectionJobs -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | Filters the jobs that are returned. You can filter jobs on their name,
    -- status, or the date and time that they were submitted. You can only set
    -- one filter at a time.
    ListSentimentDetectionJobs -> Maybe SentimentDetectionJobFilter
filter' :: Prelude.Maybe SentimentDetectionJobFilter,
    -- | The maximum number of results to return in each page. The default is
    -- 100.
    ListSentimentDetectionJobs -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural
  }
  deriving (ListSentimentDetectionJobs -> ListSentimentDetectionJobs -> Bool
(ListSentimentDetectionJobs -> ListSentimentDetectionJobs -> Bool)
-> (ListSentimentDetectionJobs
    -> ListSentimentDetectionJobs -> Bool)
-> Eq ListSentimentDetectionJobs
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListSentimentDetectionJobs -> ListSentimentDetectionJobs -> Bool
$c/= :: ListSentimentDetectionJobs -> ListSentimentDetectionJobs -> Bool
== :: ListSentimentDetectionJobs -> ListSentimentDetectionJobs -> Bool
$c== :: ListSentimentDetectionJobs -> ListSentimentDetectionJobs -> Bool
Prelude.Eq, ReadPrec [ListSentimentDetectionJobs]
ReadPrec ListSentimentDetectionJobs
Int -> ReadS ListSentimentDetectionJobs
ReadS [ListSentimentDetectionJobs]
(Int -> ReadS ListSentimentDetectionJobs)
-> ReadS [ListSentimentDetectionJobs]
-> ReadPrec ListSentimentDetectionJobs
-> ReadPrec [ListSentimentDetectionJobs]
-> Read ListSentimentDetectionJobs
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListSentimentDetectionJobs]
$creadListPrec :: ReadPrec [ListSentimentDetectionJobs]
readPrec :: ReadPrec ListSentimentDetectionJobs
$creadPrec :: ReadPrec ListSentimentDetectionJobs
readList :: ReadS [ListSentimentDetectionJobs]
$creadList :: ReadS [ListSentimentDetectionJobs]
readsPrec :: Int -> ReadS ListSentimentDetectionJobs
$creadsPrec :: Int -> ReadS ListSentimentDetectionJobs
Prelude.Read, Int -> ListSentimentDetectionJobs -> ShowS
[ListSentimentDetectionJobs] -> ShowS
ListSentimentDetectionJobs -> String
(Int -> ListSentimentDetectionJobs -> ShowS)
-> (ListSentimentDetectionJobs -> String)
-> ([ListSentimentDetectionJobs] -> ShowS)
-> Show ListSentimentDetectionJobs
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListSentimentDetectionJobs] -> ShowS
$cshowList :: [ListSentimentDetectionJobs] -> ShowS
show :: ListSentimentDetectionJobs -> String
$cshow :: ListSentimentDetectionJobs -> String
showsPrec :: Int -> ListSentimentDetectionJobs -> ShowS
$cshowsPrec :: Int -> ListSentimentDetectionJobs -> ShowS
Prelude.Show, (forall x.
 ListSentimentDetectionJobs -> Rep ListSentimentDetectionJobs x)
-> (forall x.
    Rep ListSentimentDetectionJobs x -> ListSentimentDetectionJobs)
-> Generic ListSentimentDetectionJobs
forall x.
Rep ListSentimentDetectionJobs x -> ListSentimentDetectionJobs
forall x.
ListSentimentDetectionJobs -> Rep ListSentimentDetectionJobs x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListSentimentDetectionJobs x -> ListSentimentDetectionJobs
$cfrom :: forall x.
ListSentimentDetectionJobs -> Rep ListSentimentDetectionJobs x
Prelude.Generic)

-- |
-- Create a value of 'ListSentimentDetectionJobs' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'nextToken', 'listSentimentDetectionJobs_nextToken' - Identifies the next page of results to return.
--
-- 'filter'', 'listSentimentDetectionJobs_filter' - Filters the jobs that are returned. You can filter jobs on their name,
-- status, or the date and time that they were submitted. You can only set
-- one filter at a time.
--
-- 'maxResults', 'listSentimentDetectionJobs_maxResults' - The maximum number of results to return in each page. The default is
-- 100.
newListSentimentDetectionJobs ::
  ListSentimentDetectionJobs
newListSentimentDetectionJobs :: ListSentimentDetectionJobs
newListSentimentDetectionJobs =
  ListSentimentDetectionJobs' :: Maybe Text
-> Maybe SentimentDetectionJobFilter
-> Maybe Natural
-> ListSentimentDetectionJobs
ListSentimentDetectionJobs'
    { $sel:nextToken:ListSentimentDetectionJobs' :: Maybe Text
nextToken =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:filter':ListSentimentDetectionJobs' :: Maybe SentimentDetectionJobFilter
filter' = Maybe SentimentDetectionJobFilter
forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:ListSentimentDetectionJobs' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing
    }

-- | Identifies the next page of results to return.
listSentimentDetectionJobs_nextToken :: Lens.Lens' ListSentimentDetectionJobs (Prelude.Maybe Prelude.Text)
listSentimentDetectionJobs_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListSentimentDetectionJobs -> f ListSentimentDetectionJobs
listSentimentDetectionJobs_nextToken = (ListSentimentDetectionJobs -> Maybe Text)
-> (ListSentimentDetectionJobs
    -> Maybe Text -> ListSentimentDetectionJobs)
-> Lens
     ListSentimentDetectionJobs
     ListSentimentDetectionJobs
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListSentimentDetectionJobs' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListSentimentDetectionJobs' :: ListSentimentDetectionJobs -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListSentimentDetectionJobs
s@ListSentimentDetectionJobs' {} Maybe Text
a -> ListSentimentDetectionJobs
s {$sel:nextToken:ListSentimentDetectionJobs' :: Maybe Text
nextToken = Maybe Text
a} :: ListSentimentDetectionJobs)

-- | Filters the jobs that are returned. You can filter jobs on their name,
-- status, or the date and time that they were submitted. You can only set
-- one filter at a time.
listSentimentDetectionJobs_filter :: Lens.Lens' ListSentimentDetectionJobs (Prelude.Maybe SentimentDetectionJobFilter)
listSentimentDetectionJobs_filter :: (Maybe SentimentDetectionJobFilter
 -> f (Maybe SentimentDetectionJobFilter))
-> ListSentimentDetectionJobs -> f ListSentimentDetectionJobs
listSentimentDetectionJobs_filter = (ListSentimentDetectionJobs -> Maybe SentimentDetectionJobFilter)
-> (ListSentimentDetectionJobs
    -> Maybe SentimentDetectionJobFilter -> ListSentimentDetectionJobs)
-> Lens
     ListSentimentDetectionJobs
     ListSentimentDetectionJobs
     (Maybe SentimentDetectionJobFilter)
     (Maybe SentimentDetectionJobFilter)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListSentimentDetectionJobs' {Maybe SentimentDetectionJobFilter
filter' :: Maybe SentimentDetectionJobFilter
$sel:filter':ListSentimentDetectionJobs' :: ListSentimentDetectionJobs -> Maybe SentimentDetectionJobFilter
filter'} -> Maybe SentimentDetectionJobFilter
filter') (\s :: ListSentimentDetectionJobs
s@ListSentimentDetectionJobs' {} Maybe SentimentDetectionJobFilter
a -> ListSentimentDetectionJobs
s {$sel:filter':ListSentimentDetectionJobs' :: Maybe SentimentDetectionJobFilter
filter' = Maybe SentimentDetectionJobFilter
a} :: ListSentimentDetectionJobs)

-- | The maximum number of results to return in each page. The default is
-- 100.
listSentimentDetectionJobs_maxResults :: Lens.Lens' ListSentimentDetectionJobs (Prelude.Maybe Prelude.Natural)
listSentimentDetectionJobs_maxResults :: (Maybe Natural -> f (Maybe Natural))
-> ListSentimentDetectionJobs -> f ListSentimentDetectionJobs
listSentimentDetectionJobs_maxResults = (ListSentimentDetectionJobs -> Maybe Natural)
-> (ListSentimentDetectionJobs
    -> Maybe Natural -> ListSentimentDetectionJobs)
-> Lens
     ListSentimentDetectionJobs
     ListSentimentDetectionJobs
     (Maybe Natural)
     (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListSentimentDetectionJobs' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListSentimentDetectionJobs' :: ListSentimentDetectionJobs -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListSentimentDetectionJobs
s@ListSentimentDetectionJobs' {} Maybe Natural
a -> ListSentimentDetectionJobs
s {$sel:maxResults:ListSentimentDetectionJobs' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListSentimentDetectionJobs)

instance Core.AWSPager ListSentimentDetectionJobs where
  page :: ListSentimentDetectionJobs
-> AWSResponse ListSentimentDetectionJobs
-> Maybe ListSentimentDetectionJobs
page ListSentimentDetectionJobs
rq AWSResponse ListSentimentDetectionJobs
rs
    | Maybe Text -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListSentimentDetectionJobs
ListSentimentDetectionJobsResponse
rs
            ListSentimentDetectionJobsResponse
-> Getting (First Text) ListSentimentDetectionJobsResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListSentimentDetectionJobsResponse
-> Const (First Text) ListSentimentDetectionJobsResponse
Lens' ListSentimentDetectionJobsResponse (Maybe Text)
listSentimentDetectionJobsResponse_nextToken
              ((Maybe Text -> Const (First Text) (Maybe Text))
 -> ListSentimentDetectionJobsResponse
 -> Const (First Text) ListSentimentDetectionJobsResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListSentimentDetectionJobsResponse Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text)
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
      Maybe ListSentimentDetectionJobs
forall a. Maybe a
Prelude.Nothing
    | Maybe [SentimentDetectionJobProperties] -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListSentimentDetectionJobs
ListSentimentDetectionJobsResponse
rs
            ListSentimentDetectionJobsResponse
-> Getting
     (First [SentimentDetectionJobProperties])
     ListSentimentDetectionJobsResponse
     [SentimentDetectionJobProperties]
-> Maybe [SentimentDetectionJobProperties]
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe [SentimentDetectionJobProperties]
 -> Const
      (First [SentimentDetectionJobProperties])
      (Maybe [SentimentDetectionJobProperties]))
-> ListSentimentDetectionJobsResponse
-> Const
     (First [SentimentDetectionJobProperties])
     ListSentimentDetectionJobsResponse
Lens'
  ListSentimentDetectionJobsResponse
  (Maybe [SentimentDetectionJobProperties])
listSentimentDetectionJobsResponse_sentimentDetectionJobPropertiesList
              ((Maybe [SentimentDetectionJobProperties]
  -> Const
       (First [SentimentDetectionJobProperties])
       (Maybe [SentimentDetectionJobProperties]))
 -> ListSentimentDetectionJobsResponse
 -> Const
      (First [SentimentDetectionJobProperties])
      ListSentimentDetectionJobsResponse)
-> (([SentimentDetectionJobProperties]
     -> Const
          (First [SentimentDetectionJobProperties])
          [SentimentDetectionJobProperties])
    -> Maybe [SentimentDetectionJobProperties]
    -> Const
         (First [SentimentDetectionJobProperties])
         (Maybe [SentimentDetectionJobProperties]))
-> Getting
     (First [SentimentDetectionJobProperties])
     ListSentimentDetectionJobsResponse
     [SentimentDetectionJobProperties]
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([SentimentDetectionJobProperties]
 -> Const
      (First [SentimentDetectionJobProperties])
      [SentimentDetectionJobProperties])
-> Maybe [SentimentDetectionJobProperties]
-> Const
     (First [SentimentDetectionJobProperties])
     (Maybe [SentimentDetectionJobProperties])
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
      Maybe ListSentimentDetectionJobs
forall a. Maybe a
Prelude.Nothing
    | Bool
Prelude.otherwise =
      ListSentimentDetectionJobs -> Maybe ListSentimentDetectionJobs
forall a. a -> Maybe a
Prelude.Just (ListSentimentDetectionJobs -> Maybe ListSentimentDetectionJobs)
-> ListSentimentDetectionJobs -> Maybe ListSentimentDetectionJobs
forall a b. (a -> b) -> a -> b
Prelude.$
        ListSentimentDetectionJobs
rq
          ListSentimentDetectionJobs
-> (ListSentimentDetectionJobs -> ListSentimentDetectionJobs)
-> ListSentimentDetectionJobs
forall a b. a -> (a -> b) -> b
Prelude.& (Maybe Text -> Identity (Maybe Text))
-> ListSentimentDetectionJobs
-> Identity ListSentimentDetectionJobs
Lens
  ListSentimentDetectionJobs
  ListSentimentDetectionJobs
  (Maybe Text)
  (Maybe Text)
listSentimentDetectionJobs_nextToken
          ((Maybe Text -> Identity (Maybe Text))
 -> ListSentimentDetectionJobs
 -> Identity ListSentimentDetectionJobs)
-> Maybe Text
-> ListSentimentDetectionJobs
-> ListSentimentDetectionJobs
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListSentimentDetectionJobs
ListSentimentDetectionJobsResponse
rs
          ListSentimentDetectionJobsResponse
-> Getting (First Text) ListSentimentDetectionJobsResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListSentimentDetectionJobsResponse
-> Const (First Text) ListSentimentDetectionJobsResponse
Lens' ListSentimentDetectionJobsResponse (Maybe Text)
listSentimentDetectionJobsResponse_nextToken
            ((Maybe Text -> Const (First Text) (Maybe Text))
 -> ListSentimentDetectionJobsResponse
 -> Const (First Text) ListSentimentDetectionJobsResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListSentimentDetectionJobsResponse Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text)
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just

instance Core.AWSRequest ListSentimentDetectionJobs where
  type
    AWSResponse ListSentimentDetectionJobs =
      ListSentimentDetectionJobsResponse
  request :: ListSentimentDetectionJobs -> Request ListSentimentDetectionJobs
request = Service
-> ListSentimentDetectionJobs -> Request ListSentimentDetectionJobs
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy ListSentimentDetectionJobs
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse ListSentimentDetectionJobs)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse ListSentimentDetectionJobs))
-> Logger
-> Service
-> Proxy ListSentimentDetectionJobs
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse ListSentimentDetectionJobs)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe Text
-> Maybe [SentimentDetectionJobProperties]
-> Int
-> ListSentimentDetectionJobsResponse
ListSentimentDetectionJobsResponse'
            (Maybe Text
 -> Maybe [SentimentDetectionJobProperties]
 -> Int
 -> ListSentimentDetectionJobsResponse)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe [SentimentDetectionJobProperties]
      -> Int -> ListSentimentDetectionJobsResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"NextToken")
            Either
  String
  (Maybe [SentimentDetectionJobProperties]
   -> Int -> ListSentimentDetectionJobsResponse)
-> Either String (Maybe [SentimentDetectionJobProperties])
-> Either String (Int -> ListSentimentDetectionJobsResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x Object
-> Text
-> Either String (Maybe (Maybe [SentimentDetectionJobProperties]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"SentimentDetectionJobPropertiesList"
                            Either String (Maybe (Maybe [SentimentDetectionJobProperties]))
-> Maybe [SentimentDetectionJobProperties]
-> Either String (Maybe [SentimentDetectionJobProperties])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [SentimentDetectionJobProperties]
forall a. Monoid a => a
Prelude.mempty
                        )
            Either String (Int -> ListSentimentDetectionJobsResponse)
-> Either String Int
-> Either String ListSentimentDetectionJobsResponse
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 ListSentimentDetectionJobs

instance Prelude.NFData ListSentimentDetectionJobs

instance Core.ToHeaders ListSentimentDetectionJobs where
  toHeaders :: ListSentimentDetectionJobs -> ResponseHeaders
toHeaders =
    ResponseHeaders -> ListSentimentDetectionJobs -> 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
"Comprehend_20171127.ListSentimentDetectionJobs" ::
                          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 ListSentimentDetectionJobs where
  toJSON :: ListSentimentDetectionJobs -> Value
toJSON ListSentimentDetectionJobs' {Maybe Natural
Maybe Text
Maybe SentimentDetectionJobFilter
maxResults :: Maybe Natural
filter' :: Maybe SentimentDetectionJobFilter
nextToken :: Maybe Text
$sel:maxResults:ListSentimentDetectionJobs' :: ListSentimentDetectionJobs -> Maybe Natural
$sel:filter':ListSentimentDetectionJobs' :: ListSentimentDetectionJobs -> Maybe SentimentDetectionJobFilter
$sel:nextToken:ListSentimentDetectionJobs' :: ListSentimentDetectionJobs -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"NextToken" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
nextToken,
            (Text
"Filter" Text -> SentimentDetectionJobFilter -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (SentimentDetectionJobFilter -> Pair)
-> Maybe SentimentDetectionJobFilter -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe SentimentDetectionJobFilter
filter',
            (Text
"MaxResults" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Natural -> Pair) -> Maybe Natural -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
maxResults
          ]
      )

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

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

-- | /See:/ 'newListSentimentDetectionJobsResponse' smart constructor.
data ListSentimentDetectionJobsResponse = ListSentimentDetectionJobsResponse'
  { -- | Identifies the next page of results to return.
    ListSentimentDetectionJobsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | A list containing the properties of each job that is returned.
    ListSentimentDetectionJobsResponse
-> Maybe [SentimentDetectionJobProperties]
sentimentDetectionJobPropertiesList :: Prelude.Maybe [SentimentDetectionJobProperties],
    -- | The response's http status code.
    ListSentimentDetectionJobsResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (ListSentimentDetectionJobsResponse
-> ListSentimentDetectionJobsResponse -> Bool
(ListSentimentDetectionJobsResponse
 -> ListSentimentDetectionJobsResponse -> Bool)
-> (ListSentimentDetectionJobsResponse
    -> ListSentimentDetectionJobsResponse -> Bool)
-> Eq ListSentimentDetectionJobsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListSentimentDetectionJobsResponse
-> ListSentimentDetectionJobsResponse -> Bool
$c/= :: ListSentimentDetectionJobsResponse
-> ListSentimentDetectionJobsResponse -> Bool
== :: ListSentimentDetectionJobsResponse
-> ListSentimentDetectionJobsResponse -> Bool
$c== :: ListSentimentDetectionJobsResponse
-> ListSentimentDetectionJobsResponse -> Bool
Prelude.Eq, ReadPrec [ListSentimentDetectionJobsResponse]
ReadPrec ListSentimentDetectionJobsResponse
Int -> ReadS ListSentimentDetectionJobsResponse
ReadS [ListSentimentDetectionJobsResponse]
(Int -> ReadS ListSentimentDetectionJobsResponse)
-> ReadS [ListSentimentDetectionJobsResponse]
-> ReadPrec ListSentimentDetectionJobsResponse
-> ReadPrec [ListSentimentDetectionJobsResponse]
-> Read ListSentimentDetectionJobsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListSentimentDetectionJobsResponse]
$creadListPrec :: ReadPrec [ListSentimentDetectionJobsResponse]
readPrec :: ReadPrec ListSentimentDetectionJobsResponse
$creadPrec :: ReadPrec ListSentimentDetectionJobsResponse
readList :: ReadS [ListSentimentDetectionJobsResponse]
$creadList :: ReadS [ListSentimentDetectionJobsResponse]
readsPrec :: Int -> ReadS ListSentimentDetectionJobsResponse
$creadsPrec :: Int -> ReadS ListSentimentDetectionJobsResponse
Prelude.Read, Int -> ListSentimentDetectionJobsResponse -> ShowS
[ListSentimentDetectionJobsResponse] -> ShowS
ListSentimentDetectionJobsResponse -> String
(Int -> ListSentimentDetectionJobsResponse -> ShowS)
-> (ListSentimentDetectionJobsResponse -> String)
-> ([ListSentimentDetectionJobsResponse] -> ShowS)
-> Show ListSentimentDetectionJobsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListSentimentDetectionJobsResponse] -> ShowS
$cshowList :: [ListSentimentDetectionJobsResponse] -> ShowS
show :: ListSentimentDetectionJobsResponse -> String
$cshow :: ListSentimentDetectionJobsResponse -> String
showsPrec :: Int -> ListSentimentDetectionJobsResponse -> ShowS
$cshowsPrec :: Int -> ListSentimentDetectionJobsResponse -> ShowS
Prelude.Show, (forall x.
 ListSentimentDetectionJobsResponse
 -> Rep ListSentimentDetectionJobsResponse x)
-> (forall x.
    Rep ListSentimentDetectionJobsResponse x
    -> ListSentimentDetectionJobsResponse)
-> Generic ListSentimentDetectionJobsResponse
forall x.
Rep ListSentimentDetectionJobsResponse x
-> ListSentimentDetectionJobsResponse
forall x.
ListSentimentDetectionJobsResponse
-> Rep ListSentimentDetectionJobsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListSentimentDetectionJobsResponse x
-> ListSentimentDetectionJobsResponse
$cfrom :: forall x.
ListSentimentDetectionJobsResponse
-> Rep ListSentimentDetectionJobsResponse x
Prelude.Generic)

-- |
-- Create a value of 'ListSentimentDetectionJobsResponse' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'nextToken', 'listSentimentDetectionJobsResponse_nextToken' - Identifies the next page of results to return.
--
-- 'sentimentDetectionJobPropertiesList', 'listSentimentDetectionJobsResponse_sentimentDetectionJobPropertiesList' - A list containing the properties of each job that is returned.
--
-- 'httpStatus', 'listSentimentDetectionJobsResponse_httpStatus' - The response's http status code.
newListSentimentDetectionJobsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListSentimentDetectionJobsResponse
newListSentimentDetectionJobsResponse :: Int -> ListSentimentDetectionJobsResponse
newListSentimentDetectionJobsResponse Int
pHttpStatus_ =
  ListSentimentDetectionJobsResponse' :: Maybe Text
-> Maybe [SentimentDetectionJobProperties]
-> Int
-> ListSentimentDetectionJobsResponse
ListSentimentDetectionJobsResponse'
    { $sel:nextToken:ListSentimentDetectionJobsResponse' :: Maybe Text
nextToken =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:sentimentDetectionJobPropertiesList:ListSentimentDetectionJobsResponse' :: Maybe [SentimentDetectionJobProperties]
sentimentDetectionJobPropertiesList =
        Maybe [SentimentDetectionJobProperties]
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListSentimentDetectionJobsResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | Identifies the next page of results to return.
listSentimentDetectionJobsResponse_nextToken :: Lens.Lens' ListSentimentDetectionJobsResponse (Prelude.Maybe Prelude.Text)
listSentimentDetectionJobsResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListSentimentDetectionJobsResponse
-> f ListSentimentDetectionJobsResponse
listSentimentDetectionJobsResponse_nextToken = (ListSentimentDetectionJobsResponse -> Maybe Text)
-> (ListSentimentDetectionJobsResponse
    -> Maybe Text -> ListSentimentDetectionJobsResponse)
-> Lens' ListSentimentDetectionJobsResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListSentimentDetectionJobsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListSentimentDetectionJobsResponse' :: ListSentimentDetectionJobsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListSentimentDetectionJobsResponse
s@ListSentimentDetectionJobsResponse' {} Maybe Text
a -> ListSentimentDetectionJobsResponse
s {$sel:nextToken:ListSentimentDetectionJobsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListSentimentDetectionJobsResponse)

-- | A list containing the properties of each job that is returned.
listSentimentDetectionJobsResponse_sentimentDetectionJobPropertiesList :: Lens.Lens' ListSentimentDetectionJobsResponse (Prelude.Maybe [SentimentDetectionJobProperties])
listSentimentDetectionJobsResponse_sentimentDetectionJobPropertiesList :: (Maybe [SentimentDetectionJobProperties]
 -> f (Maybe [SentimentDetectionJobProperties]))
-> ListSentimentDetectionJobsResponse
-> f ListSentimentDetectionJobsResponse
listSentimentDetectionJobsResponse_sentimentDetectionJobPropertiesList = (ListSentimentDetectionJobsResponse
 -> Maybe [SentimentDetectionJobProperties])
-> (ListSentimentDetectionJobsResponse
    -> Maybe [SentimentDetectionJobProperties]
    -> ListSentimentDetectionJobsResponse)
-> Lens'
     ListSentimentDetectionJobsResponse
     (Maybe [SentimentDetectionJobProperties])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListSentimentDetectionJobsResponse' {Maybe [SentimentDetectionJobProperties]
sentimentDetectionJobPropertiesList :: Maybe [SentimentDetectionJobProperties]
$sel:sentimentDetectionJobPropertiesList:ListSentimentDetectionJobsResponse' :: ListSentimentDetectionJobsResponse
-> Maybe [SentimentDetectionJobProperties]
sentimentDetectionJobPropertiesList} -> Maybe [SentimentDetectionJobProperties]
sentimentDetectionJobPropertiesList) (\s :: ListSentimentDetectionJobsResponse
s@ListSentimentDetectionJobsResponse' {} Maybe [SentimentDetectionJobProperties]
a -> ListSentimentDetectionJobsResponse
s {$sel:sentimentDetectionJobPropertiesList:ListSentimentDetectionJobsResponse' :: Maybe [SentimentDetectionJobProperties]
sentimentDetectionJobPropertiesList = Maybe [SentimentDetectionJobProperties]
a} :: ListSentimentDetectionJobsResponse) ((Maybe [SentimentDetectionJobProperties]
  -> f (Maybe [SentimentDetectionJobProperties]))
 -> ListSentimentDetectionJobsResponse
 -> f ListSentimentDetectionJobsResponse)
-> ((Maybe [SentimentDetectionJobProperties]
     -> f (Maybe [SentimentDetectionJobProperties]))
    -> Maybe [SentimentDetectionJobProperties]
    -> f (Maybe [SentimentDetectionJobProperties]))
-> (Maybe [SentimentDetectionJobProperties]
    -> f (Maybe [SentimentDetectionJobProperties]))
-> ListSentimentDetectionJobsResponse
-> f ListSentimentDetectionJobsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [SentimentDetectionJobProperties]
  [SentimentDetectionJobProperties]
  [SentimentDetectionJobProperties]
  [SentimentDetectionJobProperties]
-> Iso
     (Maybe [SentimentDetectionJobProperties])
     (Maybe [SentimentDetectionJobProperties])
     (Maybe [SentimentDetectionJobProperties])
     (Maybe [SentimentDetectionJobProperties])
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
  [SentimentDetectionJobProperties]
  [SentimentDetectionJobProperties]
  [SentimentDetectionJobProperties]
  [SentimentDetectionJobProperties]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

instance
  Prelude.NFData
    ListSentimentDetectionJobsResponse