{-# 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 #-}
module Amazonka.WorkDocs.GetDocumentPath
(
GetDocumentPath (..),
newGetDocumentPath,
getDocumentPath_authenticationToken,
getDocumentPath_marker,
getDocumentPath_limit,
getDocumentPath_fields,
getDocumentPath_documentId,
GetDocumentPathResponse (..),
newGetDocumentPathResponse,
getDocumentPathResponse_path,
getDocumentPathResponse_httpStatus,
)
where
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
import Amazonka.WorkDocs.Types
data GetDocumentPath = GetDocumentPath'
{
GetDocumentPath -> Maybe (Sensitive Text)
authenticationToken :: Prelude.Maybe (Core.Sensitive Prelude.Text),
GetDocumentPath -> Maybe Text
marker :: Prelude.Maybe Prelude.Text,
GetDocumentPath -> Maybe Natural
limit :: Prelude.Maybe Prelude.Natural,
GetDocumentPath -> Maybe Text
fields :: Prelude.Maybe Prelude.Text,
GetDocumentPath -> Text
documentId :: Prelude.Text
}
deriving (GetDocumentPath -> GetDocumentPath -> Bool
(GetDocumentPath -> GetDocumentPath -> Bool)
-> (GetDocumentPath -> GetDocumentPath -> Bool)
-> Eq GetDocumentPath
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetDocumentPath -> GetDocumentPath -> Bool
$c/= :: GetDocumentPath -> GetDocumentPath -> Bool
== :: GetDocumentPath -> GetDocumentPath -> Bool
$c== :: GetDocumentPath -> GetDocumentPath -> Bool
Prelude.Eq, Int -> GetDocumentPath -> ShowS
[GetDocumentPath] -> ShowS
GetDocumentPath -> String
(Int -> GetDocumentPath -> ShowS)
-> (GetDocumentPath -> String)
-> ([GetDocumentPath] -> ShowS)
-> Show GetDocumentPath
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetDocumentPath] -> ShowS
$cshowList :: [GetDocumentPath] -> ShowS
show :: GetDocumentPath -> String
$cshow :: GetDocumentPath -> String
showsPrec :: Int -> GetDocumentPath -> ShowS
$cshowsPrec :: Int -> GetDocumentPath -> ShowS
Prelude.Show, (forall x. GetDocumentPath -> Rep GetDocumentPath x)
-> (forall x. Rep GetDocumentPath x -> GetDocumentPath)
-> Generic GetDocumentPath
forall x. Rep GetDocumentPath x -> GetDocumentPath
forall x. GetDocumentPath -> Rep GetDocumentPath x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetDocumentPath x -> GetDocumentPath
$cfrom :: forall x. GetDocumentPath -> Rep GetDocumentPath x
Prelude.Generic)
newGetDocumentPath ::
Prelude.Text ->
GetDocumentPath
newGetDocumentPath :: Text -> GetDocumentPath
newGetDocumentPath Text
pDocumentId_ =
GetDocumentPath' :: Maybe (Sensitive Text)
-> Maybe Text
-> Maybe Natural
-> Maybe Text
-> Text
-> GetDocumentPath
GetDocumentPath'
{ $sel:authenticationToken:GetDocumentPath' :: Maybe (Sensitive Text)
authenticationToken =
Maybe (Sensitive Text)
forall a. Maybe a
Prelude.Nothing,
$sel:marker:GetDocumentPath' :: Maybe Text
marker = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:limit:GetDocumentPath' :: Maybe Natural
limit = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
$sel:fields:GetDocumentPath' :: Maybe Text
fields = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:documentId:GetDocumentPath' :: Text
documentId = Text
pDocumentId_
}
getDocumentPath_authenticationToken :: Lens.Lens' GetDocumentPath (Prelude.Maybe Prelude.Text)
getDocumentPath_authenticationToken :: (Maybe Text -> f (Maybe Text))
-> GetDocumentPath -> f GetDocumentPath
getDocumentPath_authenticationToken = (GetDocumentPath -> Maybe (Sensitive Text))
-> (GetDocumentPath -> Maybe (Sensitive Text) -> GetDocumentPath)
-> Lens
GetDocumentPath
GetDocumentPath
(Maybe (Sensitive Text))
(Maybe (Sensitive Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetDocumentPath' {Maybe (Sensitive Text)
authenticationToken :: Maybe (Sensitive Text)
$sel:authenticationToken:GetDocumentPath' :: GetDocumentPath -> Maybe (Sensitive Text)
authenticationToken} -> Maybe (Sensitive Text)
authenticationToken) (\s :: GetDocumentPath
s@GetDocumentPath' {} Maybe (Sensitive Text)
a -> GetDocumentPath
s {$sel:authenticationToken:GetDocumentPath' :: Maybe (Sensitive Text)
authenticationToken = Maybe (Sensitive Text)
a} :: GetDocumentPath) ((Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
-> GetDocumentPath -> f GetDocumentPath)
-> ((Maybe Text -> f (Maybe Text))
-> Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
-> (Maybe Text -> f (Maybe Text))
-> GetDocumentPath
-> f GetDocumentPath
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
getDocumentPath_marker :: Lens.Lens' GetDocumentPath (Prelude.Maybe Prelude.Text)
getDocumentPath_marker :: (Maybe Text -> f (Maybe Text))
-> GetDocumentPath -> f GetDocumentPath
getDocumentPath_marker = (GetDocumentPath -> Maybe Text)
-> (GetDocumentPath -> Maybe Text -> GetDocumentPath)
-> Lens GetDocumentPath GetDocumentPath (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetDocumentPath' {Maybe Text
marker :: Maybe Text
$sel:marker:GetDocumentPath' :: GetDocumentPath -> Maybe Text
marker} -> Maybe Text
marker) (\s :: GetDocumentPath
s@GetDocumentPath' {} Maybe Text
a -> GetDocumentPath
s {$sel:marker:GetDocumentPath' :: Maybe Text
marker = Maybe Text
a} :: GetDocumentPath)
getDocumentPath_limit :: Lens.Lens' GetDocumentPath (Prelude.Maybe Prelude.Natural)
getDocumentPath_limit :: (Maybe Natural -> f (Maybe Natural))
-> GetDocumentPath -> f GetDocumentPath
getDocumentPath_limit = (GetDocumentPath -> Maybe Natural)
-> (GetDocumentPath -> Maybe Natural -> GetDocumentPath)
-> Lens
GetDocumentPath GetDocumentPath (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetDocumentPath' {Maybe Natural
limit :: Maybe Natural
$sel:limit:GetDocumentPath' :: GetDocumentPath -> Maybe Natural
limit} -> Maybe Natural
limit) (\s :: GetDocumentPath
s@GetDocumentPath' {} Maybe Natural
a -> GetDocumentPath
s {$sel:limit:GetDocumentPath' :: Maybe Natural
limit = Maybe Natural
a} :: GetDocumentPath)
getDocumentPath_fields :: Lens.Lens' GetDocumentPath (Prelude.Maybe Prelude.Text)
getDocumentPath_fields :: (Maybe Text -> f (Maybe Text))
-> GetDocumentPath -> f GetDocumentPath
getDocumentPath_fields = (GetDocumentPath -> Maybe Text)
-> (GetDocumentPath -> Maybe Text -> GetDocumentPath)
-> Lens GetDocumentPath GetDocumentPath (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetDocumentPath' {Maybe Text
fields :: Maybe Text
$sel:fields:GetDocumentPath' :: GetDocumentPath -> Maybe Text
fields} -> Maybe Text
fields) (\s :: GetDocumentPath
s@GetDocumentPath' {} Maybe Text
a -> GetDocumentPath
s {$sel:fields:GetDocumentPath' :: Maybe Text
fields = Maybe Text
a} :: GetDocumentPath)
getDocumentPath_documentId :: Lens.Lens' GetDocumentPath Prelude.Text
getDocumentPath_documentId :: (Text -> f Text) -> GetDocumentPath -> f GetDocumentPath
getDocumentPath_documentId = (GetDocumentPath -> Text)
-> (GetDocumentPath -> Text -> GetDocumentPath)
-> Lens GetDocumentPath GetDocumentPath Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetDocumentPath' {Text
documentId :: Text
$sel:documentId:GetDocumentPath' :: GetDocumentPath -> Text
documentId} -> Text
documentId) (\s :: GetDocumentPath
s@GetDocumentPath' {} Text
a -> GetDocumentPath
s {$sel:documentId:GetDocumentPath' :: Text
documentId = Text
a} :: GetDocumentPath)
instance Core.AWSRequest GetDocumentPath where
type
AWSResponse GetDocumentPath =
GetDocumentPathResponse
request :: GetDocumentPath -> Request GetDocumentPath
request = Service -> GetDocumentPath -> Request GetDocumentPath
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
response :: Logger
-> Service
-> Proxy GetDocumentPath
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetDocumentPath)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse GetDocumentPath))
-> Logger
-> Service
-> Proxy GetDocumentPath
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetDocumentPath)))
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 ResourcePath -> Int -> GetDocumentPathResponse
GetDocumentPathResponse'
(Maybe ResourcePath -> Int -> GetDocumentPathResponse)
-> Either String (Maybe ResourcePath)
-> Either String (Int -> GetDocumentPathResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe ResourcePath)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"Path")
Either String (Int -> GetDocumentPathResponse)
-> Either String Int -> Either String GetDocumentPathResponse
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 GetDocumentPath
instance Prelude.NFData GetDocumentPath
instance Core.ToHeaders GetDocumentPath where
toHeaders :: GetDocumentPath -> ResponseHeaders
toHeaders GetDocumentPath' {Maybe Natural
Maybe Text
Maybe (Sensitive Text)
Text
documentId :: Text
fields :: Maybe Text
limit :: Maybe Natural
marker :: Maybe Text
authenticationToken :: Maybe (Sensitive Text)
$sel:documentId:GetDocumentPath' :: GetDocumentPath -> Text
$sel:fields:GetDocumentPath' :: GetDocumentPath -> Maybe Text
$sel:limit:GetDocumentPath' :: GetDocumentPath -> Maybe Natural
$sel:marker:GetDocumentPath' :: GetDocumentPath -> Maybe Text
$sel:authenticationToken:GetDocumentPath' :: GetDocumentPath -> Maybe (Sensitive Text)
..} =
[ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"Authentication" HeaderName -> Maybe (Sensitive Text) -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# Maybe (Sensitive Text)
authenticationToken,
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.ToPath GetDocumentPath where
toPath :: GetDocumentPath -> ByteString
toPath GetDocumentPath' {Maybe Natural
Maybe Text
Maybe (Sensitive Text)
Text
documentId :: Text
fields :: Maybe Text
limit :: Maybe Natural
marker :: Maybe Text
authenticationToken :: Maybe (Sensitive Text)
$sel:documentId:GetDocumentPath' :: GetDocumentPath -> Text
$sel:fields:GetDocumentPath' :: GetDocumentPath -> Maybe Text
$sel:limit:GetDocumentPath' :: GetDocumentPath -> Maybe Natural
$sel:marker:GetDocumentPath' :: GetDocumentPath -> Maybe Text
$sel:authenticationToken:GetDocumentPath' :: GetDocumentPath -> Maybe (Sensitive Text)
..} =
[ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ByteString
"/api/v1/documents/", Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
documentId, ByteString
"/path"]
instance Core.ToQuery GetDocumentPath where
toQuery :: GetDocumentPath -> QueryString
toQuery GetDocumentPath' {Maybe Natural
Maybe Text
Maybe (Sensitive Text)
Text
documentId :: Text
fields :: Maybe Text
limit :: Maybe Natural
marker :: Maybe Text
authenticationToken :: Maybe (Sensitive Text)
$sel:documentId:GetDocumentPath' :: GetDocumentPath -> Text
$sel:fields:GetDocumentPath' :: GetDocumentPath -> Maybe Text
$sel:limit:GetDocumentPath' :: GetDocumentPath -> Maybe Natural
$sel:marker:GetDocumentPath' :: GetDocumentPath -> Maybe Text
$sel:authenticationToken:GetDocumentPath' :: GetDocumentPath -> Maybe (Sensitive Text)
..} =
[QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"marker" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
marker,
ByteString
"limit" ByteString -> Maybe Natural -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Natural
limit,
ByteString
"fields" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
fields
]
data GetDocumentPathResponse = GetDocumentPathResponse'
{
GetDocumentPathResponse -> Maybe ResourcePath
path :: Prelude.Maybe ResourcePath,
GetDocumentPathResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetDocumentPathResponse -> GetDocumentPathResponse -> Bool
(GetDocumentPathResponse -> GetDocumentPathResponse -> Bool)
-> (GetDocumentPathResponse -> GetDocumentPathResponse -> Bool)
-> Eq GetDocumentPathResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetDocumentPathResponse -> GetDocumentPathResponse -> Bool
$c/= :: GetDocumentPathResponse -> GetDocumentPathResponse -> Bool
== :: GetDocumentPathResponse -> GetDocumentPathResponse -> Bool
$c== :: GetDocumentPathResponse -> GetDocumentPathResponse -> Bool
Prelude.Eq, ReadPrec [GetDocumentPathResponse]
ReadPrec GetDocumentPathResponse
Int -> ReadS GetDocumentPathResponse
ReadS [GetDocumentPathResponse]
(Int -> ReadS GetDocumentPathResponse)
-> ReadS [GetDocumentPathResponse]
-> ReadPrec GetDocumentPathResponse
-> ReadPrec [GetDocumentPathResponse]
-> Read GetDocumentPathResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetDocumentPathResponse]
$creadListPrec :: ReadPrec [GetDocumentPathResponse]
readPrec :: ReadPrec GetDocumentPathResponse
$creadPrec :: ReadPrec GetDocumentPathResponse
readList :: ReadS [GetDocumentPathResponse]
$creadList :: ReadS [GetDocumentPathResponse]
readsPrec :: Int -> ReadS GetDocumentPathResponse
$creadsPrec :: Int -> ReadS GetDocumentPathResponse
Prelude.Read, Int -> GetDocumentPathResponse -> ShowS
[GetDocumentPathResponse] -> ShowS
GetDocumentPathResponse -> String
(Int -> GetDocumentPathResponse -> ShowS)
-> (GetDocumentPathResponse -> String)
-> ([GetDocumentPathResponse] -> ShowS)
-> Show GetDocumentPathResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetDocumentPathResponse] -> ShowS
$cshowList :: [GetDocumentPathResponse] -> ShowS
show :: GetDocumentPathResponse -> String
$cshow :: GetDocumentPathResponse -> String
showsPrec :: Int -> GetDocumentPathResponse -> ShowS
$cshowsPrec :: Int -> GetDocumentPathResponse -> ShowS
Prelude.Show, (forall x.
GetDocumentPathResponse -> Rep GetDocumentPathResponse x)
-> (forall x.
Rep GetDocumentPathResponse x -> GetDocumentPathResponse)
-> Generic GetDocumentPathResponse
forall x. Rep GetDocumentPathResponse x -> GetDocumentPathResponse
forall x. GetDocumentPathResponse -> Rep GetDocumentPathResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetDocumentPathResponse x -> GetDocumentPathResponse
$cfrom :: forall x. GetDocumentPathResponse -> Rep GetDocumentPathResponse x
Prelude.Generic)
newGetDocumentPathResponse ::
Prelude.Int ->
GetDocumentPathResponse
newGetDocumentPathResponse :: Int -> GetDocumentPathResponse
newGetDocumentPathResponse Int
pHttpStatus_ =
GetDocumentPathResponse' :: Maybe ResourcePath -> Int -> GetDocumentPathResponse
GetDocumentPathResponse'
{ $sel:path:GetDocumentPathResponse' :: Maybe ResourcePath
path = Maybe ResourcePath
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetDocumentPathResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getDocumentPathResponse_path :: Lens.Lens' GetDocumentPathResponse (Prelude.Maybe ResourcePath)
getDocumentPathResponse_path :: (Maybe ResourcePath -> f (Maybe ResourcePath))
-> GetDocumentPathResponse -> f GetDocumentPathResponse
getDocumentPathResponse_path = (GetDocumentPathResponse -> Maybe ResourcePath)
-> (GetDocumentPathResponse
-> Maybe ResourcePath -> GetDocumentPathResponse)
-> Lens
GetDocumentPathResponse
GetDocumentPathResponse
(Maybe ResourcePath)
(Maybe ResourcePath)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetDocumentPathResponse' {Maybe ResourcePath
path :: Maybe ResourcePath
$sel:path:GetDocumentPathResponse' :: GetDocumentPathResponse -> Maybe ResourcePath
path} -> Maybe ResourcePath
path) (\s :: GetDocumentPathResponse
s@GetDocumentPathResponse' {} Maybe ResourcePath
a -> GetDocumentPathResponse
s {$sel:path:GetDocumentPathResponse' :: Maybe ResourcePath
path = Maybe ResourcePath
a} :: GetDocumentPathResponse)
getDocumentPathResponse_httpStatus :: Lens.Lens' GetDocumentPathResponse Prelude.Int
getDocumentPathResponse_httpStatus :: (Int -> f Int)
-> GetDocumentPathResponse -> f GetDocumentPathResponse
getDocumentPathResponse_httpStatus = (GetDocumentPathResponse -> Int)
-> (GetDocumentPathResponse -> Int -> GetDocumentPathResponse)
-> Lens GetDocumentPathResponse GetDocumentPathResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetDocumentPathResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetDocumentPathResponse' :: GetDocumentPathResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetDocumentPathResponse
s@GetDocumentPathResponse' {} Int
a -> GetDocumentPathResponse
s {$sel:httpStatus:GetDocumentPathResponse' :: Int
httpStatus = Int
a} :: GetDocumentPathResponse)
instance Prelude.NFData GetDocumentPathResponse