openapi: 3.0.2
info:
  title: Bots api methods
  description: These methods allow us manage webhook flows
  version: v0
servers:
  - url: http://172.19.18.132:8082
security:
  - ApiKeyAuth: []
components:
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-ApiKey
paths:
  "/api/webhooks/id/{flow}":
    post:
      summary: Create a webhook flow
      description:
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              type: object
              properties:
                name:
                  type: string
                description:
                  type: string
                drawFlowObj:
                  type: string
                flow:
                  type: string
                type:
                  type: string
                context:
                  type: null
                extension:
                  type: null
                dialplan:
                  type: null
                deployed:
                  type: boolean
                user:
                  type: string    
      responses:
        200:
          description: Success
          content:
            application/json:
              schema:
                type: object
                properties:
        400:
          description: Error getting flow
    put:
      summary: Update the webhook flow
      description:
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              type: object
              properties:
                name:
                  type: string
                description:
                  type: string
                drawFlowObj:
                  type: string
                flow:
                  type: string
                type:
                  type: string
                context:
                  type: null
                extension:
                  type: null
                dialplan:
                  type: null
                deployed:
                  type: boolean
                user:
                  type: string    
      responses:
        200:
          description: Success
          content:
            application/json:
              schema:
                type: object
                properties:
        400:
          description: Error updating flow
    delete:
      summary: Remove the webhook
      description:
      responses:
        200:
          description: Success
          content:
            application/json:
              schema:
                type: object
                properties:
        400:
          description: Error removing webhook  
  "/api/webhooks/id/{flow}/historic":
    get:
      summary: Get a list of the webhook's previous versions
      description:
      parameters:
        - name: index
          required: false
          description: index from where we want to get the previous records
        - name: rows
          required: false
          description: how many records we want
        - name: flow
          required: false
          description: flow's name
      responses:
        200:
          description: Success
          content:
            application/json:
              schema:
                type: object
                properties:
                  result:
                    type: array
                    items:
                      type: object
                      properties:
                        id:
                          type: integer
                        name:
                          type: string
                        date:
                          type: string
                        drawFlowObj:
                          type: string
                        deployed:
                          type: boolean
                        user:
                          type: string
                  index:
                    type: integer
                  rows:
                    type: integer
                  total:
                    type: integer
        400:
          description: Error getting flow historic
  "/api/webhooks":
    get:
      summary: Get a list of all webhooks
      description:
      parameters:
      responses:
        200:
          description: Success
          content:
            application/json:
              schema:
                type: object
                properties:
                  result:
                    type: array
                    items:
                      type: object
                      properties:
                        id:
                          type: integer
                        name:
                          type: string
                        date:
                          type: string
                        drawFlowObj:
                          type: string
                        deployed:
                          type: boolean
                        user:
                          type: string
                  index:
                    type: integer
                  rows:
                    type: integer
                  total:
                    type: integer
        400:
          description: Error getting flow historic
  "/api/webhooks/names":
    get:
      summary: Get a list of all webhooks names
      description:
      parameters:
      responses:
        200:
          description: Success
          content:
            application/json:
              schema:
                type: object
                properties:
                  result:
                    type: array
                    items:
                      type: string
                  index:
                    type: integer
                  rows:
                    type: integer
                  total:
                    type: integer
        400:
          description: Error getting flow historic
