{-# 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.ListKeyPhrasesDetectionJobs
-- 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)
--
-- Get a list of key phrase detection jobs that you have submitted.
--
-- This operation returns paginated results.
module Amazonka.Comprehend.ListKeyPhrasesDetectionJobs
  ( -- * Creating a Request
    ListKeyPhrasesDetectionJobs (..),
    newListKeyPhrasesDetectionJobs,

    -- * Request Lenses
    listKeyPhrasesDetectionJobs_nextToken,
    listKeyPhrasesDetectionJobs_filter,
    listKeyPhrasesDetectionJobs_maxResults,

    -- * Destructuring the Response
    ListKeyPhrasesDetectionJobsResponse (..),
    newListKeyPhrasesDetectionJobsResponse,

    -- * Response Lenses
    listKeyPhrasesDetectionJobsResponse_keyPhrasesDetectionJobPropertiesList,
    listKeyPhrasesDetectionJobsResponse_nextToken,
    listKeyPhrasesDetectionJobsResponse_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:/ 'newListKeyPhrasesDetectionJobs' smart constructor.
data ListKeyPhrasesDetectionJobs = ListKeyPhrasesDetectionJobs'
  { -- | Identifies the next page of results to return.
    ListKeyPhrasesDetectionJobs -> 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.
    ListKeyPhrasesDetectionJobs -> Maybe KeyPhrasesDetectionJobFilter
filter' :: Prelude.Maybe KeyPhrasesDetectionJobFilter,
    -- | The maximum number of results to return in each page. The default is
    -- 100.
    ListKeyPhrasesDetectionJobs -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural
  }
  deriving (ListKeyPhrasesDetectionJobs -> ListKeyPhrasesDetectionJobs -> Bool
(ListKeyPhrasesDetectionJobs
 -> ListKeyPhrasesDetectionJobs -> Bool)
-> (ListKeyPhrasesDetectionJobs
    -> ListKeyPhrasesDetectionJobs -> Bool)
-> Eq ListKeyPhrasesDetectionJobs
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListKeyPhrasesDetectionJobs -> ListKeyPhrasesDetectionJobs -> Bool
$c/= :: ListKeyPhrasesDetectionJobs -> ListKeyPhrasesDetectionJobs -> Bool
== :: ListKeyPhrasesDetectionJobs -> ListKeyPhrasesDetectionJobs -> Bool
$c== :: ListKeyPhrasesDetectionJobs -> ListKeyPhrasesDetectionJobs -> Bool
Prelude.Eq, ReadPrec [ListKeyPhrasesDetectionJobs]
ReadPrec ListKeyPhrasesDetectionJobs
Int -> ReadS ListKeyPhrasesDetectionJobs
ReadS [ListKeyPhrasesDetectionJobs]
(Int -> ReadS ListKeyPhrasesDetectionJobs)
-> ReadS [ListKeyPhrasesDetectionJobs]
-> ReadPrec ListKeyPhrasesDetectionJobs
-> ReadPrec [ListKeyPhrasesDetectionJobs]
-> Read ListKeyPhrasesDetectionJobs
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListKeyPhrasesDetectionJobs]
$creadListPrec :: ReadPrec [ListKeyPhrasesDetectionJobs]
readPrec :: ReadPrec ListKeyPhrasesDetectionJobs
$creadPrec :: ReadPrec ListKeyPhrasesDetectionJobs
readList :: ReadS [ListKeyPhrasesDetectionJobs]
$creadList :: ReadS [ListKeyPhrasesDetectionJobs]
readsPrec :: Int -> ReadS ListKeyPhrasesDetectionJobs
$creadsPrec :: Int -> ReadS ListKeyPhrasesDetectionJobs
Prelude.Read, Int -> ListKeyPhrasesDetectionJobs -> ShowS
[ListKeyPhrasesDetectionJobs] -> ShowS
ListKeyPhrasesDetectionJobs -> String
(Int -> ListKeyPhrasesDetectionJobs -> ShowS)
-> (ListKeyPhrasesDetectionJobs -> String)
-> ([ListKeyPhrasesDetectionJobs] -> ShowS)
-> Show ListKeyPhrasesDetectionJobs
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListKeyPhrasesDetectionJobs] -> ShowS
$cshowList :: [ListKeyPhrasesDetectionJobs] -> ShowS
show :: ListKeyPhrasesDetectionJobs -> String
$cshow :: ListKeyPhrasesDetectionJobs -> String
showsPrec :: Int -> ListKeyPhrasesDetectionJobs -> ShowS
$cshowsPrec :: Int -> ListKeyPhrasesDetectionJobs -> ShowS
Prelude.Show, (forall x.
 ListKeyPhrasesDetectionJobs -> Rep ListKeyPhrasesDetectionJobs x)
