1
0
Fork 0
mirror of synced 2024-06-28 19:20:25 +12:00

adds param messageId in send an email endpoint, tokenId as messageId in create phone session, membershipId as messageId in create team membership

This commit is contained in:
Prateek Banga 2023-09-21 21:17:15 +05:30
parent 3ebcfe548d
commit 06a05a3358
3 changed files with 9 additions and 1 deletions

View file

@ -1339,6 +1339,7 @@ App::post('/v1/account/sessions/phone')
]));
$messageDoc = $dbForProject->createDocument('messages', new Document([
'$id' => $token->getId(),
'to' => [$target->getId()],
'data' => [
'content' => $message,
@ -2968,6 +2969,7 @@ App::post('/v1/account/verification/phone')
]));
$messageDoc = $dbForProject->createDocument('messages', new Document([
'$id' => $verification->getId(),
'to' => [$target->getId()],
'data' => [
'content' => $message,

View file

@ -1330,6 +1330,7 @@ App::post('/v1/messaging/messages/email')
->label('sdk.response.code', Response::STATUS_CODE_CREATED)
->label('sdk.response.type', Response::CONTENT_TYPE_JSON)
->label('sdk.response.model', Response::MODEL_MESSAGE)
->param('messageId', '', new CustomId(), 'Message ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can\'t start with a special char. Max length is 36 chars.')
->param('providerId', '', new Text(128), 'Email Provider ID.')
->param('to', [], new ArrayList(new Text(65535)), 'List of Topic IDs or List of User IDs or List of Target IDs.')
->param('subject', '', new Text(128), 'Email Subject.')
@ -1340,7 +1341,9 @@ App::post('/v1/messaging/messages/email')
->inject('project')
->inject('messaging')
->inject('response')
->action(function (string $providerId, array $to, string $subject, string $content, string $from, string $html, Database $dbForProject, Document $project, Messaging $messaging, Response $response) {
->action(function (string $messageId, string $providerId, array $to, string $subject, string $content, string $from, string $html, Database $dbForProject, Document $project, Messaging $messaging, Response $response) {
$messageId = $messageId == 'unique()' ? ID::unique() : $messageId;
$provider = $dbForProject->getDocument('providers', $providerId);
if ($provider->isEmpty()) {
@ -1348,6 +1351,7 @@ App::post('/v1/messaging/messages/email')
}
$message = $dbForProject->createDocument('messages', new Document([
'$id' => $messageId,
'providerId' => $provider->getId(),
'providerInternalId' => $provider->getInternalId(),
'to' => $to,

View file

@ -661,6 +661,8 @@ App::post('/v1/teams/:teamId/memberships')
]));
$messageDoc = $dbForProject->createDocument('messages', new Document([
// Here membership ID is used as message ID so that it can be used in test cases to verify the message
'$id' => $membership->getId(),
'to' => [$target->getId()],
'data' => [
'content' => $message,