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:
parent
3ebcfe548d
commit
06a05a3358
3 changed files with 9 additions and 1 deletions
|
@ -1339,6 +1339,7 @@ App::post('/v1/account/sessions/phone')
|
||||||
]));
|
]));
|
||||||
|
|
||||||
$messageDoc = $dbForProject->createDocument('messages', new Document([
|
$messageDoc = $dbForProject->createDocument('messages', new Document([
|
||||||
|
'$id' => $token->getId(),
|
||||||
'to' => [$target->getId()],
|
'to' => [$target->getId()],
|
||||||
'data' => [
|
'data' => [
|
||||||
'content' => $message,
|
'content' => $message,
|
||||||
|
@ -2968,6 +2969,7 @@ App::post('/v1/account/verification/phone')
|
||||||
]));
|
]));
|
||||||
|
|
||||||
$messageDoc = $dbForProject->createDocument('messages', new Document([
|
$messageDoc = $dbForProject->createDocument('messages', new Document([
|
||||||
|
'$id' => $verification->getId(),
|
||||||
'to' => [$target->getId()],
|
'to' => [$target->getId()],
|
||||||
'data' => [
|
'data' => [
|
||||||
'content' => $message,
|
'content' => $message,
|
||||||
|
|
|
@ -1330,6 +1330,7 @@ App::post('/v1/messaging/messages/email')
|
||||||
->label('sdk.response.code', Response::STATUS_CODE_CREATED)
|
->label('sdk.response.code', Response::STATUS_CODE_CREATED)
|
||||||
->label('sdk.response.type', Response::CONTENT_TYPE_JSON)
|
->label('sdk.response.type', Response::CONTENT_TYPE_JSON)
|
||||||
->label('sdk.response.model', Response::MODEL_MESSAGE)
|
->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('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('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.')
|
->param('subject', '', new Text(128), 'Email Subject.')
|
||||||
|
@ -1340,7 +1341,9 @@ App::post('/v1/messaging/messages/email')
|
||||||
->inject('project')
|
->inject('project')
|
||||||
->inject('messaging')
|
->inject('messaging')
|
||||||
->inject('response')
|
->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);
|
$provider = $dbForProject->getDocument('providers', $providerId);
|
||||||
|
|
||||||
if ($provider->isEmpty()) {
|
if ($provider->isEmpty()) {
|
||||||
|
@ -1348,6 +1351,7 @@ App::post('/v1/messaging/messages/email')
|
||||||
}
|
}
|
||||||
|
|
||||||
$message = $dbForProject->createDocument('messages', new Document([
|
$message = $dbForProject->createDocument('messages', new Document([
|
||||||
|
'$id' => $messageId,
|
||||||
'providerId' => $provider->getId(),
|
'providerId' => $provider->getId(),
|
||||||
'providerInternalId' => $provider->getInternalId(),
|
'providerInternalId' => $provider->getInternalId(),
|
||||||
'to' => $to,
|
'to' => $to,
|
||||||
|
|
|
@ -661,6 +661,8 @@ App::post('/v1/teams/:teamId/memberships')
|
||||||
]));
|
]));
|
||||||
|
|
||||||
$messageDoc = $dbForProject->createDocument('messages', new Document([
|
$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()],
|
'to' => [$target->getId()],
|
||||||
'data' => [
|
'data' => [
|
||||||
'content' => $message,
|
'content' => $message,
|
||||||
|
|
Loading…
Reference in a new issue