-> (forall x.
    Rep ListKeyPhrasesDetectionJobs x -> ListKeyPhrasesDetectionJobs)
-> Generic ListKeyPhrasesDetectionJobs
forall x.
Rep ListKeyPhrasesDetectionJobs x -> ListKeyPhrasesDetectionJobs
forall x.
ListKeyPhrasesDetectionJobs -> Rep ListKeyPhrasesDetectionJobs x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListKeyPhrasesDetectionJobs x -> ListKeyPhrasesDetectionJobs
$cfrom :: forall x.
ListKeyPhrasesDetectionJobs -> Rep ListKeyPhrasesDetectionJobs x
Prelude.Generic)

-- |
-- Create a value of 'ListKeyPhrasesDetectionJobs' 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', 'listKeyPhrasesDetectionJobs_nextToken' - Identifies the next page of results to return.
--
-- 'filter'', 'listKeyPhrasesDetectionJobs_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', 'listKeyPhrasesDetectionJobs_maxResults' - The maximum number of results to return in each page. The default is
-- 100.
newListKeyPhrasesDetectionJobs ::
  ListKeyPhrasesDetectionJobs
newListKeyPhrasesDetectionJobs :: ListKeyPhrasesDetectionJobs
newListKeyPhrasesDetectionJobs =
  ListKeyPhrasesDetectionJobs' :: Maybe Text
-> Maybe KeyPhrasesDetectionJobFilter
-> Maybe Natural
-> ListKeyPhrasesDetectionJobs
ListKeyPhrasesDetectionJobs'
    { $sel:nextToken:ListKeyPhrasesDetectionJobs' :: Maybe Text
nextToken =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:filter':ListKeyPhrasesDetectionJobs' :: Maybe KeyPhrasesDetectionJobFilter
filter' = Maybe KeyPhrasesDetectionJobFilter
forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:ListKeyPhrasesDetectionJobs' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing
    }

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

-- | 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.
listKeyPhrasesDetectionJobs_filter :: Lens.Lens' ListKeyPhrasesDetectionJobs (Prelude.Maybe KeyPhrasesDetectionJobFilter)
listKeyPhrasesDetectionJobs_filter :: (Maybe KeyPhrasesDetectionJobFilter
 -> f (Maybe KeyPhrasesDetectionJobFilter))
-> ListKeyPhrasesDetectionJobs -> f ListKeyPhrasesDetectionJobs
listKeyPhrasesDetectionJobs_filter = (ListKeyPhrasesDetectionJobs -> Maybe KeyPhrasesDetectionJobFilter)
-> (ListKeyPhrasesDetectionJobs
    -> Maybe KeyPhrasesDetectionJobFilter
    -> ListKeyPhrasesDetectionJobs)
-> Lens
     ListKeyPhrasesDetectionJobs
     ListKeyPhrasesDetectionJobs
     (Maybe KeyPhrasesDetectionJobFilter)
     (Maybe KeyPhrasesDetectionJobFilter)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListKeyPhrasesDetectionJobs' {Maybe KeyPhrasesDetectionJobFilter
