fix: Add event filter to openapi

Somehow this does not work in the ocs_api_viewer app, so we should look
 into better specifying format for eventFilter.
Ideally it should also be set as in body, not query.

Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
This commit is contained in:
Côme Chilliet 2024-05-30 18:23:09 +02:00 committed by Côme Chilliet
parent 144bdd73f9
commit 7fe3f1cc70
4 changed files with 31 additions and 1 deletions

View file

@ -73,6 +73,7 @@ class WebhooksController extends OCSController {
* @param string $httpMethod HTTP method to use to contact the webhook
* @param string $uri Webhook URI endpoint
* @param string $event Event class name to listen to
* @param ?array<mixed> $eventFilter Mongo filter to apply to the serialized data to decide if firing
* @param ?array<string,string> $headers Array of headers to send
* @param ?string $authMethod Authentication method to use. TODO
* @param ?array<string,mixed> $authData Array of data for authentication
@ -125,6 +126,7 @@ class WebhooksController extends OCSController {
* @param string $httpMethod HTTP method to use to contact the webhook
* @param string $uri Webhook URI endpoint
* @param string $event Event class name to listen to
* @param ?array<string,mixed> $eventFilter Mongo filter to apply to the serialized data to decide if firing
* @param ?array<string,string> $headers Array of headers to send
* @param ?string $authMethod Authentication method to use. TODO
* @param ?array<string,mixed> $authData Array of data for authentication

View file

@ -28,6 +28,9 @@ class WebhookListener extends Entity implements \JsonSerializable {
/** @var string */
protected $event;
/** @var array */
protected $eventFilter;
/** @var ?string */
protected $headers;

View file

@ -16,6 +16,10 @@ namespace OCA\Webhooks;
* httpMethod: string,
* uri: string,
* event?: string,
* eventFilter?: array<mixed>,
* headers?: array<string,string>,
* authMethod: string,
* authData?: array<string,mixed>,
* }
*/
class ResponseDefinitions {

View file

@ -180,6 +180,18 @@
"type": "string"
}
},
{
"name": "eventFilter[]",
"in": "query",
"description": "Mongo filter to apply to the serialized data to decide if firing",
"schema": {
"type": "array",
"nullable": true,
"items": {
"type": "object"
}
}
},
{
"name": "headers",
"in": "query",
@ -422,6 +434,15 @@
"type": "string"
}
},
{
"name": "eventFilter",
"in": "query",
"description": "Mongo filter to apply to the serialized data to decide if firing",
"schema": {
"type": "string",
"nullable": true
}
},
{
"name": "headers",
"in": "query",
@ -688,4 +709,4 @@
}
},
"tags": []
}
}