---
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
# Global parameters
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'
  /conf:
    get:
      summary: List all configuration parameters for a specific project
      operationId: listConf
      tags:
        - conf
      parameters:
        - $ref: '#/parameters/prjName'
      responses:
        '200':
          description: Expected response to a valid request
          schema:
            items:
              $ref: '#/definitions/Conf'
        default:
          description: Unexpected error
          schema:
            $ref: '#/definitions/Error'
  '/conf/{confname}':
    get:
      operationId: showConf
      summary: Get a configuration item
      tags:
        - conf
      parameters:
        - name: confname
          in: path
          type: string
          required: true
          description: The name of the configuration item that will be queried
        - $ref: '#/parameters/prjName'
      responses:
        '200':
          description: Expected response to a valid request
          schema:
            $ref: '#/definitions/Conf'
        default:
          description: Unexpected error
          schema:
            $ref: '#/definitions/Error'
parameters:
  prjName:
    required: true
    name: pbproj
    in: body
    description: The name of the project that will be queried
    schema:
      type: string
      default: 'pb'
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