filter' :: Maybe KeyPhrasesDetectionJobFilter
$sel:filter':ListKeyPhrasesDetectionJobs' :: ListKeyPhrasesDetectionJobs -> Maybe KeyPhrasesDetectionJobFilter
filter'} -> Maybe KeyPhrasesDetectionJobFilter
filter') (\s :: ListKeyPhrasesDetectionJobs
s@ListKeyPhrasesDetectionJobs' {} Maybe KeyPhrasesDetectionJobFilter
a -> ListKeyPhrasesDetectionJobs
s {$sel:filter':ListKeyPhrasesDetectionJobs' :: Maybe KeyPhrasesDetectionJobFilter
filter' = Maybe KeyPhrasesDetectionJobFilter
a} :: ListKeyPhrasesDetectionJobs)

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

instance Core.AWSPager ListKeyPhrasesDetectionJobs where
  page :: ListKeyPhrasesDetectionJobs
-> AWSResponse ListKeyPhrasesDetectionJobs
-> Maybe ListKeyPhrasesDetectionJobs
page ListKeyPhrasesDetectionJobs
rq AWSResponse ListKeyPhrasesDetectionJobs
rs
    | Maybe Text -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListKeyPhrasesDetectionJobs
ListKeyPhrasesDetectionJobsResponse
rs
            ListKeyPhrasesDetectionJobsResponse
-> Getting (First Text) ListKeyPhrasesDetectionJobsResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListKeyPhrasesDetectionJobsResponse
-> Const (First Text) ListKeyPhrasesDetectionJobsResponse
Lens' ListKeyPhrasesDetectionJobsResponse (Maybe Text)
listKeyPhrasesDetectionJobsResponse_nextToken
              ((Maybe Text -> Const (First Text) (Maybe Text))
 -> ListKeyPhrasesDetectionJobsResponse
 -> Const (First Text) ListKeyPhrasesDetectionJobsResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListKeyPhrasesDetectionJobsResponse 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 ListKeyPhrasesDetectionJobs
forall a. Maybe a
Prelude.Nothing
    | Maybe [KeyPhrasesDetectionJobProperties] -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListKeyPhrasesDetectionJobs
ListKeyPhrasesDetectionJobsResponse
rs
            ListKeyPhrasesDetectionJobsResponse
-> Getting
     (First [KeyPhrasesDetectionJobProperties])
     ListKeyPhrasesDetectionJobsResponse
     [KeyPhrasesDetectionJobProperties]
-> Maybe [KeyPhrasesDetectionJobProperties]
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe [KeyPhrasesDetectionJobProperties]
 -> Const
      (First [KeyPhrasesDetectionJobProperties])
      (Maybe [KeyPhrasesDetectionJobProperties]))
-> ListKeyPhrasesDetectionJobsResponse
-> Const
     (First [KeyPhrasesDetectionJobProperties])
     ListKeyPhrasesDetectionJobsResponse
Lens'
  ListKeyPhrasesDetectionJobsResponse
  (Maybe [KeyPhrasesDetectionJobProperties])
listKeyPhrasesDetectionJobsResponse_keyPhrasesDetectionJobPropertiesList
              ((Maybe [KeyPhrasesDetectionJobProperties]
  -> Const
       (First [KeyPhrasesDetectionJobProperties])
       (Maybe [KeyPhrasesDetectionJobProperties]))
 -> ListKeyPhrasesDetectionJobsResponse
 -> Const
      (First [KeyPhrasesDetectionJobProperties])
      ListKeyPhrasesDetectionJobsResponse)
-> (([KeyPhrasesDetectionJobProperties]
     -> Const
          (First [KeyPhrasesDetectionJobProperties])
          [KeyPhrasesDetectionJobProperties])
    -> Maybe [KeyPhrasesDetectionJobProperties]
    -> Const
         (First [KeyPhrasesDetectionJobProperties])
         (Maybe [KeyPhrasesDetectionJobProperties]))
-> Getting
     (First [KeyPhrasesDetectionJobProperties])
     ListKeyPhrasesDetectionJobsResponse
     [KeyPhrasesDetectionJobProperties]
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([KeyPhrasesDetectionJobProperties]
 -> Const
      (First [KeyPhrasesDetectionJobProperties])
      [KeyPhrasesDetectionJobProperties])
