get:
  summary: List Webhooks
  description: Get all webhooks.
  operationId: getWebhooks
  responses:
    '200':
      description: Successful request
      content:
        application/json:
          schema:
            type: object
            properties:
              data:
                $ref: '../../openapi.yaml#/components/schemas/Webhooks'
    '401':
      $ref: '../../openapi.yaml#/components/responses/UnauthorizedError'
    '404':
      $ref: '../../openapi.yaml#/components/responses/NotFoundError'
  tags:
    - Webhooks

post:
  summary: Create a Webhook
  description: Create a new webhook.
  operationId: createWebhook
  parameters:
    - $ref: '../../openapi.yaml#/components/parameters/Fields'
    - $ref: '../../openapi.yaml#/components/parameters/Meta'
  requestBody:
    content:
      application/json:
        schema:
          properties:
            name:
              description: The name of the webhook.
              type: string
              example: create articles
            method:
              description: Method used in the webhook.
              type: string
              example: POST
            url:
              description: The url of the webhook.
              type: string
              example: null
            status:
              description: The status of the webhook.
              type: string
              example: active
            data:
              description: If yes, send the content of what was done
              type: boolean
              example: true
            actions:
              description: The actions that triggers this webhook.
              example: null
            system-collections:
              description: The collections that triggers this webhook.
              example: null
          type: object
  responses:
    '200':
      description: Successful request
      content:
        application/json:
          schema:
            type: object
            properties:
              data:
                $ref: '../../openapi.yaml#/components/schemas/Roles'
    '401':
      $ref: '../../openapi.yaml#/components/responses/UnauthorizedError'
    '404':
      $ref: '../../openapi.yaml#/components/responses/NotFoundError'
  tags:
    - Webhooks

patch:
  summary: Update Multiple Webhooks
  description: Update multiple webhooks at the same time.
  tags:
    - Webhooks
  operationId: updateWebhooks
  parameters:
    - $ref: '../../openapi.yaml#/components/parameters/Fields'
    - $ref: '../../openapi.yaml#/components/parameters/Limit'
    - $ref: '../../openapi.yaml#/components/parameters/Meta'
    - $ref: '../../openapi.yaml#/components/parameters/Offset'

    - $ref: '../../openapi.yaml#/components/parameters/Sort'
    - $ref: '../../openapi.yaml#/components/parameters/Filter'
    - $ref: '../../openapi.yaml#/components/parameters/Search'
  requestBody:
    content:
      application/json:
        schema:
          properties:
            data:
              properties:
                name:
                  description: The name of the webhook.
                  type: string
                  example: create articles
                method:
                  description: Method used in the webhook.
                  type: string
                  example: POST
                url:
                  description: The url of the webhook.
                  type: string
                  example: null
                status:
                  description: The status of the webhook.
                  type: string
                  example: active
                data:
                  description: If yes, send the content of what was done
                  type: boolean
                  example: true
                actions:
                  description: The actions that triggers this webhook.
                  example: null
                system-collections:
                  description: The collections that triggers this webhook.
                  example: null
              type: object
            keys:
              type: array
              items:
                type: string
          type: object
  responses:
    '200':
      description: Successful request
      content:
        application/json:
          schema:
            type: object
            properties:
              data:
                type: array
                items:
                  $ref: '../../openapi.yaml#/components/schemas/Webhooks'
              meta:
                $ref: '../../openapi.yaml#/components/schemas/x-metadata'
    '401':
      $ref: '../../openapi.yaml#/components/responses/UnauthorizedError'

delete:
  summary: Delete Multiple Webhooks
  description: Delete multiple existing webhooks.
  tags:
    - Webhooks
  operationId: deleteWebhooks
  responses:
    '200':
      description: Successful request
    '401':
      $ref: '../../openapi.yaml#/components/responses/UnauthorizedError'
