{-# OPTIONS -Wno-ambiguous-fields #-}
module Test.EJPD
( testEJPDRequest,
testEJPDRequestRemote,
)
where
import API.Brig
import qualified API.BrigInternal as BI
import API.Galley
import API.Gundeck
import Control.Lens hiding ((.=))
import Control.Monad.Reader
import qualified Data.Aeson as A
import Data.Aeson.Lens
import Data.String.Conversions (cs)
import qualified Data.UUID as UUID
import qualified Data.UUID.V4 as UUID
import qualified Network.Wreq as Wreq
import SetupHelpers
import Testlib.JSON
import Testlib.Prelude
setupEJPD :: (HasCallStack) => App (A.Value, A.Value, A.Value, A.Value, A.Value)
setupEJPD :: HasCallStack => App (Value, Value, Value, Value, Value)
setupEJPD =
do
(Value
owner1, String
tid1, [Value
usr1, Value
usr2]) <- Domain -> Int -> App (Value, String, [Value])
forall domain.
(HasCallStack, MakesValue domain) =>
domain -> Int -> App (Value, String, [Value])
createTeam Domain
OwnDomain Int
3
String
handle1 <- IO String -> App String
forall a. IO a -> App a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO String -> App String) -> IO String -> App String
forall a b. (a -> b) -> a -> b
$ IO UUID
UUID.nextRandom IO UUID -> (UUID -> String) -> IO String
forall (f :: * -> *) a b. Functor f => f a -> (a -> b) -> f b
<&> (String
"usr1-handle-" <>) (String -> String) -> (UUID -> String) -> UUID -> String
forall b c a. (b -> c) -> (a -> b) -> a -> c
. UUID -> String
UUID.toString
String
handle2 <- IO String -> App String
forall a. IO a -> App a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO String -> App String) -> IO String -> App String
forall a b. (a -> b) -> a -> b
$ IO UUID
UUID.nextRandom IO UUID -> (UUID -> String) -> IO String
forall (f :: * -> *) a b. Functor f => f a -> (a -> b) -> f b
<&> (String
"usr2-handle-" <>) (String -> String) -> (UUID -> String) -> UUID -> String
forall b c a. (b -> c) -> (a -> b) -> a -> c
. UUID -> String
UUID.toString
String
owner1Handle <- IO String -> App String
forall a. IO a -> App a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO String -> App String) -> IO String -> App String
forall a b. (a -> b) -> a -> b
$ IO UUID
UUID.nextRandom IO UUID -> (UUID -> String) -> IO String
forall (f :: * -> *) a b. Functor f => f a -> (a -> b) -> f b
<&> (String
"owner1-handle-" <>) (String -> String) -> (UUID -> String) -> UUID -> String
forall b c a. (b -> c) -> (a -> b) -> a -> c
. UUID -> String
UUID.toString
App Response -> App ()
forall (f :: * -> *) a. Functor f => f a -> f ()
void (App Response -> App ()) -> App Response -> App ()
forall a b. (a -> b) -> a -> b
$ Value -> String -> App Response
forall user.
(HasCallStack, MakesValue user) =>
user -> String -> App Response
putHandle Value
usr1 String
handle1
App Response -> App ()
forall (f :: * -> *) a. Functor f => f a -> f ()
void (App Response -> App ()) -> App Response -> App ()
forall a b. (a -> b) -> a -> b
$ Value -> String -> App Response
forall user.
(HasCallStack, MakesValue user) =>
user -> String -> App Response
putHandle Value
usr2 String
handle2
App Response -> App ()
forall (f :: * -> *) a. Functor f => f a -> f ()
void (App Response -> App ()) -> App Response -> App ()
forall a b. (a -> b) -> a -> b
$ Value -> String -> App Response
forall user.
(HasCallStack, MakesValue user) =>
user -> String -> App Response
putHandle Value
owner1 String
owner1Handle
String
email3 <- IO String -> App String
forall a. IO a -> App a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO String -> App String) -> IO String -> App String
forall a b. (a -> b) -> a -> b
$ IO UUID
UUID.nextRandom IO UUID -> (UUID -> String) -> IO String
forall (f :: * -> *) a b. Functor f => f a -> (a -> b) -> f b
<&> \UUID
uuid -> String
"usr3-" String -> String -> String
forall a. Semigroup a => a -> a -> a
<> UUID -> String
UUID.toString UUID
uuid String -> String -> String
forall a. Semigroup a => a -> a -> a
<> String
"@example.com"
String
email4 <- IO String -> App String
forall a. IO a -> App a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO String -> App String) -> IO String -> App String
forall a b. (a -> b) -> a -> b
$ IO UUID
UUID.nextRandom IO UUID -> (UUID -> String) -> IO String
forall (f :: * -> *) a b. Functor f => f a -> (a -> b) -> f b
<&> \UUID
uuid -> String
"usr4-" String -> String -> String
forall a. Semigroup a => a -> a -> a
<> UUID -> String
UUID.toString UUID
uuid String -> String -> String
forall a. Semigroup a => a -> a -> a
<> String
"@example.com"
String
email5 <- IO String -> App String
forall a. IO a -> App a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO String -> App String) -> IO String -> App String
forall a b. (a -> b) -> a -> b
$ IO UUID
UUID.nextRandom IO UUID -> (UUID -> String) -> IO String
forall (f :: * -> *) a b. Functor f => f a -> (a -> b) -> f b
<&> \UUID
uuid -> String
"usr5-" String -> String -> String
forall a. Semigroup a => a -> a -> a
<> UUID -> String
UUID.toString UUID
uuid String -> String -> String
forall a. Semigroup a => a -> a -> a
<> String
"@example.com"
Value
usr3 <- Domain -> CreateUser -> App Value
forall domain.
(HasCallStack, MakesValue domain) =>
domain -> CreateUser -> App Value
randomUser Domain
OwnDomain CreateUser
forall a. Default a => a
def {BI.email = Just email3, BI.name = Just "usr3"}
Value
usr4 <- Domain -> CreateUser -> App Value
forall domain.
(HasCallStack, MakesValue domain) =>
domain -> CreateUser -> App Value
randomUser Domain
OwnDomain CreateUser
forall a. Default a => a
def {BI.email = Just email4, BI.name = Just "usr4"}
Value
usr5 <- Domain -> CreateUser -> App Value
forall domain.
(HasCallStack, MakesValue domain) =>
domain -> CreateUser -> App Value
randomUser Domain
OwnDomain CreateUser
forall a. Default a => a
def {BI.email = Just email5, BI.name = Just "usr5"}
Value
usrRemote <- Domain -> CreateUser -> App Value
forall domain.
(HasCallStack, MakesValue domain) =>
domain -> CreateUser -> App Value
randomUser Domain
OtherDomain CreateUser
forall a. Default a => a
def {BI.email = Nothing, BI.name = Just "usrRemote"}
String
handle3 <- IO String -> App String
forall a. IO a -> App a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO String -> App String) -> IO String -> App String
forall a b. (a -> b) -> a -> b
$ IO UUID
UUID.nextRandom IO UUID -> (UUID -> String) -> IO String
forall (f :: * -> *) a b. Functor f => f a -> (a -> b) -> f b
<&> (String
"usr3-handle-" <>) (String -> String) -> (UUID -> String) -> UUID -> String
forall b c a. (b -> c) -> (a -> b) -> a -> c
. UUID -> String
UUID.toString
String
handle4 <- IO String -> App String
forall a. IO a -> App a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO String -> App String) -> IO String -> App String
forall a b. (a -> b) -> a -> b
$ IO UUID
UUID.nextRandom IO UUID -> (UUID -> String) -> IO String
forall (f :: * -> *) a b. Functor f => f a -> (a -> b) -> f b
<&> (String
"usr4-handle-" <>) (String -> String) -> (UUID -> String) -> UUID -> String
forall b c a. (b -> c) -> (a -> b) -> a -> c
. UUID -> String
UUID.toString
String
handle5 <- IO String -> App String
forall a. IO a -> App a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO String -> App String) -> IO String -> App String
forall a b. (a -> b) -> a -> b
$ IO UUID
UUID.nextRandom IO UUID -> (UUID -> String) -> IO String
forall (f :: * -> *) a b. Functor f => f a -> (a -> b) -> f b
<&> (String
"usr5-handle-" <>) (String -> String) -> (UUID -> String) -> UUID -> String
forall b c a. (b -> c) -> (a -> b) -> a -> c
. UUID -> String
UUID.toString
App Response -> App ()
forall (f :: * -> *) a. Functor f => f a -> f ()
void (App Response -> App ()) -> App Response -> App ()
forall a b. (a -> b) -> a -> b
$ Value -> String -> App Response
forall user.
(HasCallStack, MakesValue user) =>
user -> String -> App Response
putHandle Value
usr3 String
handle3
App Response -> App ()
forall (f :: * -> *) a. Functor f => f a -> f ()
void (App Response -> App ()) -> App Response -> App ()
forall a b. (a -> b) -> a -> b
$ Value -> String -> App Response
forall user.
(HasCallStack, MakesValue user) =>
user -> String -> App Response
putHandle Value
usr4 String
handle4
App Response -> App ()
forall (f :: * -> *) a. Functor f => f a -> f ()
void (App Response -> App ()) -> App Response -> App ()
forall a b. (a -> b) -> a -> b
$ Value -> String -> App Response
forall user.
(HasCallStack, MakesValue user) =>
user -> String -> App Response
putHandle Value
usr5 String
handle5
Value -> Value -> App ()
forall alice bob.
(HasCallStack, MakesValue alice, MakesValue bob) =>
alice -> bob -> App ()
connectTwoUsers Value
usr3 Value
usr5
[Value] -> App ()
forall usr. (HasCallStack, MakesValue usr) => [usr] -> App ()
connectUsers [Value
usr2, Value
usr4, Value
usr5, Value
usrRemote]
[String]
toks1 <- do
String
cl11 <- App Value -> App String
forall a. (HasCallStack, MakesValue a) => a -> App String
objId (App Value -> App String) -> App Value -> App String
forall a b. (a -> b) -> a -> b
$ App Value -> AddClient -> App Response
forall user.
(HasCallStack, MakesValue user) =>
user -> AddClient -> App Response
addClient (Value
usr1 Value -> String -> App Value
forall a. (HasCallStack, MakesValue a) => a -> String -> App Value
%. String
"qualified_id") AddClient
forall a. Default a => a
def App Response -> (Response -> App Value) -> App Value
forall a b. App a -> (a -> App b) -> App b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= HasCallStack => Int -> Response -> App Value
Int -> Response -> App Value
getJSON Int
201
App Response -> (Response -> App [String]) -> App [String]
forall a.
HasCallStack =>
App Response -> (Response -> App a) -> App a
bindResponse (Value -> String -> GeneratePushToken -> App Response
forall user client.
(HasCallStack, MakesValue user, MakesValue client) =>
user -> client -> GeneratePushToken -> App Response
generateAndPostPushToken Value
usr1 String
cl11 GeneratePushToken
forall a. Default a => a
def) ((Response -> App [String]) -> App [String])
-> (Response -> App [String]) -> App [String]
forall a b. (a -> b) -> a -> b
$ \Response
resp -> do
Response
resp.status Int -> Int -> App ()
forall a. (MakesValue a, HasCallStack) => a -> Int -> App ()
`shouldMatchInt` Int
201
String
tok <- Response
resp.json App Value -> String -> App Value
forall a. (HasCallStack, MakesValue a) => a -> String -> App Value
%. String
"token" App Value -> (App Value -> App String) -> App String
forall a b. a -> (a -> b) -> b
& App Value -> App String
forall a. (HasCallStack, MakesValue a) => a -> App String
asString
[String] -> App [String]
forall a. a -> App a
forall (f :: * -> *) a. Applicative f => a -> f a
pure [String
tok]
[String]
toks2 <- do
String
cl21 <- App Value -> App String
forall a. (HasCallStack, MakesValue a) => a -> App String
objId (App Value -> App String) -> App Value -> App String
forall a b. (a -> b) -> a -> b
$ App Value -> AddClient -> App Response
forall user.
(HasCallStack, MakesValue user) =>
user -> AddClient -> App Response
addClient (Value
usr2 Value -> String -> App Value
forall a. (HasCallStack, MakesValue a) => a -> String -> App Value
%. String
"qualified_id") AddClient
forall a. Default a => a
def App Response -> (Response -> App Value) -> App Value
forall a b. App a -> (a -> App b) -> App b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= HasCallStack => Int -> Response -> App Value
Int -> Response -> App Value
getJSON Int
201
String
cl22 <- App Value -> App String
forall a. (HasCallStack, MakesValue a) => a -> App String
objId (App Value -> App String) -> App Value -> App String
forall a b. (a -> b) -> a -> b
$ App Value -> AddClient -> App Response
forall user.
(HasCallStack, MakesValue user) =>
user -> AddClient -> App Response
addClient (Value
usr2 Value -> String -> App Value
forall a. (HasCallStack, MakesValue a) => a -> String -> App Value
%. String
"qualified_id") AddClient
forall a. Default a => a
def App Response -> (Response -> App Value) -> App Value
forall a b. App a -> (a -> App b) -> App b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= HasCallStack => Int -> Response -> App Value
Int -> Response -> App Value
getJSON Int
201
String
t1 <- App Response -> (Response -> App String) -> App String
forall a.
HasCallStack =>
App Response -> (Response -> App a) -> App a
bindResponse (Value -> String -> GeneratePushToken -> App Response
forall user client.
(HasCallStack, MakesValue user, MakesValue client) =>
user -> client -> GeneratePushToken -> App Response
generateAndPostPushToken Value
usr2 String
cl21 GeneratePushToken
forall a. Default a => a
def) ((Response -> App String) -> App String)
-> (Response -> App String) -> App String
forall a b. (a -> b) -> a -> b
$ \Response
resp -> do
Response
resp.status Int -> Int -> App ()
forall a. (MakesValue a, HasCallStack) => a -> Int -> App ()
`shouldMatchInt` Int
201
Response
resp.json App Value -> String -> App Value
forall a. (HasCallStack, MakesValue a) => a -> String -> App Value
%. String
"token" App Value -> (App Value -> App String) -> App String
forall a b. a -> (a -> b) -> b
& App Value -> App String
forall a. (HasCallStack, MakesValue a) => a -> App String
asString
String
t2 <- App Response -> (Response -> App String) -> App String
forall a.
HasCallStack =>
App Response -> (Response -> App a) -> App a
bindResponse (Value -> String -> GeneratePushToken -> App Response
forall user client.
(HasCallStack, MakesValue user, MakesValue client) =>
user -> client -> GeneratePushToken -> App Response
generateAndPostPushToken Value
usr2 String
cl22 GeneratePushToken
forall a. Default a => a
def) ((Response -> App String) -> App String)
-> (Response -> App String) -> App String
forall a b. (a -> b) -> a -> b
$ \Response
resp -> do
Response
resp.status Int -> Int -> App ()
forall a. (MakesValue a, HasCallStack) => a -> Int -> App ()
`shouldMatchInt` Int
201
Response
resp.json App Value -> String -> App Value
forall a. (HasCallStack, MakesValue a) => a -> String -> App Value
%. String
"token" App Value -> (App Value -> App String) -> App String
forall a b. a -> (a -> b) -> b
& App Value -> App String
forall a. (HasCallStack, MakesValue a) => a -> App String
asString
[String] -> App [String]
forall a. a -> App a
forall (f :: * -> *) a. Applicative f => a -> f a
pure [String
t1, String
t2]
[String]
toks4 <- do
String
cl41 <- App Value -> App String
forall a. (HasCallStack, MakesValue a) => a -> App String
objId (App Value -> App String) -> App Value -> App String
forall a b. (a -> b) -> a -> b
$ App Value -> AddClient -> App Response
forall user.
(HasCallStack, MakesValue user) =>
user -> AddClient -> App Response
addClient (Value
usr4 Value -> String -> App Value
forall a. (HasCallStack, MakesValue a) => a -> String -> App Value
%. String
"qualified_id") AddClient
forall a. Default a => a
def App Response -> (Response -> App Value) -> App Value
forall a b. App a -> (a -> App b) -> App b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= HasCallStack => Int -> Response -> App Value
Int -> Response -> App Value
getJSON Int
201
App Response -> (Response -> App [String]) -> App [String]
forall a.
HasCallStack =>
App Response -> (Response -> App a) -> App a
bindResponse (Value -> String -> GeneratePushToken -> App Response
forall user client.
(HasCallStack, MakesValue user, MakesValue client) =>
user -> client -> GeneratePushToken -> App Response
generateAndPostPushToken Value
usr4 String
cl41 GeneratePushToken
forall a. Default a => a
def) ((Response -> App [String]) -> App [String])
-> (Response -> App [String]) -> App [String]
forall a b. (a -> b) -> a -> b
$ \Response
resp -> do
Response
resp.status Int -> Int -> App ()
forall a. (MakesValue a, HasCallStack) => a -> Int -> App ()
`shouldMatchInt` Int
201
String
tok <- Response
resp.json App Value -> String -> App Value
forall a. (HasCallStack, MakesValue a) => a -> String -> App Value
%. String
"token" App Value -> (App Value -> App String) -> App String
forall a b. a -> (a -> b) -> b
& App Value -> App String
forall a. (HasCallStack, MakesValue a) => a -> App String
asString
[String] -> App [String]
forall a. a -> App a
forall (f :: * -> *) a. Applicative f => a -> f a
pure [String
tok]
[String]
assets1 <- do
(String, String)
a1 <- Value -> App (String, String)
forall usr.
(HasCallStack, MakesValue usr) =>
usr -> App (String, String)
uploadDownloadProfilePicture Value
usr1
(String, String)
a2 <- Value -> App (String, String)
forall usr.
(HasCallStack, MakesValue usr) =>
usr -> App (String, String)
uploadDownloadProfilePicture Value
usr1
[String] -> App [String]
forall a. a -> App a
forall (f :: * -> *) a. Applicative f => a -> f a
pure ([String] -> App [String]) -> [String] -> App [String]
forall a b. (a -> b) -> a -> b
$ (String, String) -> String
forall a b. (a, b) -> b
snd ((String, String) -> String) -> [(String, String)] -> [String]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [(String, String)
a1, (String, String)
a2]
[String]
assets2 <- (String -> [String] -> [String]
forall a. a -> [a] -> [a]
: []) (String -> [String])
-> ((String, String) -> String) -> (String, String) -> [String]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (String, String) -> String
forall a b. (a, b) -> b
snd ((String, String) -> [String])
-> App (String, String) -> App [String]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Value -> App (String, String)
forall usr.
(HasCallStack, MakesValue usr) =>
usr -> App (String, String)
uploadDownloadProfilePicture Value
usr2
[String]
assets3 <- (String -> [String] -> [String]
forall a. a -> [a] -> [a]
: []) (String -> [String])
-> ((String, String) -> String) -> (String, String) -> [String]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (String, String) -> String
forall a b. (a, b) -> b
snd ((String, String) -> [String])
-> App (String, String) -> App [String]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Value -> App (String, String)
forall usr.
(HasCallStack, MakesValue usr) =>
usr -> App (String, String)
uploadDownloadProfilePicture Value
usr3
[String]
assets4 <- (String -> [String] -> [String]
forall a. a -> [a] -> [a]
: []) (String -> [String])
-> ((String, String) -> String) -> (String, String) -> [String]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (String, String) -> String
forall a b. (a, b) -> b
snd ((String, String) -> [String])
-> App (String, String) -> App [String]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Value -> App (String, String)
forall usr.
(HasCallStack, MakesValue usr) =>
usr -> App (String, String)
uploadDownloadProfilePicture Value
usr4
(Maybe [Value]
convs1, Maybe [Value]
convs2, Maybe [Value]
convs3, Maybe [Value]
convs4, Maybe [Value]
convs5) <- do
let parse :: Response -> App Value
parse :: Response -> App Value
parse Response
resp =
HasCallStack => Int -> Response -> App Value
Int -> Response -> App Value
getJSON Int
201 Response
resp App Value -> (Value -> Value) -> App Value
forall (f :: * -> *) a b. Functor f => f a -> (a -> b) -> f b
<&> \Value
val ->
[Pair] -> Value
object
[ String
"conv_name" String -> Text -> Pair
forall a. ToJSON a => String -> a -> Pair
.= do Value
val Value -> Getting (Endo Text) Value Text -> Text
forall s a. HasCallStack => s -> Getting (Endo a) s a -> a
^?! Key -> Traversal' Value Value
forall t. AsValue t => Key -> Traversal' t Value
key (String -> Key
forall a. IsString a => String -> a
fromString String
"name") ((Value -> Const (Endo Text) Value)
-> Value -> Const (Endo Text) Value)
-> Getting (Endo Text) Value Text -> Getting (Endo Text) Value Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Getting (Endo Text) Value Text
forall t. AsValue t => Prism' t Text
Prism' Value Text
_String,
String
"conv_id" String -> KeyMap Value -> Pair
forall a. ToJSON a => String -> a -> Pair
.= do Value
val Value
-> Getting (Endo (KeyMap Value)) Value (KeyMap Value)
-> KeyMap Value
forall s a. HasCallStack => s -> Getting (Endo a) s a -> a
^?! Key -> Traversal' Value Value
forall t. AsValue t => Key -> Traversal' t Value
key (String -> Key
forall a. IsString a => String -> a
fromString String
"qualified_id") ((Value -> Const (Endo (KeyMap Value)) Value)
-> Value -> Const (Endo (KeyMap Value)) Value)
-> Getting (Endo (KeyMap Value)) Value (KeyMap Value)
-> Getting (Endo (KeyMap Value)) Value (KeyMap Value)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Getting (Endo (KeyMap Value)) Value (KeyMap Value)
forall t. AsValue t => Prism' t (KeyMap Value)
Prism' Value (KeyMap Value)
_Object
]
Value
conv1 <-
Response -> App Value
parse
(Response -> App Value) -> App Response -> App Value
forall (m :: * -> *) a b. Monad m => (a -> m b) -> m a -> m b
=<< Value -> CreateConv -> App Response
forall user.
(HasCallStack, MakesValue user) =>
user -> CreateConv -> App Response
postConversation Value
usr1 do
CreateConv
defMLS {name = Just "11", qualifiedUsers = [], team = Just tid1}
Value
conv12 <-
Response -> App Value
parse
(Response -> App Value) -> App Response -> App Value
forall (m :: * -> *) a b. Monad m => (a -> m b) -> m a -> m b
=<< Value -> CreateConv -> App Response
forall user.
(HasCallStack, MakesValue user) =>
user -> CreateConv -> App Response
postConversation Value
usr1 do
CreateConv
defProteus {name = Just "12", qualifiedUsers = [usr2], team = Just tid1}
Value
conv35 <-
Response -> App Value
parse
(Response -> App Value) -> App Response -> App Value
forall (m :: * -> *) a b. Monad m => (a -> m b) -> m a -> m b
=<< Value -> CreateConv -> App Response
forall user.
(HasCallStack, MakesValue user) =>
user -> CreateConv -> App Response
postConversation
Value
usr3
do CreateConv
defProteus {name = Just "35", qualifiedUsers = [usr5]}
Value
conv524 <-
Response -> App Value
parse
(Response -> App Value) -> App Response -> App Value
forall (m :: * -> *) a b. Monad m => (a -> m b) -> m a -> m b
=<< Value -> CreateConv -> App Response
forall user.
(HasCallStack, MakesValue user) =>
user -> CreateConv -> App Response
postConversation Value
usr5 do
CreateConv
defProteus {name = Just "524", qualifiedUsers = [usr2, usr4]}
(Maybe [Value], Maybe [Value], Maybe [Value], Maybe [Value],
Maybe [Value])
-> App
(Maybe [Value], Maybe [Value], Maybe [Value], Maybe [Value],
Maybe [Value])
forall a. a -> App a
forall (f :: * -> *) a. Applicative f => a -> f a
pure ([Value] -> Maybe [Value]
forall a. a -> Maybe a
Just ([Value
conv1, Value
conv12]), [Value] -> Maybe [Value]
forall a. a -> Maybe a
Just ([Value
conv12, Value
conv524]), [Value] -> Maybe [Value]
forall a. a -> Maybe a
Just [Value
conv35], [Value] -> Maybe [Value]
forall a. a -> Maybe a
Just [Value
conv524], [Value] -> Maybe [Value]
forall a. a -> Maybe a
Just [Value
conv35, Value
conv524])
HasCallStack => Response -> App ()
Response -> App ()
assertSuccess (Response -> App ()) -> App Response -> App ()
forall (m :: * -> *) a b. Monad m => (a -> m b) -> m a -> m b
=<< Value -> CreateConv -> App Response
forall user.
(HasCallStack, MakesValue user) =>
user -> CreateConv -> App Response
postConversation Value
usrRemote do
CreateConv
defProteus {name = Just "remote245", qualifiedUsers = [usr2, usr4, usr5]}
let usr2contacts :: Maybe [(Value, String)]
usr2contacts = [(Value, String)] -> Maybe [(Value, String)]
forall a. a -> Maybe a
Just ([(Value, String)] -> Maybe [(Value, String)])
-> [(Value, String)] -> Maybe [(Value, String)]
forall a b. (a -> b) -> a -> b
$ (,String
"accepted") (Value -> (Value, String)) -> [Value] -> [(Value, String)]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [Value
ejpd4, Value
ejpd5]
usr3contacts :: Maybe [(Value, String)]
usr3contacts = [(Value, String)] -> Maybe [(Value, String)]
forall a. a -> Maybe a
Just ([(Value, String)] -> Maybe [(Value, String)])
-> [(Value, String)] -> Maybe [(Value, String)]
forall a b. (a -> b) -> a -> b
$ (,String
"accepted") (Value -> (Value, String)) -> [Value] -> [(Value, String)]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [Value
ejpd5]
usr4contacts :: Maybe [(Value, String)]
usr4contacts = [(Value, String)] -> Maybe [(Value, String)]
forall a. a -> Maybe a
Just ([(Value, String)] -> Maybe [(Value, String)])
-> [(Value, String)] -> Maybe [(Value, String)]
forall a b. (a -> b) -> a -> b
$ (,String
"accepted") (Value -> (Value, String)) -> [Value] -> [(Value, String)]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [Value
ejpd2, Value
ejpd5]
usr5contacts :: Maybe [(Value, String)]
usr5contacts = [(Value, String)] -> Maybe [(Value, String)]
forall a. a -> Maybe a
Just ([(Value, String)] -> Maybe [(Value, String)])
-> [(Value, String)] -> Maybe [(Value, String)]
forall a b. (a -> b) -> a -> b
$ (,String
"accepted") (Value -> (Value, String)) -> [Value] -> [(Value, String)]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [Value
ejpd2, Value
ejpd3, Value
ejpd4]
ejpd0 :: Value
ejpd0 = HasCallStack =>
Value
-> Maybe String
-> [String]
-> Maybe [(Value, String)]
-> Maybe ([Value], String)
-> Maybe [Value]
-> Maybe [String]
-> Value
Value
-> Maybe String
-> [String]
-> Maybe [(Value, String)]
-> Maybe ([Value], String)
-> Maybe [Value]
-> Maybe [String]
-> Value
mkUsr Value
owner1 (String -> Maybe String
forall a. a -> Maybe a
Just String
owner1Handle) [] Maybe [(Value, String)]
forall a. Maybe a
Nothing (([Value], String) -> Maybe ([Value], String)
forall a. a -> Maybe a
Just ([Value
ejpd1, Value
ejpd2], String
"list_complete")) Maybe [Value]
forall a. Maybe a
Nothing Maybe [String]
forall a. Maybe a
Nothing
ejpd1 :: Value
ejpd1 = HasCallStack =>
Value
-> Maybe String
-> [String]
-> Maybe [(Value, String)]
-> Maybe ([Value], String)
-> Maybe [Value]
-> Maybe [String]
-> Value
Value
-> Maybe String
-> [String]
-> Maybe [(Value, String)]
-> Maybe ([Value], String)
-> Maybe [Value]
-> Maybe [String]
-> Value
mkUsr Value
usr1 (String -> Maybe String
forall a. a -> Maybe a
Just String
handle1) [String]
toks1 Maybe [(Value, String)]
forall a. Maybe a
Nothing (([Value], String) -> Maybe ([Value], String)
forall a. a -> Maybe a
Just ([Value
ejpd0, Value
ejpd2], String
"list_complete")) Maybe [Value]
convs1 ([String] -> Maybe [String]
forall a. a -> Maybe a
Just [String]
assets1)
ejpd2 :: Value
ejpd2 = HasCallStack =>
Value
-> Maybe String
-> [String]
-> Maybe [(Value, String)]
-> Maybe ([Value], String)
-> Maybe [Value]
-> Maybe [String]
-> Value
Value
-> Maybe String
-> [String]
-> Maybe [(Value, String)]
-> Maybe ([Value], String)
-> Maybe [Value]
-> Maybe [String]
-> Value
mkUsr Value
usr2 (String -> Maybe String
forall a. a -> Maybe a
Just String
handle2) [String]
toks2 Maybe [(Value, String)]
usr2contacts (([Value], String) -> Maybe ([Value], String)
forall a. a -> Maybe a
Just ([Value
ejpd0, Value
ejpd1], String
"list_complete")) Maybe [Value]
convs2 ([String] -> Maybe [String]
forall a. a -> Maybe a
Just [String]
assets2)
ejpd3 :: Value
ejpd3 = HasCallStack =>
Value
-> Maybe String
-> [String]
-> Maybe [(Value, String)]
-> Maybe ([Value], String)
-> Maybe [Value]
-> Maybe [String]
-> Value
Value
-> Maybe String
-> [String]
-> Maybe [(Value, String)]
-> Maybe ([Value], String)
-> Maybe [Value]
-> Maybe [String]
-> Value
mkUsr Value
usr3 (String -> Maybe String
forall a. a -> Maybe a
Just String
handle3) [] Maybe [(Value, String)]
usr3contacts Maybe ([Value], String)
forall a. Maybe a
Nothing Maybe [Value]
convs3 ([String] -> Maybe [String]
forall a. a -> Maybe a
Just [String]
assets3)
ejpd4 :: Value
ejpd4 = HasCallStack =>
Value
-> Maybe String
-> [String]
-> Maybe [(Value, String)]
-> Maybe ([Value], String)
-> Maybe [Value]
-> Maybe [String]
-> Value
Value
-> Maybe String
-> [String]
-> Maybe [(Value, String)]
-> Maybe ([Value], String)
-> Maybe [Value]
-> Maybe [String]
-> Value
mkUsr Value
usr4 (String -> Maybe String
forall a. a -> Maybe a
Just String
handle4) [String]
toks4 Maybe [(Value, String)]
usr4contacts Maybe ([Value], String)
forall a. Maybe a
Nothing Maybe [Value]
convs4 ([String] -> Maybe [String]
forall a. a -> Maybe a
Just [String]
assets4)
ejpd5 :: Value
ejpd5 = HasCallStack =>
Value
-> Maybe String
-> [String]
-> Maybe [(Value, String)]
-> Maybe ([Value], String)
-> Maybe [Value]
-> Maybe [String]
-> Value
Value
-> Maybe String
-> [String]
-> Maybe [(Value, String)]
-> Maybe ([Value], String)
-> Maybe [Value]
-> Maybe [String]
-> Value
mkUsr Value
usr5 (String -> Maybe String
forall a. a -> Maybe a
Just String
handle5) [] Maybe [(Value, String)]
usr5contacts Maybe ([Value], String)
forall a. Maybe a
Nothing Maybe [Value]
convs5 Maybe [String]
forall a. Maybe a
Nothing
(Value, Value, Value, Value, Value)
-> App (Value, Value, Value, Value, Value)
forall a. a -> App a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (Value
ejpd1, Value
ejpd2, Value
ejpd3, Value
ejpd4, Value
ejpd5)
where
mkUsr ::
(HasCallStack) =>
A.Value ->
Maybe String ->
[String ] ->
Maybe [(A.Value , String )] ->
Maybe ([A.Value ], String ) ->
Maybe [A.Value] ->
Maybe [String ] ->
A.Value
mkUsr :: HasCallStack =>
Value
-> Maybe String
-> [String]
-> Maybe [(Value, String)]
-> Maybe ([Value], String)
-> Maybe [Value]
-> Maybe [String]
-> Value
mkUsr Value
usr Maybe String
hdl [String]
toks Maybe [(Value, String)]
contacts Maybe ([Value], String)
teamContacts Maybe [Value]
convs Maybe [String]
assets = Value
result
where
result :: Value
result =
[Pair] -> Value
object
[
String
"UserId" String -> Maybe Value -> Pair
forall a. ToJSON a => String -> a -> Pair
.= (Value
usr Value -> Getting (First Value) Value Value -> Maybe Value
forall s a. s -> Getting (First a) s a -> Maybe a
^? Key -> Traversal' Value Value
forall t. AsValue t => Key -> Traversal' t Value
key (String -> Key
forall a. IsString a => String -> a
fromString String
"qualified_id")),
String
"TeamId" String -> Maybe Value -> Pair
forall a. ToJSON a => String -> a -> Pair
.= (Value
usr Value -> Getting (First Value) Value Value -> Maybe Value
forall s a. s -> Getting (First a) s a -> Maybe a
^? Key -> Traversal' Value Value
forall t. AsValue t => Key -> Traversal' t Value
key (String -> Key
forall a. IsString a => String -> a
fromString String
"team")),
String
"Name" String -> Maybe Value -> Pair
forall a. ToJSON a => String -> a -> Pair
.= (Value
usr Value -> Getting (First Value) Value Value -> Maybe Value
forall s a. s -> Getting (First a) s a -> Maybe a
^? Key -> Traversal' Value Value
forall t. AsValue t => Key -> Traversal' t Value
key (String -> Key
forall a. IsString a => String -> a
fromString String
"name")),
String
"Handle" String -> Maybe String -> Pair
forall a. ToJSON a => String -> a -> Pair
.= Maybe String
hdl,
String
"Email" String -> Maybe Value -> Pair
forall a. ToJSON a => String -> a -> Pair
.= (Value
usr Value -> Getting (First Value) Value Value -> Maybe Value
forall s a. s -> Getting (First a) s a -> Maybe a
^? Key -> Traversal' Value Value
forall t. AsValue t => Key -> Traversal' t Value
key (String -> Key
forall a. IsString a => String -> a
fromString String
"email")),
String
"Phone" String -> Maybe Value -> Pair
forall a. ToJSON a => String -> a -> Pair
.= (Value
usr Value -> Getting (First Value) Value Value -> Maybe Value
forall s a. s -> Getting (First a) s a -> Maybe a
^? Key -> Traversal' Value Value
forall t. AsValue t => Key -> Traversal' t Value
key (String -> Key
forall a. IsString a => String -> a
fromString String
"phone")),
String
"PushTokens" String -> [String] -> Pair
forall a. ToJSON a => String -> a -> Pair
.= [String]
toks,
String
"Contacts"
String -> Maybe [Value] -> Pair
forall a. ToJSON a => String -> a -> Pair
.= let f :: (a, a) -> Value
f (a
item, a
relation) = [Pair] -> Value
object [String
"contact_item" String -> a -> Pair
forall a. ToJSON a => String -> a -> Pair
.= a
item, String
"contact_relation" String -> a -> Pair
forall a. ToJSON a => String -> a -> Pair
.= a
relation]
in (((Value, String) -> Value) -> [(Value, String)] -> [Value]
forall a b. (a -> b) -> [a] -> [b]
map ((Value, String) -> Value
forall {a} {a}. (ToJSON a, ToJSON a) => (a, a) -> Value
f ((Value, String) -> Value)
-> ((Value, String) -> (Value, String)) -> (Value, String) -> Value
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Lens' (Value, String) Value -> (Value, String) -> (Value, String)
forall x. Lens' x Value -> x -> x
trimContact (Value -> f Value) -> (Value, String) -> f (Value, String)
forall s t a b. Field1 s t a b => Lens s t a b
Lens' (Value, String) Value
_1) ([(Value, String)] -> [Value])
-> Maybe [(Value, String)] -> Maybe [Value]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Maybe [(Value, String)]
contacts),
String
"TeamContacts"
String -> Value -> Pair
forall a. ToJSON a => String -> a -> Pair
.= ( Maybe ([Value], String)
teamContacts
Maybe ([Value], String)
-> (Maybe ([Value], String) -> Value) -> Value
forall a b. a -> (a -> b) -> b
& Value
-> (([Value], String) -> Value) -> Maybe ([Value], String) -> Value
forall b a. b -> (a -> b) -> Maybe a -> b
maybe
Value
Null
( \([Value]
tcs, String
ltyp) ->
[Pair] -> Value
object
[ String
"TeamContacts" String -> [Value] -> Pair
forall a. ToJSON a => String -> a -> Pair
.= (Lens' Value Value -> Value -> Value
forall x. Lens' x Value -> x -> x
trimContact (Value -> f Value) -> Value -> f Value
forall a. a -> a
Lens' Value Value
id (Value -> Value) -> [Value] -> [Value]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [Value]
tcs),
String
"ListType" String -> String -> Pair
forall a. ToJSON a => String -> a -> Pair
.= String
ltyp
]
)
),
String
"Conversations" String -> Maybe [Value] -> Pair
forall a. ToJSON a => String -> a -> Pair
.= Maybe [Value]
convs,
String
"Assets" String -> Maybe [String] -> Pair
forall a. ToJSON a => String -> a -> Pair
.= Maybe [String]
assets
]
trimContact :: forall x. Lens' x A.Value -> x -> x
trimContact :: forall x. Lens' x Value -> x -> x
trimContact Lens' x Value
lns =
(Value -> Identity Value) -> x -> Identity x
Lens' x Value
lns ((Value -> Identity Value) -> x -> Identity x)
-> (Value -> Value) -> x -> x
forall s t a b. ASetter s t a b -> (a -> b) -> s -> t
%~ \case
trimmable :: Value
trimmable@(A.Object KeyMap Value
_) -> Value -> Value
trimItem Value
trimmable
Value
other -> String -> Value
forall a. HasCallStack => String -> a
error (String -> Value) -> String -> Value
forall a b. (a -> b) -> a -> b
$ Value -> String
forall a. Show a => a -> String
show Value
other
trimItem :: A.Value -> A.Value
trimItem :: Value -> Value
trimItem =
(Key -> Traversal' Value Value
forall t. AsValue t => Key -> Traversal' t Value
key (String -> Key
forall a. IsString a => String -> a
fromString String
"Contacts") ((Value -> Identity Value) -> Value -> Identity Value)
-> Value -> Value -> Value
forall s t a b. ASetter s t a b -> b -> s -> t
.~ Value
A.Null)
(Value -> Value) -> (Value -> Value) -> Value -> Value
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Key -> Traversal' Value Value
forall t. AsValue t => Key -> Traversal' t Value
key (String -> Key
forall a. IsString a => String -> a
fromString String
"TeamContacts") ((Value -> Identity Value) -> Value -> Identity Value)
-> Value -> Value -> Value
forall s t a b. ASetter s t a b -> b -> s -> t
.~ Value
A.Null)
(Value -> Value) -> (Value -> Value) -> Value -> Value
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Key -> Traversal' Value Value
forall t. AsValue t => Key -> Traversal' t Value
key (String -> Key
forall a. IsString a => String -> a
fromString String
"Conversations") ((Value -> Identity Value) -> Value -> Identity Value)
-> Value -> Value -> Value
forall s t a b. ASetter s t a b -> b -> s -> t
.~ Value
A.Null)
testEJPDRequest :: (HasCallStack) => App ()
testEJPDRequest :: HasCallStack => App ()
testEJPDRequest = do
(Value
usr1, Value
usr2, Value
usr3, Value
usr4, Value
usr5) <- App (Value, Value, Value, Value, Value)
HasCallStack => App (Value, Value, Value, Value, Value)
setupEJPD
let check :: (HasCallStack) => [A.Value] -> App ()
check :: HasCallStack => [Value] -> App ()
check [Value]
want = do
let handle :: Value -> String
handle = Text -> String
forall a b. ConvertibleStrings a b => a -> b
cs (Text -> String) -> (Value -> Text) -> Value -> String
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Value -> Getting (Endo Text) Value Text -> Text
forall s a. HasCallStack => s -> Getting (Endo a) s a -> a
^?! (Key -> Traversal' Value Value
forall t. AsValue t => Key -> Traversal' t Value
key (String -> Key
forall a. IsString a => String -> a
fromString String
"Handle") ((Value -> Const (Endo Text) Value)
-> Value -> Const (Endo Text) Value)
-> Getting (Endo Text) Value Text -> Getting (Endo Text) Value Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Getting (Endo Text) Value Text
forall t. AsValue t => Prism' t Text
Prism' Value Text
_String))
Response
have <- Domain -> [String] -> String -> App Response
forall dom.
(HasCallStack, MakesValue dom) =>
dom -> [String] -> String -> App Response
BI.getEJPDInfo Domain
OwnDomain (Value -> String
handle (Value -> String) -> [Value] -> [String]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [Value]
want) String
"include_contacts"
Response
have.json App Value -> Value -> App ()
forall a b.
(MakesValue a, MakesValue b, HasCallStack) =>
a -> b -> App ()
`shouldMatchSpecial` [Pair] -> Value
object [String
"EJPDResponse" String -> [Value] -> Pair
forall a. ToJSON a => String -> a -> Pair
.= [Value]
want]
shouldMatchSpecial :: (MakesValue a, MakesValue b, HasCallStack) => a -> b -> App ()
shouldMatchSpecial :: forall a b.
(MakesValue a, MakesValue b, HasCallStack) =>
a -> b -> App ()
shouldMatchSpecial = [LenientMatchRule]
-> (Value -> App (Maybe Value)) -> a -> b -> App ()
forall a b.
(MakesValue a, MakesValue b, HasCallStack) =>
[LenientMatchRule]
-> (Value -> App (Maybe Value)) -> a -> b -> App ()
shouldMatchWithRules [LenientMatchRule
forall a. Bounded a => a
minBound ..] Value -> App (Maybe Value)
resolveAssetLinks
resolveAssetLinks :: A.Value -> App (Maybe A.Value)
resolveAssetLinks :: Value -> App (Maybe Value)
resolveAssetLinks = \case
(A.String (Text -> String
forall a b. ConvertibleStrings a b => a -> b
cs -> String
url)) | String -> Bool
isProbablyAssetUrl String
url -> (Value -> Maybe Value
forall a. a -> Maybe a
Just (Value -> Maybe Value)
-> (String -> Value) -> String -> Maybe Value
forall b c a. (b -> c) -> (a -> b) -> a -> c
. String -> Value
forall a. ToJSON a => a -> Value
toJSON) (String -> Maybe Value) -> App String -> App (Maybe Value)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> String -> App String
fetchIt String
url
Value
_ -> Maybe Value -> App (Maybe Value)
forall a. a -> App a
forall (f :: * -> *) a. Applicative f => a -> f a
pure Maybe Value
forall a. Maybe a
Nothing
where
isProbablyAssetUrl :: String -> Bool
isProbablyAssetUrl :: String -> Bool
isProbablyAssetUrl String
url = (String -> Bool) -> [String] -> Bool
forall (t :: * -> *) a. Foldable t => (a -> Bool) -> t a -> Bool
all (String -> String -> Bool
forall a. Eq a => [a] -> [a] -> Bool
`isInfixOf` String
url) [String
"http", String
"://", String
"/dummy-bucket/v3/persistent/"]
fetchIt :: String -> App String
fetchIt :: String -> App String
fetchIt String
url = IO String -> App String
forall a. IO a -> App a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO String -> App String) -> IO String -> App String
forall a b. (a -> b) -> a -> b
$ (ByteString -> String
forall a b. ConvertibleStrings a b => a -> b
cs (ByteString -> String)
-> (Response ByteString -> ByteString)
-> Response ByteString
-> String
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Getting ByteString (Response ByteString) ByteString
-> Response ByteString -> ByteString
forall s (m :: * -> *) a. MonadReader s m => Getting a s a -> m a
view Getting ByteString (Response ByteString) ByteString
forall body0 body1 (f :: * -> *).
Functor f =>
(body0 -> f body1) -> Response body0 -> f (Response body1)
Wreq.responseBody) (Response ByteString -> String)
-> IO (Response ByteString) -> IO String
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> String -> IO (Response ByteString)
Wreq.get String
url
HasCallStack => [Value] -> App ()
[Value] -> App ()
check [Value
usr1]
HasCallStack => [Value] -> App ()
[Value] -> App ()
check [Value
usr2]
HasCallStack => [Value] -> App ()
[Value] -> App ()
check [Value
usr3]
HasCallStack => [Value] -> App ()
[Value] -> App ()
check [Value
usr4, Value
usr5]
testEJPDRequestRemote :: (HasCallStack) => App ()
testEJPDRequestRemote :: HasCallStack => App ()
testEJPDRequestRemote = do
Value
usrRemote <- Domain -> CreateUser -> App Value
forall domain.
(HasCallStack, MakesValue domain) =>
domain -> CreateUser -> App Value
randomUser Domain
OtherDomain CreateUser
forall a. Default a => a
def {BI.email = Nothing, BI.name = Just "usrRemote"}
String
handleRemote <- IO String -> App String
forall a. IO a -> App a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO String -> App String) -> IO String -> App String
forall a b. (a -> b) -> a -> b
$ IO UUID
UUID.nextRandom IO UUID -> (UUID -> String) -> IO String
forall (f :: * -> *) a b. Functor f => f a -> (a -> b) -> f b
<&> UUID -> String
UUID.toString
HasCallStack => Response -> App ()
Response -> App ()
assertSuccess (Response -> App ()) -> App Response -> App ()
forall (m :: * -> *) a b. Monad m => (a -> m b) -> m a -> m b
=<< Value -> String -> App Response
forall user.
(HasCallStack, MakesValue user) =>
user -> String -> App Response
putHandle Value
usrRemote String
handleRemote
Response
have <- Domain -> [String] -> String -> App Response
forall dom.
(HasCallStack, MakesValue dom) =>
dom -> [String] -> String -> App Response
BI.getEJPDInfo Domain
OwnDomain [String
handleRemote] String
"include_contacts"
App Value -> App ()
forall a. (MakesValue a, HasCallStack) => a -> App ()
shouldBeEmpty (App Value -> App ()) -> App Value -> App ()
forall a b. (a -> b) -> a -> b
$ Response
have.json App Value -> String -> App Value
forall a. (HasCallStack, MakesValue a) => a -> String -> App Value
%. String
"EJPDResponse"