-> Maybe [KeyPhrasesDetectionJobProperties]
-> Const
     (First [KeyPhrasesDetectionJobProperties])
     (Maybe [KeyPhrasesDetectionJobProperties])
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
      Maybe ListKeyPhrasesDetectionJobs
forall a. Maybe a
Prelude.Nothing
    | Bool
Prelude.otherwise =
      ListKeyPhrasesDetectionJobs -> Maybe ListKeyPhrasesDetectionJobs
forall a. a -> Maybe a
Prelude.Just (ListKeyPhrasesDetectionJobs -> Maybe ListKeyPhrasesDetectionJobs)
-> ListKeyPhrasesDetectionJobs -> Maybe ListKeyPhrasesDetectionJobs
forall a b. (a -> b) -> a -> b
Prelude.$
        ListKeyPhrasesDetectionJobs
rq
          ListKeyPhrasesDetectionJobs
-> (ListKeyPhrasesDetectionJobs -> ListKeyPhrasesDetectionJobs)
-> ListKeyPhrasesDetectionJobs
forall a b. a -> (a -> b) -> b
Prelude.& (Maybe Text -> Identity (Maybe Text))
-> ListKeyPhrasesDetectionJobs
-> Identity ListKeyPhrasesDetectionJobs
Lens
  ListKeyPhrasesDetectionJobs
  ListKeyPhrasesDetectionJobs
  (Maybe Text)
  (Maybe Text)
listKeyPhrasesDetectionJobs_nextToken
          ((Maybe Text -> Identity (Maybe Text))
 -> ListKeyPhrasesDetectionJobs
 -> Identity ListKeyPhrasesDetectionJobs)
-> Maybe Text
-> ListKeyPhrasesDetectionJobs
-> ListKeyPhrasesDetectionJobs
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListKeyPhrasesDetectionJobs
ListKeyPhrasesDetectionJobsResponse
rs
          ListKeyPhrasesDetectionJobsResponse
-> Getting (First Text) ListKeyPhrasesDetectionJobsResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListKeyPhrasesDetectionJobsResponse
-> Const (First Text) ListKeyPhrasesDetectionJobsResponse
Lens' ListKeyPhrasesDetectionJobsResponse (Maybe Text)
listKeyPhrasesDetectionJobsResponse_nextToken
            ((Maybe Text -> Const (First Text) (Maybe Text))
 -> ListKeyPhrasesDetectionJobsResponse
 -> Const (First Text) ListKeyPhrasesDetectionJobsResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListKeyPhrasesDetectionJobsResponse 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 ListKeyPhrasesDetectionJobs where
  type
    AWSResponse ListKeyPhrasesDetectionJobs =
      ListKeyPhrasesDetectionJobsResponse
  request :: ListKeyPhrasesDetectionJobs -> Request ListKeyPhrasesDetectionJobs
request = Service
-> ListKeyPhrasesDetectionJobs
-> Request ListKeyPhrasesDetectionJobs
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy ListKeyPhrasesDetectionJobs
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse ListKeyPhrasesDetectionJobs)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse ListKeyPhrasesDetectionJobs))
-> Logger
-> Service
-> Proxy ListKeyPhrasesDetectionJobs
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse ListKeyPhrasesDetectionJobs)))
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 [KeyPhrasesDetectionJobProperties]
-> Maybe Text -> Int -> ListKeyPhrasesDetectionJobsResponse
ListKeyPhrasesDetectionJobsResponse'
            (Maybe [KeyPhrasesDetectionJobProperties]
 -> Maybe Text -> Int -> ListKeyPhrasesDetectionJobsResponse)
