#%RAML 1.0
---
baseUri: 'http://api.phpsx.org'
version: v1
title: PSX
/foo:
  get:
    description: 'Returns a collection'
    responses:
      200:
        body:
          application/json:
            type: EntryCollection
  post:
    body:
      application/json:
        type: 1
    responses:
      201:
        body:
          application/json:
            type: EntryMessage
/bar/{foo}:
  uriParameters:
    foo:
      type: string
      required: false
  get:
    description: 'Returns a collection'
    responses:
      200:
        body:
          application/json:
            type: EntryCollection
  post:
    body:
      application/json:
        type: 1
    responses:
      201:
        body:
          application/json:
            type: EntryMessage
/bar/{year}:
  uriParameters:
    year:
      type: string
      required: false
  get:
    description: 'Returns a collection'
    responses:
      200:
        body:
          application/json:
            type: EntryCollection
  post:
    body:
      application/json:
        type: 1
    responses:
      201:
        body:
          application/json:
            type: EntryMessage
types:
  Entry: { type: object, properties: { id: { type: integer }, userId: { type: integer }, title: { type: string, pattern: '[A-z]+', minLength: 3, maxLength: 16 }, date: { format: date-time, type: string } } }
  EntryCollection: { type: object, properties: { entry: { type: array, items: { $ref: '#/types/Entry' } } } }
  EntryCreate: { type: object, properties: { id: { type: integer }, userId: { type: integer }, title: { type: string, pattern: '[A-z]+', minLength: 3, maxLength: 16 }, date: { format: date-time, type: string } }, required: [title, date] }
  EntryMessage: { type: object, properties: { success: { type: boolean }, message: { type: string } } }
  PathFoo: { type: object, properties: { foo: { type: string } } }
  PathYear: { type: object, properties: { year: { type: string } } }
