-
Notifications
You must be signed in to change notification settings - Fork 171
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use unified message reference schema
- Loading branch information
Showing
2 changed files
with
53 additions
and
98 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1477,6 +1477,53 @@ const outboxEntrySchema = Joi.object({ | |
}).label('OutboxEntryProgress') | ||
}).label('OutboxEntry'); | ||
|
||
const messageReferenceSchema = Joi.object({ | ||
message: Joi.string() | ||
.base64({ paddingRequired: false, urlSafe: true }) | ||
.max(256) | ||
.required() | ||
.example('AAAAAQAACnA') | ||
.description("The EmailEngine-specific ID of the referenced message. Note: This is not the Message-ID found in the email's headers"), | ||
action: Joi.string() | ||
.lowercase() | ||
.valid('forward', 'reply') | ||
.example('reply') | ||
.default('reply') | ||
.description("Specifies the action to perform on the referenced message. Possible values are 'reply' or 'forward'"), | ||
inline: Joi.boolean() | ||
.truthy('Y', 'true', '1') | ||
.falsy('N', 'false', 0) | ||
.default(false) | ||
.description('When set to `true`, includes the original email content as blockquoted text in the reply') | ||
.label('InlineReply'), | ||
forwardAttachments: Joi.boolean() | ||
.truthy('Y', 'true', '1') | ||
.falsy('N', 'false', 0) | ||
.default(false) | ||
.description('When set to `true`, includes attachments from the original email in the forwarded message') | ||
.when('action', { | ||
is: 'forward', | ||
then: Joi.optional(), | ||
otherwise: Joi.forbidden() | ||
}) | ||
.label('ForwardAttachments'), | ||
ignoreMissing: Joi.boolean() | ||
.truthy('Y', 'true', '1') | ||
.falsy('N', 'false', 0) | ||
.default(false) | ||
.description('When set to `true`, processes the email even if the original referenced message is no longer available.') | ||
.label('IgnoreMissing'), | ||
messageId: Joi.string() | ||
.max(996) | ||
.example('<[email protected]>') | ||
.description( | ||
"Specifies the expected Message-ID of the referenced email. When set, the reference action (such as 'reply' or 'forward') will only proceed if the Message-ID of the referenced email matches this value. If the Message-IDs do not match, an error is returned. This ensures that the action is applied to the correct email." | ||
), | ||
documentStore: documentStoreSchema.default(false).meta({ swaggerHidden: true }) | ||
}) | ||
.description('Contains information needed when replying to or forwarding an email') | ||
.label('MessageReference'); | ||
|
||
module.exports = { | ||
ADDRESS_STRATEGIES, | ||
|
||
|
@@ -1513,7 +1560,8 @@ module.exports = { | |
fromAddressSchema, | ||
outboxEntrySchema, | ||
googleProjectIdSchema, | ||
googleWorkspaceAccountsSchema | ||
googleWorkspaceAccountsSchema, | ||
messageReferenceSchema | ||
}; | ||
|
||
/* | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -163,7 +163,8 @@ const { | |
fromAddressSchema, | ||
outboxEntrySchema, | ||
googleProjectIdSchema, | ||
googleWorkspaceAccountsSchema | ||
googleWorkspaceAccountsSchema, | ||
messageReferenceSchema | ||
} = require('../lib/schemas'); | ||
|
||
const listMessageFolderPathDescription = | ||
|
@@ -4163,54 +4164,7 @@ const init = async () => { | |
flags: Joi.array().items(Joi.string().max(128)).example(['\\Seen', '\\Draft']).default([]).description('Message flags').label('Flags'), | ||
internalDate: Joi.date().iso().example('2021-07-08T07:06:34.336Z').description('Sets the internal date for this message'), | ||
|
||
reference: Joi.object({ | ||
message: Joi.string() | ||
.base64({ paddingRequired: false, urlSafe: true }) | ||
.max(256) | ||
.required() | ||
.example('AAAAAQAACnA') | ||
.description( | ||
"The EmailEngine-specific ID of the referenced message. Note: This is not the Message-ID found in the email's headers" | ||
), | ||
action: Joi.string() | ||
.lowercase() | ||
.valid('forward', 'reply') | ||
.example('reply') | ||
.default('reply') | ||
.description("Specifies the action to perform on the referenced message. Possible values are 'reply' or 'forward'"), | ||
inline: Joi.boolean() | ||
.truthy('Y', 'true', '1') | ||
.falsy('N', 'false', 0) | ||
.default(false) | ||
.description('When set to `true`, includes the original email content as blockquoted text in the reply') | ||
.label('InlineReply'), | ||
forwardAttachments: Joi.boolean() | ||
.truthy('Y', 'true', '1') | ||
.falsy('N', 'false', 0) | ||
.default(false) | ||
.description('When set to `true`, includes attachments from the original email in the forwarded message') | ||
.when('action', { | ||
is: 'forward', | ||
then: Joi.optional(), | ||
otherwise: Joi.forbidden() | ||
}) | ||
.label('ForwardAttachments'), | ||
ignoreMissing: Joi.boolean() | ||
.truthy('Y', 'true', '1') | ||
.falsy('N', 'false', 0) | ||
.default(false) | ||
.description('When set to `true`, processes the email even if the original referenced message is no longer available.') | ||
.label('IgnoreMissing'), | ||
messageId: Joi.string() | ||
.max(996) | ||
.example('<[email protected]>') | ||
.description( | ||
"Specifies the expected Message-ID of the referenced email. When set, the reference action (such as 'reply' or 'forward') will only proceed if the Message-ID of the referenced email matches this value. If the Message-IDs do not match, an error is returned. This ensures that the action is applied to the correct email." | ||
), | ||
documentStore: documentStoreSchema.default(false).meta({ swaggerHidden: true }) | ||
}) | ||
.description('Contains information needed when replying to or forwarding an email') | ||
.label('MessageReference'), | ||
reference: messageReferenceSchema, | ||
|
||
raw: Joi.string() | ||
.base64() | ||
|
@@ -5285,54 +5239,7 @@ const init = async () => { | |
}), | ||
|
||
payload: Joi.object({ | ||
reference: Joi.object({ | ||
message: Joi.string() | ||
.base64({ paddingRequired: false, urlSafe: true }) | ||
.max(256) | ||
.required() | ||
.example('AAAAAQAACnA') | ||
.description( | ||
"The EmailEngine-specific ID of the referenced message. Note: This is not the Message-ID found in the email's headers" | ||
), | ||
action: Joi.string() | ||
.lowercase() | ||
.valid('forward', 'reply') | ||
.example('reply') | ||
.default('reply') | ||
.description("Specifies the action to perform on the referenced message. Possible values are 'reply' or 'forward'"), | ||
inline: Joi.boolean() | ||
.truthy('Y', 'true', '1') | ||
.falsy('N', 'false', 0) | ||
.default(false) | ||
.description('When set to `true`, includes the original email content as blockquoted text in the reply') | ||
.label('InlineReply'), | ||
forwardAttachments: Joi.boolean() | ||
.truthy('Y', 'true', '1') | ||
.falsy('N', 'false', 0) | ||
.default(false) | ||
.description('When set to `true`, includes attachments from the original email in the forwarded message') | ||
.when('action', { | ||
is: 'forward', | ||
then: Joi.optional(), | ||
otherwise: Joi.forbidden() | ||
}) | ||
.label('ForwardAttachments'), | ||
ignoreMissing: Joi.boolean() | ||
.truthy('Y', 'true', '1') | ||
.falsy('N', 'false', 0) | ||
.default(false) | ||
.description('When set to `true`, processes the email even if the original referenced message is no longer available.') | ||
.label('IgnoreMissing'), | ||
messageId: Joi.string() | ||
.max(996) | ||
.example('<[email protected]>') | ||
.description( | ||
"Specifies the expected Message-ID of the referenced email. When set, the reference action (such as 'reply' or 'forward') will only proceed if the Message-ID of the referenced email matches this value. If the Message-IDs do not match, an error is returned. This ensures that the action is applied to the correct email." | ||
), | ||
documentStore: documentStoreSchema.default(false).meta({ swaggerHidden: true }) | ||
}) | ||
.description('Contains information needed when replying to or forwarding an email') | ||
.label('MessageReference'), | ||
reference: messageReferenceSchema, | ||
|
||
envelope: Joi.object({ | ||
from: Joi.string().email().allow('').example('[email protected]'), | ||
|