-> Either String (Maybe [KeyPhrasesDetectionJobProperties])
-> Either
     String (Maybe Text -> Int -> ListKeyPhrasesDetectionJobsResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( Object
x Object
-> Text
-> Either String (Maybe (Maybe [KeyPhrasesDetectionJobProperties]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"KeyPhrasesDetectionJobPropertiesList"
                            Either String (Maybe (Maybe [KeyPhrasesDetectionJobProperties]))
-> Maybe [KeyPhrasesDetectionJobProperties]
-> Either String (Maybe [KeyPhrasesDetectionJobProperties])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [KeyPhrasesDetectionJobProperties]
forall a. Monoid a => a
Prelude.mempty
                        )
            Either
  String (Maybe Text -> Int -> ListKeyPhrasesDetectionJobsResponse)
-> Either String (Maybe Text)
-> Either String (Int -> ListKeyPhrasesDetectionJobsResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"NextToken")
            Either String (Int -> ListKeyPhrasesDetectionJobsResponse)
-> Either String Int
-> Either String ListKeyPhrasesDetectionJobsResponse
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 ListKeyPhrasesDetectionJobs

instance Prelude.NFData ListKeyPhrasesDetectionJobs

instance Core.ToHeaders ListKeyPhrasesDetectionJobs where
  toHeaders :: ListKeyPhrasesDetectionJobs -> ResponseHeaders
toHeaders =
    ResponseHeaders -> ListKeyPhrasesDetectionJobs -> 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.ListKeyPhrasesDetectionJobs" ::
                          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 ListKeyPhrasesDetectionJobs where
  toJSON :: ListKeyPhrasesDetectionJobs -> Value
toJSON ListKeyPhrasesDetectionJobs' {Maybe Natural
Maybe Text
Maybe KeyPhrasesDetectionJobFilter
maxResults :: Maybe Natural
filter' :: Maybe KeyPhrasesDetectionJobFilter
nextToken :: Maybe Text
$sel:maxResults:ListKeyPhrasesDetectionJobs' :: ListKeyPhrasesDetectionJobs -> Maybe Natural
$sel:filter':ListKeyPhrasesDetectionJobs' :: ListKeyPhrasesDetectionJobs -> Maybe KeyPhrasesDetectionJobFilter
$sel:nextToken:ListKeyPhrasesDetectionJobs' :: ListKeyPhrasesDetectionJobs -> 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 -> KeyPhrasesDetectionJobFilter -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (KeyPhrasesDetectionJobFilter -> Pair)
-> Maybe KeyPhrasesDetectionJobFilter -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe KeyPhrasesDetectionJobFilter
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 ListKeyPhrasesDetectionJobs where
  toPath :: ListKeyPhrasesDetectionJobs -> ByteString
toPath = ByteString -> ListKeyPhrasesDetectionJobs -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"

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

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

-- |
-- Create a value of 'ListKeyPhrasesDetectionJobsResponse' 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:
--
-- 'keyPhrasesDetectionJobPropertiesList', 'listKeyPhrasesDetectionJobsResponse_keyPhrasesDetectionJobPropertiesList' - A list containing the properties of each job that is returned.
--
-- 'nextToken', 'listKeyPhrasesDetectionJobsResponse_nextToken' - Identifies the next page of results to return.
--
-- 'httpStatus', 'listKeyPhrasesDetectionJobsResponse_httpStatus' - The response's http status code.
newListKeyPhrasesDetectionJobsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListKeyPhrasesDetectionJobsResponse
newListKeyPhrasesDetectionJobsResponse :: Int -> ListKeyPhrasesDetectionJobsResponse
newListKeyPhrasesDetectionJobsResponse Int
pHttpStatus_ =
  ListKeyPhrasesDetectionJobsResponse' :: Maybe [KeyPhrasesDetectionJobProperties]
-> Maybe Text -> Int -> ListKeyPhrasesDetectionJobsResponse
ListKeyPhrasesDetectionJobsResponse'
    { $sel:keyPhrasesDetectionJobPropertiesList:ListKeyPhrasesDetectionJobsResponse' :: Maybe [KeyPhrasesDetectionJobProperties]
keyPhrasesDetectionJobPropertiesList =
        Maybe [KeyPhrasesDetectionJobProperties]
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListKeyPhrasesDetectionJobsResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListKeyPhrasesDetectionJobsResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

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

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

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

instance
  Prelude.NFData
    ListKeyPhrasesDetectionJobsResponse