Skip to content

Free, Open Source, Self-Hosted WhatsApp API Gateway

docs(openapi): list the errors the instance routes throw

Yudhi Armyndharis4b932f34dfa6
diff --git a/src/modules/integration/integration-instance.controller.ts b/src/modules/integration/integration-instance.controller.ts
index 329828541..5160173e0 100644
--- a/src/modules/integration/integration-instance.controller.ts
+++ b/src/modules/integration/integration-instance.controller.ts
@@ -47,6 +47,9 @@ export class IntegrationInstanceController {
'Instance created. The plaintext ingress secret and verifyToken are revealed once in this response — store them immediately (both masked on every later read).',
type: InstanceView,
})
+ @ApiResponse({ status: 400, description: 'Validation failed, or the plugin is not ingress-capable.' })
+ @ApiResponse({ status: 403, description: "Key role below ADMIN, or sessionScope outside the key's allowedSessions." })
+ @ApiResponse({ status: 404, description: 'Plugin not found.' })
@ApiResponse({ status: 409, description: 'An instance with that id already exists for the plugin' })
async create(
@Param('pluginId') pluginId: string,
@@ -85,6 +88,7 @@ export class IntegrationInstanceController {
@Get(':instanceId')
@ApiResponse({ status: 200, description: 'The instance (secret masked).', type: InstanceView })
+ @ApiResponse({ status: 404, description: "Unknown instance, or one outside the key's allowedSessions." })
async getOne(
@Param('pluginId') pluginId: string,
@Param('instanceId') instanceId: string,
@@ -102,6 +106,7 @@ export class IntegrationInstanceController {
'Secret regenerated. The new plaintext secret is revealed once in this response; the verifyToken is also shown (unchanged).',
type: InstanceView,
})
+ @ApiResponse({ status: 404, description: "Unknown instance, or one outside the key's allowedSessions." })
async regenerate(
@Param('pluginId') pluginId: string,
@Param('instanceId') instanceId: string,
@@ -117,6 +122,12 @@ export class IntegrationInstanceController {
@Patch(':instanceId')
@ApiResponse({ status: 200, description: 'Instance updated (secret masked).', type: InstanceView })
+ @ApiResponse({ status: 400, description: 'Validation failed, or the masked config could not be restored.' })
+ @ApiResponse({
+ status: 403,
+ description: "Key role below ADMIN, or the new sessionScope outside the key's allowedSessions.",
+ })
+ @ApiResponse({ status: 404, description: "Unknown instance, or one outside the key's allowedSessions." })
async patch(
@Param('pluginId') pluginId: string,
@Param('instanceId') instanceId: string,
@@ -156,6 +167,7 @@ export class IntegrationInstanceController {
@Delete(':instanceId')
@HttpCode(204)
@ApiResponse({ status: 204, description: 'Instance deleted and its session scope torn down.' })
+ @ApiResponse({ status: 404, description: "Unknown instance, or one outside the key's allowedSessions." })
async remove(
@Param('pluginId') pluginId: string,
@Param('instanceId') instanceId: string,