---
swagger: '2.0'
info:
  title: Project-Builder.org
  description: PBSUMMARY
  license:
    name: General Public License 3.0
    url: http://www.gnu.org/
  #termsOfService: 'http://www.example.com/terms'
  contact:
    name: API Support
    url: 'http://www.project-builder.org/support'
    #email: support@example.com
  version: 'PBAPIVER'
host: localhost
basePath: /api/vPBAPIVER
schemes:
  - http
consumes:
  - application/json
  - application/yaml
produces:
  - application/json
  - application/yaml
paths:
  /doc:
    get:
      summary: API Documentation
      operationId: docPb
      tags:
        - pb
      responses:
        '200':
          description: Expected response to a valid request
          schema:
            $ref: '#/definitions/Conf'
        default:
          description: Unexpected error
          schema:
            $ref: '#/definitions/Error'
  /prj:
    get:
      summary: List all projects
      operationId: listPrj
      tags:
        - prj
      responses:
        '200':
          description: List of all projects managed by project-builder.org
          schema:
            $ref: '#/definitions/Prj'
        default:
          description: Unexpected error
          schema:
            $ref: '#/definitions/Error'
    put:
      summary: Create a new project
      operationId: newPrj
      tags:
        - prj
      parameters:
        - name: name
          #in: body
          description: Add project by name
          required: true
          schema:
            $ref: '#/definitions/Prj'
      responses:
        '200':
          description: Expected response to a valid request
          schema:
            $ref: '#/definitions/Prj'
        '409':
          description: Null response
          schema:
            $ref: '#/definitions/Error'
        default:
          description: Unexpected error
          schema:
            $ref: '#/definitions/Error'
  '/prj/{prjname}/conf':
    get:
      summary: List all configuration parameters for a specific project
      operationId: listConf
      tags:
        - conf
      parameters:
        - name: prjname
          in: path
          required: true
          description: The name of the project that will be queried for configuration
          type: string
      responses:
        '200':
          description: Expected response to a valid request
          schema:
            items:
              $ref: '#/definitions/Conf'
        default:
          description: Unexpected error
          schema:
            $ref: '#/definitions/Error'
  '/prj/{prjname}/conf/{confname}':
    get:
      operationId: showConf
      tags:
        - conf
      parameters:
        - name: prjname
          in: path
          required: true
          description: The name of the project for which we retrieve configuration
          type: string
        - name: confname
          in: path
          required: true
          description: The name of the configuration item that will be queried
      responses:
        '200':
          description: Expected response to a valid request
          schema:
            $ref: '#/definitions/Conf'
        default:
          description: Unexpected error
          schema:
            $ref: '#/definitions/Error'
    put:
      operationId: updateConf
      tags:
        - conf
      parameters:
        - name: name
          #in: body
          description: Add a configuration item by name
          required: true
          schema:
            $ref: '#/definitions/Conf'
      responses:
        '200':
          description: Expected response to a valid request
          schema:
            $ref: '#/definitions/Conf'
        '409':
          description: Null response
          schema:
            $ref: '#/definitions/Error'
        default:
          description: Unexpected error
          schema:
            $ref: '#/definitions/Error'
    delete:
      operationId: removeConf
      parameters:
        - name: prjname
          in: path
          required: true
          description: The name of the project for which we retrieve configuration
          type: string
        - name: confname
          in: path
          required: true
          description: The name of the configuration item that will be deleted
      responses:
        '200':
          description: Expected response to a valid request
        '404':
          description: Configuration item not found
        default:
          description: Unexpected error
          schema:
            $ref: '#/definitions/Error'
definitions:
  Prj:
    required:
      - name
    properties:
      name:
        type: string
      tag:
        type: string
  Conf:
    required:
      - name
    properties:
      name:
        type: string
      tag:
        type: string
  Error:
    required:
      - code
      - message
    properties:
      code:
        type: integer
        format: int32
      message:
        type: string
