From d8635e79157eab670d558961b0526c1ef7ac7e5b Mon Sep 17 00:00:00 2001 From: HannesOberreiter Date: Tue, 18 Jun 2024 15:41:12 +0200 Subject: [PATCH] docs: Add types to webhook function (#796) --- server/api/helpers/utils/send-webhooks.js | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/server/api/helpers/utils/send-webhooks.js b/server/api/helpers/utils/send-webhooks.js index e5c709d1..61bc8c32 100644 --- a/server/api/helpers/utils/send-webhooks.js +++ b/server/api/helpers/utils/send-webhooks.js @@ -77,12 +77,26 @@ const jsonifyData = (data) => { return nextData; }; +/** + * @typedef {Object} Included + * @property {any[]} [projects] - Array of projects (optional). + * @property {any[]} [boards] - Array of boards (optional). + * @property {any[]} [lists] - Array of lists (optional). + * @property {any[]} [cards] - Array of cards (optional). + */ + +/** + * @typedef {Object} Data + * @property {any} item - Actual event data. + * @property {Included} [included] - Optional included data. + */ + /** * Sends a webhook notification to a configured URL. * * @param {*} webhook - Webhook configuration. * @param {string} event - The event (see {@link EVENT_TYPES}). - * @param {*} data - The actual data related to the event. + * @param {Data} data - The data object containing event data and optionally included data. * @param {ref} user - User object associated with the event. * @returns {Promise} */