swagger: "2.0"
info:
  description: This is the swagger file that goes with our server code
  version: "1.0.0"
  title: Swagger Rest Article
consumes:
  - application/json
produces:
  - application/json

basePath: /api

# Paths supported by the server application
paths:
  /agent:
    get:
      operationId: aea.cli_gui.get_agents
      tags:
      - agents
      summary: Return list of all aea projects
      description: List of local folders under the user name (which correspond to aea projects)
      responses:
        200:
          description: Successfully read agent list operation
          schema:
            type: array
            items:
              type: string
    post:
      operationId: aea.cli_gui.create_agent
      tags:
        - People
      summary: Create a new AEA project (an agent)
      parameters:
        - name: agent_id
          in: body
          description: Name of aea project to create
          required: True
          schema:
            type: string

      responses:
        201:
          description: Successfully created person in list

        400:
          description: Cannot create agent
          schema:
            type: string

  /agent/{agent_id}:
    delete:
      operationId: aea.cli_gui.delete_agent
      tags:
      - agents
      summary: Delete an aea project
      parameters:
        - name: agent_id
          in: path
          description: id of agent to delete
          type: string
          required: True
      responses:
        200:
          description: Agent deleted successfully
          schema:
            type: string

        400:
          description: Cannot delete agent
          schema:
            type: string

  /agent/{agent_id}/{item_type}:
    post:
      operationId: aea.cli_gui.add_item
      tags:
      - agents
      summary: Fetch a protocol from the registry to the currently selected agent
      parameters:
        - name: agent_id
          in: path
          description: id of agent to add protocol to
          type: string
          required: True
        - name: item_type
          in: path
          description: type of item to add ("protocol", "connection" or "skill")
          type: string
          required: True
        - name: item_id
          in: body
          description: id of protocol to add
          schema:
            type: string
          required: True
      responses:
        201:
          description: Protocol added successfully
          schema:
            type: string

        400:
          description: Cannot add protocol to agent
          schema:
            type: string
    get:
      operationId: aea.cli_gui.get_local_items
      tags:
      - agents
      summary: Return list of all items if a given type supported by this agent
      parameters:
        - name: agent_id
          in: path
          description: id of agent to searh in
          type: string
          required: True
        - name: item_type
          in: path
          description: type of item to list ("protocol", "connection" or "skill")
          type: string
          required: True

      responses:
        200:
          description: Successfully read protocol list operation
          schema:
            type: array
            items:
              type: string
        400:
          description: Cannot find protocols in agent
          schema:
            type: string

  /agent/{agent_id}/{item_type}/{item_id}:
    delete:
      operationId: aea.cli_gui.remove_local_item
      tags:
      - agents
      summary: Delete a protocol, connection or skill from an agent
      parameters:
        - name: agent_id
          in: path
          description: id of agent to delete
          type: string
          required: True
        - name: item_type
          in: path
          description: type of item to remove
          type: string
          required: True
        - name: item_id
          in: path
          description: item id to delete
          type: string
          required: True

      responses:
        201:
          description: Agent deleted successfully
          schema:
            type: string

        400:
          description: Cannot delete agent
          schema:
            type: string

  /agent/{agent_id}/{item_type}/scaffold:
    post:
      operationId: aea.cli_gui.scaffold_item
      tags:
      - agents
      summary: Scaffold a new (mostly empty) item (either a protocol, connection or skill) on to an agent
      parameters:
        - name: agent_id
          in: path
          description: id of agent to delete
          type: string
          required: True
        - name: item_type
          in: path
          description: type of item to remove
          type: string
          required: True
        - name: item_id
          in: body
          description: id of item to scaffold
          schema:
            type: string
          required: True

      responses:
        201:
          description: Agent deleted successfully
          schema:
            type: string

        400:
          description: Cannot delete agent
          schema:
            type: string

  /{item_type}:
    get:
      operationId: aea.cli_gui.get_registered_items
      tags:
        - agents
      summary: Return list of all registered items (protocols, connections, skills)
      parameters:
        - name: item_type
          in: path
          description: type of item to remove
          type: string
          required: True
      responses:
        200:
          description: Successfully read item list operation
          schema:
            type: array
            items:
              type: string

  /{item_type}/{search_term}:
    get:
      operationId: aea.cli_gui.search_registered_items
      tags:
        - agents
      summary: Return list of all registered items (protocols, connections, skills)
      parameters:
        - name: item_type
          in: path
          description: type of item to remove
          type: string
          required: True
        - name: search_term
          in: path
          description: type of item to remove
          type: string
          required: True
      responses:
        200:
          description: Successfully read item list operation
          schema:
            type: object

  /oef:
    post:
      operationId: aea.cli_gui.start_oef_node
      tags:
      - oef
      summary: Start an OEF node that our agents can communicate with
      responses:
        201:
          description: Start the OEF Nodoe
          schema:
            type: string

        400:
          description: Cannot start node
          schema:
            type: string

    get:
      operationId: aea.cli_gui.get_oef_node_status
      tags:
      - oef
      summary: Get status info about the oef

      responses:
        200:
          description: successfully got status data
          schema:
            type: string

        400:
          description: Cannot get status data
          schema:
            type: string

    delete:
      operationId: aea.cli_gui.stop_oef_node
      tags:
      - oef
      summary: Stops an OEF node

      responses:
        200:
          description: successfully started OEF Node
          schema:
            type: string

        400:
          description: Cannot stop node
          schema:
            type: string

  /agent/{agent_id}/run:
    post:
      operationId: aea.cli_gui.start_agent
      tags:
      - agents
      summary: Start an agent
      parameters:
        - name: agent_id
          in: path
          description: id of agent to run
          type: string
          required: True
        - name: connection_id
          in: body
          description: id f the connection to activate when running
          schema:
            type: string
          required: True
      responses:
        201:
          description: Start the OEF Nodoe
          schema:
            type: string
        400:
          description: Cannot start agent
          schema:
            type: string
    get:
      operationId: aea.cli_gui.get_agent_status
      tags:
      - agents
      summary: Get status of a running agent
      parameters:
        - name: agent_id
          in: path
          description: get status of agent
          type: string
          required: True
      responses:
        200:
          description: successfully got status data
          schema:
            type: string

        400:
          description: Cannot get status data
          schema:
            type: string

    delete:
      operationId: aea.cli_gui.stop_agent
      tags:
      - agents
      summary: Stops an agent
      parameters:
        - name: agent_id
          in: path
          description: id of agent to stop
          type: string
          required: True

      responses:
        200:
          description: successfully started agent
          schema:
            type: string

        400:
          description: Cannot stop agent
          schema:
            type: string