211 lines
5.1 KiB
YAML
211 lines
5.1 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"
|
|
schemes:
|
|
- "https"
|
|
produces:
|
|
- "application/json"
|
|
definitions:
|
|
Event:
|
|
type: "object"
|
|
properties:
|
|
id:
|
|
type: "string"
|
|
name:
|
|
type: "string"
|
|
created:
|
|
type: "integer"
|
|
times:
|
|
type: "array"
|
|
items:
|
|
type: "string"
|
|
Person:
|
|
type: "object"
|
|
properties:
|
|
name:
|
|
type: "string"
|
|
availability:
|
|
type: "array"
|
|
items:
|
|
type: "string"
|
|
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"
|
|
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"
|