{ "swagger": "2.0", "info": { "description": "This is the API for Schej.it!", "title": "Schej.it API", "contact": {}, "license": {}, "version": "1.0" }, "host": "localhost:3000", "paths": { "/auth/sign-in": { "post": { "description": "Signs user in and sets the access token session variable", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "auth" ], "summary": "Signs user in", "parameters": [ { "description": "Google authorization code", "name": "code", "in": "body", "required": true, "schema": { "type": "string" } } ], "responses": { "200": {} } } }, "/auth/status": { "get": { "description": "Returns a 401 error if user is not signed in, 200 if they are", "tags": [ "auth" ], "summary": "Gets whether the user is signed in or not", "responses": { "200": {}, "401": { "description": "Error object", "schema": { "$ref": "#/definitions/responses.Error" } } } } }, "/events": { "post": { "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "event" ], "summary": "Creates a new event", "parameters": [ { "description": "Name", "name": "name", "in": "body", "required": true, "schema": { "type": "string" } }, { "description": "Start date", "name": "startDate", "in": "body", "required": true, "schema": { "type": "string" } }, { "description": "End date", "name": "endDate", "in": "body", "required": true, "schema": { "type": "string" } }, { "description": "Start time", "name": "startTime", "in": "body", "required": true, "schema": { "type": "integer" } }, { "description": "End time", "name": "endTime", "in": "body", "required": true, "schema": { "type": "integer" } } ], "responses": { "201": { "description": "Created", "schema": { "allOf": [ { "type": "object" }, { "type": "object", "properties": { "eventId": { "type": "string" } } } ] } } } } }, "/events/:eventId": { "get": { "produces": [ "application/json" ], "tags": [ "event" ], "summary": "Gets an event based on its id", "parameters": [ { "type": "string", "description": "Event ID", "name": "eventId", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/models.Event" } } } } }, "/events/:eventId/response": { "post": { "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "event" ], "summary": "Updates the current user's availability", "parameters": [ { "type": "string", "description": "Event ID", "name": "eventId", "in": "path", "required": true }, { "description": "Array of dates representing user's availability", "name": "availability", "in": "body", "required": true, "schema": { "type": "array", "items": { "type": "string" } } } ], "responses": { "200": {} } } }, "/user/calendar": { "get": { "description": "Gets the user's calendar events between \"timeMin\" and \"timeMax\"", "produces": [ "application/json" ], "tags": [ "user" ], "summary": "Gets the user's calendar events", "parameters": [ { "type": "string", "description": "Lower bound for event's start time to filter by", "name": "timeMin", "in": "query", "required": true }, { "type": "string", "description": "Upper bound for event's end time to filter by", "name": "timeMax", "in": "query", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "type": "array", "items": { "$ref": "#/definitions/models.CalendarEvent" } } } } } }, "/user/events": { "get": { "description": "Returns an array containing all the user's events", "produces": [ "application/json" ], "tags": [ "user" ], "summary": "Gets all the user's events", "responses": { "200": { "description": "OK", "schema": { "type": "array", "items": { "$ref": "#/definitions/models.Event" } } } } } }, "/user/profile": { "get": { "produces": [ "application/json" ], "tags": [ "user" ], "summary": "Gets the user's profile", "responses": { "200": { "description": "A user object", "schema": { "$ref": "#/definitions/models.User" } } } } } }, "definitions": { "models.CalendarEvent": { "type": "object", "required": [ "endDate", "startDate", "summary" ], "properties": { "endDate": { "type": "string" }, "startDate": { "type": "string" }, "summary": { "type": "string" } } }, "models.Event": { "type": "object", "required": [ "_id", "endDate", "endTime", "name", "ownerId", "responses", "startDate", "startTime" ], "properties": { "_id": { "type": "string" }, "endDate": { "type": "string" }, "endTime": { "type": "integer" }, "name": { "type": "string" }, "ownerId": { "type": "string" }, "responses": { "type": "object", "additionalProperties": { "$ref": "#/definitions/models.Response" } }, "startDate": { "type": "string" }, "startTime": { "type": "integer" } } }, "models.Response": { "type": "object", "required": [ "availability", "userId" ], "properties": { "availability": { "type": "array", "items": { "type": "string" } }, "user": { "type": "object", "$ref": "#/definitions/models.User" }, "userId": { "type": "string" } } }, "models.User": { "type": "object", "required": [ "_id", "email", "firstName", "lastName", "picture" ], "properties": { "_id": { "type": "string" }, "email": { "type": "string" }, "firstName": { "type": "string" }, "lastName": { "type": "string" }, "picture": { "type": "string" } } }, "responses.Error": { "type": "object", "required": [ "error" ], "properties": { "error": { "type": "string" } } } } }