241 lines
7.6 KiB
YAML

---
#openapi: "3.0.0"
#info:
# version: "1.0.0"
# title: "Chill api"
# description: "Api documentation for chill. Currently, work in progress"
#servers:
# - url: "/api"
# description: "Your current dev server"
components:
schemas:
Date:
type: object
properties:
datetime:
type: string
format: date-time
User:
type: object
properties:
id:
type: integer
type:
type: string
enum:
- user
username:
type: string
text:
type: string
paths:
/1.0/calendar/calendar/{id}/answer/{answer}.json:
post:
tags:
- calendar
summary: Answer to a calendar's invite
parameters:
-
in: path
name: id
required: true
description: the calendar id
schema:
type: integer
format: integer
minimum: 0
-
in: path
name: answer
required: true
description: the answer
schema:
type: string
enum:
- accepted
- declined
- tentative
responses:
400:
description: bad answer
403:
description: not invited
404:
description: not found
202:
description: accepted
/1.0/calendar/calendar.json:
get:
tags:
- calendar
summary: Return a list of all calendar items
responses:
200:
description: "ok"
/1.0/calendar/calendar/{id}.json:
get:
tags:
- calendar
summary: Return an calendar item by id
parameters:
- name: id
in: path
required: true
description: The calendar id
schema:
type: integer
format: integer
minimum: 1
responses:
200:
description: "ok"
404:
description: "not found"
401:
description: "Unauthorized"
/1.0/calendar/calendar-range.json:
get:
tags:
- calendar
summary: Return a list of all calendar range items
responses:
200:
description: "ok"
post:
tags:
- calendar
summary: create a new calendar range
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
user:
$ref: '#/components/schemas/User'
startDate:
$ref: '#/components/schemas/Date'
endDate:
$ref: '#/components/schemas/Date'
responses:
401:
description: "Unauthorized"
404:
description: "Not found"
200:
description: "OK"
422:
description: "Unprocessable entity (validation errors)"
400:
description: "transition cannot be applyed"
/1.0/calendar/calendar-range/{id}.json:
get:
tags:
- calendar
summary: Return an calendar-range item by id
parameters:
- name: id
in: path
required: true
description: The calendar-range id
schema:
type: integer
format: integer
minimum: 1
responses:
200:
description: "ok"
404:
description: "not found"
401:
description: "Unauthorized"
patch:
tags:
- calendar
summary: update a calendar range
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
user:
$ref: '#/components/schemas/User'
startDate:
$ref: '#/components/schemas/Date'
endDate:
$ref: '#/components/schemas/Date'
responses:
401:
description: "Unauthorized"
404:
description: "Not found"
200:
description: "OK"
422:
description: "Unprocessable entity (validation errors)"
400:
description: "transition cannot be applyed"
delete:
tags:
- calendar
summary: "Remove a calendar range"
parameters:
- name: id
in: path
required: true
description: The calendar range id
schema:
type: integer
format: integer
minimum: 1
responses:
401:
description: "Unauthorized"
404:
description: "Not found"
200:
description: "OK"
422:
description: "object with validation errors"
/1.0/calendar/calendar-range-available/{userId}.json:
get:
tags:
- calendar
summary: Return a list of available calendar range items. Available means calendar-range not being taken by a calendar entity
parameters:
- name: userId
in: path
required: true
description: The user id
schema:
type: integer
format: integer
minimum: 1
- name: dateFrom
in: query
required: true
description: The date from, formatted as ISO8601 string
schema:
type: string
format: date-time
- name: dateTo
in: query
required: true
description: The date to, formatted as ISO8601 string
schema:
type: string
format: date-time
responses:
200:
description: "ok"