{ "openapi": "3.0.2", "info": { "title": "API Title", "version": "1.0" }, "servers": [ { "url": "http://localhost:3000/api" } ], "paths": { "/calendar/event": { "get": { "summary": "Get the event by id", "operationId": "getEventById", "parameters": [ { "name": "id", "in": "query", "description": "Event id", "required": true, "schema": { "type": "string" } } ], "responses": { "200": { "description": "The event is found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Event" } } } }, "404": { "description": "Event not found" }, "500": { "description": "Internal server error" } } }, "post": { "summary": "Create a new event", "operationId": "createEvent", "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/NewEvent" } } } }, "responses": { "200": { "description": "Created", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Event" } } } }, "400": { "description": "This period is already booked", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/RecommendedPeriods" } } } }, "500": { "description": "Internal server error" } } } }, "/calendar/availability": { "post": { "summary": "Check period availability", "operationId": "checkAvailability", "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Availability" } } } }, "responses": { "200": { "description": "OK", "content": { "application/json": { "schema": { "type": "object", "properties": { "available": { "type": "boolean" } } } } } }, "400": { "description": "This period is already booked", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/RecommendedPeriods" } } } }, "500": { "description": "Internal server error" } } } } }, "components": { "schemas": { "Event": { "type": "object", "properties": { "id": { "type": "string" }, "name": { "type": "string" }, "startDate": { "type": "string", "format": "date" }, "endDate": { "type": "string", "format": "date" } } }, "NewEvent": { "type": "object", "properties": { "name": { "type": "string" }, "startDate": { "type": "string", "format": "date" }, "endDate": { "type": "string", "format": "date" } } }, "Availability": { "type": "object", "properties": { "startDate": { "type": "string", "format": "date" }, "endDate": { "type": "string", "format": "date" } } }, "RecommendedPeriods": { "type": "array", "items": { "type": "object", "properties": { "startDate": { "type": "string", "format": "date" }, "endDate": { "type": "string", "format": "date" } } } } } } }