crabfit/crabfit-backend/swagger.yaml
2021-06-19 13:12:51 +10:00

259 lines
6.3 KiB
YAML

swagger: "2.0"
info:
title: "Crab Fit"
description: "Compare and align schedules to find a time that works for everyone"
version: "1.0.0"
host: "api-dot-crabfit.appspot.com"
x-google-endpoints:
- name: "api-dot-crabfit.appspot.com"
allowCors: true
schemes:
- "https"
produces:
- "application/json"
definitions:
Event:
type: "object"
properties:
id:
type: "string"
name:
type: "string"
timezone:
type: "string"
created:
type: "integer"
times:
type: "array"
items:
type: "string"
Person:
type: "object"
properties:
name:
type: "string"
availability:
type: "array"
items:
type: "string"
created:
type: "integer"
paths:
"/stats":
get:
summary: "Return stats for crabfit"
operationId: "getStats"
responses:
200:
description: "OK"
schema:
type: "object"
properties:
eventCount:
type: "integer"
personCount:
type: "integer"
version:
type: "string"
"/event/{eventId}":
get:
summary: "Return an event details"
operationId: "getEvent"
parameters:
- in: "path"
name: "eventId"
required: true
type: "string"
description: "The ID of the event"
responses:
200:
description: "OK"
schema:
$ref: '#/definitions/Event'
404:
description: "Not found"
"/event":
post:
summary: "Create a new event"
operationId: "postEvent"
parameters:
- in: "body"
name: "event"
required: true
schema:
type: "object"
properties:
name:
type: "string"
timezone:
type: "string"
times:
type: "array"
items:
type: "string"
description: "New event details"
responses:
201:
description: "Created"
schema:
$ref: '#/definitions/Event'
400:
description: "Invalid data"
"/event/{eventId}/people":
get:
summary: "Get availabilities for an event"
operationId: "getPeople"
parameters:
- in: "path"
name: "eventId"
required: true
type: "string"
description: "The ID of the event"
responses:
200:
description: "OK"
schema:
type: "object"
properties:
people:
type: "array"
items:
$ref: "#/definitions/Person"
404:
description: "Not found"
post:
summary: "Add a new person to the event"
operationId: "postPeople"
parameters:
- in: "path"
name: "eventId"
required: true
type: "string"
description: "The ID of the event"
- in: "body"
name: "person"
required: true
schema:
type: "object"
properties:
name:
type: "string"
password:
type: "string"
description: "New person details"
responses:
201:
description: "Created"
404:
description: "Not found"
400:
description: "Invalid data"
"/event/{eventId}/people/{personName}":
post:
summary: "Login as this person"
operationId: "getPerson"
parameters:
- in: "path"
name: "eventId"
required: true
type: "string"
description: "The ID of the event"
- in: "path"
name: "personName"
required: true
type: "string"
description: "The name of the person"
- in: "body"
name: "person"
required: false
schema:
type: "object"
properties:
password:
type: "string"
description: "Login details"
responses:
200:
description: "OK"
schema:
$ref: "#/definitions/Person"
401:
description: "Incorrect password"
404:
description: "Not found"
patch:
summary: "Update this person's availabilities"
operationId: "patchPerson"
parameters:
- in: "path"
name: "eventId"
required: true
type: "string"
description: "The ID of the event"
- in: "path"
name: "personName"
required: true
type: "string"
description: "The name of the person"
- in: "body"
name: "person"
required: true
schema:
type: "object"
properties:
password:
type: "string"
availability:
type: "array"
items:
type: "string"
description: "Updated person details"
responses:
200:
description: "OK"
401:
description: "Incorrect password"
404:
description: "Not found"
400:
description: "Invalid data"
"/tasks/cleanup":
get:
summary: "Delete events inactive for more than 3 months"
operationId: "taskCleanup"
tags:
- tasks
responses:
200:
description: "OK"
404:
description: "Not found"
400:
description: "Not called from a cron job"
"/tasks/legacyCleanup":
get:
summary: "Delete events inactive for more than 3 months that don't have a visited date"
operationId: "taskLegacyCleanup"
tags:
- tasks
responses:
200:
description: "OK"
404:
description: "Not found"
400:
description: "Not called from a cron job"
"/tasks/removeOrphans":
get:
summary: "Deletes people if the event they were created under no longer exists"
operationId: "taskRemoveOrphans"
tags:
- tasks
responses:
200:
description: "OK"
404:
description: "Not found"
400:
description: "Not called from a cron job"