{ "swagger": "2.0", "info": { "description": "This is the API for Schej.it!", "title": "Schej.it API", "contact": {}, "license": {}, "version": "1.0" }, "host": "localhost:3002", "paths": { "/analytics/scanned-poster": { "post": { "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "analytics" ], "summary": "Notifies us when poster QR code has been scanned", "parameters": [ { "description": "Object containing the location that poster was scanned from and the url that was scanned", "name": "payload", "in": "body", "required": true, "schema": { "allOf": [ { "type": "object" }, { "type": "object", "properties": { "location": { "$ref": "#/definitions/models.Location" }, "url": { "type": "string" } } } ] } } ], "responses": { "200": {} } } }, "/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": "Object containing the Google authorization code and the user's timezone offset", "name": "payload", "in": "body", "required": true, "schema": { "allOf": [ { "type": "object" }, { "type": "object", "properties": { "code": { "type": "string" }, "timezoneOffset": { "type": "integer" } } } ] } } ], "responses": { "200": {} } } }, "/auth/sign-in-mobile": { "post": { "description": "Signs user in and sets the access token session variable", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "auth" ], "summary": "Signs user in from mobile", "parameters": [ { "description": "Object containing the Google authorization code and the user's timezone offset", "name": "payload", "in": "body", "required": true, "schema": { "allOf": [ { "type": "object" }, { "type": "object", "properties": { "accessToken": { "type": "string" }, "expiresIn": { "type": "integer" }, "idToken": { "type": "string" }, "refreshToken": { "type": "string" }, "scope": { "type": "string" }, "timezoneOffset": { "type": "integer" } } } ] } } ], "responses": { "200": {} } } }, "/auth/sign-out": { "post": { "description": "Signs user out and deletes the session", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "auth" ], "summary": "Signs user out", "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": [ "events" ], "summary": "Creates a new event", "parameters": [ { "description": "Object containing info about the event to create", "name": "payload", "in": "body", "required": true, "schema": { "allOf": [ { "type": "object" }, { "type": "object", "properties": { "dates": { "type": "array", "items": { "$ref": "#/definitions/primitive.DateTime" } }, "duration": { "type": "number" }, "name": { "type": "string" }, "notificationsEnabled": { "type": "boolean" }, "type": { "$ref": "#/definitions/models.EventType" } } } ] } } ], "responses": { "201": { "description": "Created", "schema": { "allOf": [ { "type": "object" }, { "type": "object", "properties": { "eventId": { "type": "string" } } } ] } } } } }, "/events/{eventId}": { "get": { "produces": [ "application/json" ], "tags": [ "events" ], "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" } } } }, "put": { "produces": [ "application/json" ], "tags": [ "events" ], "summary": "Edits an event based on its id", "parameters": [ { "type": "string", "description": "Event ID", "name": "eventId", "in": "path", "required": true }, { "description": "Object containing info about the event to update", "name": "payload", "in": "body", "required": true, "schema": { "allOf": [ { "type": "object" }, { "type": "object", "properties": { "dates": { "type": "array", "items": { "$ref": "#/definitions/primitive.DateTime" } }, "duration": { "type": "number" }, "name": { "type": "string" }, "notificationsEnabled": { "type": "boolean" }, "type": { "$ref": "#/definitions/models.EventType" } } } ] } } ], "responses": { "200": {} } }, "delete": { "produces": [ "application/json" ], "tags": [ "events" ], "summary": "Deletes an event based on its id", "parameters": [ { "type": "string", "description": "Event ID", "name": "eventId", "in": "path", "required": true } ], "responses": { "200": {} } } }, "/events/{eventId}/response": { "post": { "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "events" ], "summary": "Updates the current user's availability", "parameters": [ { "type": "string", "description": "Event ID", "name": "eventId", "in": "path", "required": true }, { "description": "Object containing info about the event response to update", "name": "payload", "in": "body", "required": true, "schema": { "allOf": [ { "type": "object" }, { "type": "object", "properties": { "availability": { "type": "array", "items": { "type": "string" } }, "guest": { "type": "boolean" }, "name": { "type": "string" } } } ] } } ], "responses": { "200": {} } } }, "/events/{eventId}/schedule": { "post": { "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "events" ], "summary": "Schedules an event on the user's google calendar", "parameters": [ { "type": "string", "description": "Event ID", "name": "eventId", "in": "path", "required": true }, { "description": "Object containing info about the event to schedule", "name": "payload", "in": "body", "required": true, "schema": { "allOf": [ { "type": "object" }, { "type": "object", "properties": { "attendeeEmails": { "type": "array", "items": { "type": "string" } }, "endDate": { "$ref": "#/definitions/primitive.DateTime" }, "startDate": { "$ref": "#/definitions/primitive.DateTime" } } } ] } } ], "responses": { "200": {} } } }, "/friends": { "get": { "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "friends" ], "summary": "Gets all of users current friends", "responses": { "200": {} } } }, "/friends/requests": { "get": { "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "friends" ], "summary": "Gets all the current incoming and outgoing friend requests", "responses": { "200": {} } }, "post": { "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "friends" ], "summary": "Creates a new friend request", "parameters": [ { "description": "Object specifying the user IDs of who this request is sent from and to", "name": "payload", "in": "body", "required": true, "schema": { "allOf": [ { "type": "object" }, { "type": "object", "properties": { "to": { "type": "string" } } } ] } } ], "responses": { "200": { "description": "Friend request already exists from \\\"to\\\" to \\\"from\\\", and it was accepted" }, "201": { "description": "Friend request created", "schema": { "$ref": "#/definitions/models.FriendRequest" } } } } }, "/friends/requests/{id}": { "delete": { "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "friends" ], "summary": "Delete's a friend request created by the current user", "parameters": [ { "type": "string", "description": "ID of the friend request", "name": "id", "in": "path", "required": true } ], "responses": { "200": {} } } }, "/friends/requests/{id}/accept": { "post": { "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "friends" ], "summary": "Accepts an existing friend request", "parameters": [ { "type": "string", "description": "ID of the friend request", "name": "id", "in": "path", "required": true } ], "responses": { "200": {} } } }, "/friends/requests/{id}/reject": { "post": { "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "friends" ], "summary": "Rejects an existing friend request", "parameters": [ { "type": "string", "description": "ID of the friend request", "name": "id", "in": "path", "required": true } ], "responses": { "200": {} } } }, "/friends/{id}": { "delete": { "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "friends" ], "summary": "Removes an existing friend", "parameters": [ { "type": "string", "description": "ID of friend", "name": "id", "in": "path", "required": true } ], "responses": { "200": {} } } }, "/friends/{id}/calendar": { "get": { "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "friends" ], "summary": "Returns the specified friend's schedule", "parameters": [ { "type": "string", "description": "ID of friend", "name": "id", "in": "path", "required": true }, { "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" } } } } } }, "/friends/{id}/status": { "get": { "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "friends" ], "summary": "Returns whether the friend is free or busy", "parameters": [ { "type": "string", "description": "ID of friend", "name": "id", "in": "path", "required": true } ] } }, "/user": { "delete": { "produces": [ "application/json" ], "tags": [ "user" ], "summary": "Deletes the currently signed in user", "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": { "allOf": [ { "type": "object" }, { "type": "object", "properties": { "events": { "type": "array", "items": { "$ref": "#/definitions/models.Event" } }, "joinedEvents": { "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 profile object", "schema": { "$ref": "#/definitions/models.UserProfile" } } } } }, "/user/searchContacts": { "get": { "produces": [ "application/json" ], "tags": [ "user" ], "summary": "Searches the user's contacts based on the given query", "parameters": [ { "type": "string", "description": "Query to search for", "name": "query", "in": "query", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "type": "array", "items": { "$ref": "#/definitions/models.UserProfile" } } } } } }, "/user/visibility": { "post": { "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "user" ], "summary": "Updates the current user's visibility", "parameters": [ { "description": "Visibility of user from 0 to 2", "name": "payload", "in": "body", "required": true, "schema": { "allOf": [ { "type": "object" }, { "type": "object", "properties": { "visibility": { "type": "integer" } } } ] } } ], "responses": { "200": {} } } }, "/users": { "get": { "produces": [ "application/json" ], "tags": [ "users" ], "summary": "Returns users that match the search query", "parameters": [ { "type": "string", "description": "Search query matching users' names/emails", "name": "query", "in": "query", "required": true } ], "responses": { "200": { "description": "An array of user profile objects", "schema": { "type": "array", "items": { "$ref": "#/definitions/models.UserProfile" } } } } } } }, "definitions": { "models.CalendarEvent": { "type": "object", "properties": { "endDate": { "type": "object", "$ref": "#/definitions/primitive.DateTime" }, "startDate": { "type": "object", "$ref": "#/definitions/primitive.DateTime" }, "summary": { "type": "string" } } }, "models.Event": { "type": "object", "properties": { "_id": { "type": "string" }, "calendarEventId": { "type": "string" }, "dates": { "type": "array", "items": { "$ref": "#/definitions/primitive.DateTime" } }, "duration": { "type": "number" }, "name": { "type": "string" }, "notificationsEnabled": { "type": "boolean" }, "ownerId": { "type": "string" }, "responses": { "description": "Availability responses", "type": "object", "additionalProperties": { "$ref": "#/definitions/models.Response" } }, "scheduledEvent": { "description": "Scheduled event", "type": "object", "$ref": "#/definitions/models.CalendarEvent" }, "type": { "type": "string" } } }, "models.EventType": { "type": "string" }, "models.FriendRequest": { "type": "object", "properties": { "_id": { "type": "string" }, "createdAt": { "type": "object", "$ref": "#/definitions/primitive.DateTime" }, "from": { "type": "string" }, "fromUser": { "type": "object", "$ref": "#/definitions/models.UserProfile" }, "to": { "type": "string" }, "toUser": { "type": "object", "$ref": "#/definitions/models.UserProfile" } } }, "models.Location": { "type": "object", "properties": { "city": { "type": "string" }, "country_code": { "type": "string" }, "country_name": { "type": "string" }, "latitude": { "type": "number" }, "longitude": { "type": "number" }, "postal": { "type": "string" }, "state": { "type": "string" } } }, "models.Response": { "type": "object", "properties": { "availability": { "type": "array", "items": { "type": "string" } }, "name": { "type": "string" }, "user": { "type": "object", "$ref": "#/definitions/models.UserProfile" }, "userId": { "type": "string" } } }, "models.UserProfile": { "type": "object", "properties": { "_id": { "type": "string" }, "email": { "type": "string" }, "firstName": { "type": "string" }, "lastName": { "type": "string" }, "picture": { "type": "string" }, "visibility": { "type": "integer" } } }, "primitive.DateTime": { "type": "integer" }, "primitive.DateTime": { "type": "integer" }, "responses.Error": { "type": "object", "required": [ "error" ], "properties": { "error": { "type": "object" } } } } }