docs: Add full Swagger JSDoc coverage

This commit is contained in:
Maksim Eltyshev
2025-09-08 16:20:27 +02:00
parent e6b4c33542
commit 5ad3134519
128 changed files with 7610 additions and 0 deletions

View File

@@ -3,6 +3,73 @@
* Licensed under the Fair Use License: https://github.com/plankanban/planka/blob/master/LICENSE.md
*/
/**
* @swagger
* /api/webhooks:
* post:
* summary: Create webhook
* description: Creates a webhook. Requires admin privileges.
* tags:
* - Webhooks
* requestBody:
* required: true
* content:
* application/json:
* schema:
* type: object
* required:
* - name
* - url
* properties:
* name:
* type: string
* maxLength: 128
* description: Name/title of the webhook
* example: Webhook Updates
* url:
* type: string
* format: url
* maxLength: 2048
* description: URL endpoint for the webhook
* example: https://example.service.com/planka
* accessToken:
* type: string
* maxLength: 512
* nullable: true
* description: Access token for webhook authentication
* example: secret_token_123
* events:
* type: string
* maxLength: 2048
* nullable: true
* description: Comma-separated list of events that trigger the webhook
* example: cardCreate,cardUpdate,cardDelete
* excludedEvents:
* type: string
* maxLength: 2048
* nullable: true
* description: Comma-separated list of events excluded from the webhook
* example: userCreate,userUpdate,userDelete
* responses:
* 200:
* description: Webhook created successfully
* content:
* application/json:
* schema:
* type: object
* required:
* - item
* properties:
* item:
* $ref: '#/components/schemas/Webhook'
* 400:
* $ref: '#/components/responses/ValidationError'
* 401:
* $ref: '#/components/responses/Unauthorized'
* 409:
* $ref: '#/components/responses/Conflict'
*/
const { isUrl } = require('../../../utils/validators');
const Errors = {

View File

@@ -3,6 +3,42 @@
* Licensed under the Fair Use License: https://github.com/plankanban/planka/blob/master/LICENSE.md
*/
/**
* @swagger
* /api/webhooks/{id}:
* delete:
* summary: Delete webhook
* description: Deletes a webhook. Requires admin privileges.
* tags:
* - Webhooks
* parameters:
* - name: id
* in: path
* required: true
* description: ID of the webhook to delete
* schema:
* type: string
* example: 1357158568008091264
* responses:
* 200:
* description: Webhook deleted successfully
* content:
* application/json:
* schema:
* type: object
* required:
* - item
* properties:
* item:
* $ref: '#/components/schemas/Webhook'
* 400:
* $ref: '#/components/responses/ValidationError'
* 401:
* $ref: '#/components/responses/Unauthorized'
* 404:
* $ref: '#/components/responses/NotFound'
*/
const { idInput } = require('../../../utils/inputs');
const Errors = {

View File

@@ -3,6 +3,34 @@
* Licensed under the Fair Use License: https://github.com/plankanban/planka/blob/master/LICENSE.md
*/
/**
* @swagger
* /api/webhooks:
* get:
* summary: Get all webhooks
* description: Retrieves a list of all configured webhooks. Requires admin privileges.
* tags:
* - Webhooks
* responses:
* 200:
* description: List of webhooks retrieved successfully
* content:
* application/json:
* schema:
* type: object
* required:
* - items
* properties:
* items:
* type: array
* items:
* $ref: '#/components/schemas/Webhook'
* 400:
* $ref: '#/components/responses/ValidationError'
* 401:
* $ref: '#/components/responses/Unauthorized'
*/
module.exports = {
async fn() {
const webhooks = await Webhook.qm.getAll();

View File

@@ -3,6 +3,78 @@
* Licensed under the Fair Use License: https://github.com/plankanban/planka/blob/master/LICENSE.md
*/
/**
* @swagger
* /api/webhooks/{id}:
* patch:
* summary: Update webhook
* description: Updates a webhook. Requires admin privileges.
* tags:
* - Webhooks
* parameters:
* - name: id
* in: path
* required: true
* description: ID of the webhook to update
* schema:
* type: string
* example: 1357158568008091264
* requestBody:
* required: true
* content:
* application/json:
* schema:
* type: object
* properties:
* name:
* type: string
* maxLength: 128
* description: Name/title of the webhook
* example: Webhook Updates
* url:
* type: string
* format: url
* maxLength: 2048
* description: URL endpoint for the webhook
* example: https://example.service.com/planka
* accessToken:
* type: string
* maxLength: 512
* nullable: true
* description: Access token for webhook authentication
* example: secret_token_123
* events:
* type: string
* maxLength: 2048
* nullable: true
* description: Comma-separated list of events that trigger the webhook
* example: cardCreate,cardUpdate,cardDelete
* excludedEvents:
* type: string
* maxLength: 2048
* nullable: true
* description: Comma-separated list of events excluded from the webhook
* example: userCreate,userUpdate,userDelete
* responses:
* 200:
* description: Webhook updated successfully
* content:
* application/json:
* schema:
* type: object
* required:
* - item
* properties:
* item:
* $ref: '#/components/schemas/Webhook'
* 400:
* $ref: '#/components/responses/ValidationError'
* 401:
* $ref: '#/components/responses/Unauthorized'
* 404:
* $ref: '#/components/responses/NotFound'
*/
const { isUrl } = require('../../../utils/validators');
const { idInput } = require('../../../utils/inputs');