Skip to content

Commit

Permalink
fix(api-messages): messages fix response types (#673)
Browse files Browse the repository at this point in the history
  • Loading branch information
NickOvt committed Apr 22, 2024
1 parent 12957e9 commit 16c6fb8
Showing 1 changed file with 48 additions and 9 deletions.
57 changes: 48 additions & 9 deletions lib/api/messages.js
Expand Up @@ -701,13 +701,51 @@ module.exports = (db, server, messageHandler, userHandler, storageHandler, setti
results: Joi.array()
.items(
Joi.object({
id: Joi.string().required().description('ID of the Domain Alias'),
alias: Joi.string().required().description('Domain Alias'),
domain: Joi.string().required().description('The domain this alias applies to')
}).$_setFlag('objectName', 'GetDomainAliasesResult')
id: messageId,
mailbox: mailboxId,
messageId: Joi.string().required().description('The message ID'),
thread: Joi.string().required().description('ID of the Thread'),
threadMessageCount: Joi.number().description(
'Amount of messages in the Thread. Included if threadCounters query argument was true'
),
from: Address,
to: Joi.array().items(Address).required().description('Recipients in To: field'),
cc: Joi.array().items(Address).required().description('Recipients in Cc: field'),
bcc: Joi.array().items(Address).required().description('Recipients in Bcc: field. Usually only available for drafts'),
subject: Joi.string().required().description('Message subject'),
date: Joi.date().required().description('Date string from header'),
idate: Joi.date().description('Date string of receive time'),
size: Joi.number().required().description('Message size in bytes'),
intro: Joi.string().required().description('First 128 bytes of the message'),
attachments: booleanSchema.required().description('Does the message have attachments'),
seen: booleanSchema.required().description('Is this message already seen or not'),
deleted: booleanSchema
.required()
.description(
'Does this message have a \\Deleted flag (should not have as messages are automatically deleted once this flag is set)'
),
flagged: booleanSchema.required().description('Does this message have a \\Flagged flag'),
answered: booleanSchema.required().description('Does this message have a \\Answered flag'),
forwarded: booleanSchema.required().description('Does this message have a $Forwarded flag'),
draft: booleanSchema.description('True if message is a draft').required(),
contentType: Joi.object({
value: Joi.string().required().description('MIME type of the message, eg. "multipart/mixed"'),
params: Joi.object().required().description('An object with Content-Type params as key-value pairs')
})
.$_setFlag('objectName', 'ContentType')
.required()
.description('Parsed Content-Type header. Usually needed to identify encrypted messages and such'),
metadata: metaDataSchema.description('Custom metadata value. Included if metaData query argument was true'),
headers: Joi.object().description('Header object keys requested with the includeHeaders argument'),
encrypted: booleanSchema.description('True if message is encryrpted'),
references: Joi.array().items(ReferenceWithAttachments).required().description('References'),
bimi: Bimi.required().description(
'Marks BIMI verification as passed for a domain. NB! BIMI record and logo files for the domain must be valid.'
)
}).$_setFlag('objectName', 'GetMessagesResult')
)
.required()
.description('Aliases listing')
.description('Message listing')
})
}
}
Expand Down Expand Up @@ -1081,15 +1119,16 @@ module.exports = (db, server, messageHandler, userHandler, storageHandler, setti
.required()
.description('Parsed Content-Type header. Usually needed to identify encrypted messages and such'),
metaData: Joi.object({}).description('Custom metadata object set for this message'),
references: Joi.object({}),
references: Joi.array().items(ReferenceWithAttachments).required().description('References'),
files: Joi.object({}).description(
'List of files added to this message as attachments. Applies to Drafts, normal messages do not have this property. Needed to prevent uploading the same attachment every time a draft is updated'
),
outbound: Joi.array().items(Joi.object({})).description('Outbound queue entries'),
forwardTargets: Joi.object({}),
reference: Joi.object({}).description('Referenced message info'),
answered: booleanSchema.required(),
forwarded: booleanSchema.required()
answered: booleanSchema.required().description('\\Answered flag value'),
forwarded: booleanSchema.required().description('$Forwarded flag value'),
encrypted: booleanSchema.description('True if message is encrypted')
})
}
}
Expand Down Expand Up @@ -1408,7 +1447,7 @@ module.exports = (db, server, messageHandler, userHandler, storageHandler, setti
200: {
description: 'Success',
model: Joi.object({
success: Joi.object({}).description('Success')
success: Joi.binary().description('Success')
})
}
}
Expand Down

0 comments on commit 16c6fb8

Please sign in to comment.