{ "swagger": "2.0", "info": { "description": "This is the API for Schej.it!", "title": "Schej.it API", "contact": {}, "license": {}, "version": "1.0" }, "host": "localhost:3002/api", "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": { "attendees": { "type": "array", "items": { "type": "string" } }, "blindAvailabilityEnabled": { "type": "boolean" }, "dates": { "type": "array", "items": { "type": "string" } }, "daysOnly": { "type": "boolean" }, "duration": { "type": "number" }, "name": { "type": "string" }, "notificationsEnabled": { "type": "boolean" }, "remindees": { "type": "array", "items": { "type": "string" } }, "sendEmailAfterXResponses": { "type": "integer" }, "type": { "$ref": "#/definitions/models.EventType" }, "when2meetHref": { "type": "string" } } } ] } } ], "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": { "attendees": { "type": "array", "items": { "type": "string" } }, "blindAvailabilityEnabled": { "type": "boolean" }, "dates": { "type": "array", "items": { "type": "string" } }, "daysOnly": { "type": "boolean" }, "duration": { "type": "number" }, "name": { "type": "string" }, "notificationsEnabled": { "type": "boolean" }, "remindees": { "type": "array", "items": { "type": "string" } }, "sendEmailAfterXResponses": { "type": "integer" }, "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}/calendar-availabilities": { "get": { "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "events" ], "summary": "Return a map mapping user id to their calendar events that they have enabled for the given time range", "parameters": [ { "type": "string", "description": "Event ID", "name": "eventId", "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": "object", "additionalProperties": { "type": "object", "additionalProperties": { "$ref": "#/definitions/calendar.CalendarEventsWithError" } } } } } } }, "/events/{eventId}/decline": { "post": { "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "events" ], "summary": "Decline the current user's invite to the event", "parameters": [ { "type": "string", "description": "Event ID", "name": "eventId", "in": "path", "required": true } ], "responses": { "200": {} } } }, "/events/{eventId}/duplicate": { "post": { "produces": [ "application/json" ], "tags": [ "events" ], "summary": "Duplicate event", "parameters": [ { "type": "string", "description": "Event ID", "name": "eventId", "in": "path", "required": true }, { "description": "Object containing options for the duplicated event", "name": "payload", "in": "body", "required": true, "schema": { "allOf": [ { "type": "object" }, { "type": "object", "properties": { "copyAvailability": { "type": "boolean" }, "eventName": { "type": "string" } } } ] } } ], "responses": { "200": {} } } }, "/events/{eventId}/responded": { "post": { "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "events" ], "summary": "Mark the user as having responded to this event", "parameters": [ { "type": "string", "description": "Event ID", "name": "eventId", "in": "path", "required": true }, { "description": "Object containing the user's email", "name": "payload", "in": "body", "required": true, "schema": { "allOf": [ { "type": "object" }, { "type": "object", "properties": { "email": { "type": "string" } } } ] } } ], "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" } }, "calendarOptions": { "$ref": "#/definitions/models.CalendarOptions" }, "enabledCalendars": { "type": "object", "additionalProperties": { "type": "array", "items": { "type": "string" } } }, "guest": { "type": "boolean" }, "ifNeeded": { "type": "array", "items": { "type": "string" } }, "manualAvailability": { "type": "object", "additionalProperties": { "type": "array", "items": { "type": "string" } } }, "name": { "type": "string" }, "useCalendarAvailability": { "type": "boolean" } } } ] } } ], "responses": { "200": {} } }, "delete": { "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "events" ], "summary": "Delete 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 delete", "name": "payload", "in": "body", "required": true, "schema": { "allOf": [ { "type": "object" }, { "type": "object", "properties": { "guest": { "type": "boolean" }, "name": { "type": "string" }, "userId": { "type": "string" } } } ] } } ], "responses": { "200": {} } } }, "/events/{eventId}/responses": { "get": { "produces": [ "application/json" ], "tags": [ "events" ], "summary": "Gets responses for an event, filtering availability to be within the date ranges", "parameters": [ { "type": "string", "description": "Event ID", "name": "eventId", "in": "path", "required": true }, { "type": "string", "description": "Lower bound for start time to filter availability by", "name": "timeMin", "in": "query", "required": true }, { "type": "string", "description": "Upper bound for end time to filter availability by", "name": "timeMax", "in": "query", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "type": "object", "additionalProperties": { "$ref": "#/definitions/models.Response" } } } } } }, "/slackbot": { "post": { "consumes": [ "application/x-www-form-urlencoded" ], "produces": [ "application/json" ], "tags": [ "slackbot" ], "summary": "Gets the number of signed up users", "responses": { "200": { "description": "Text response", "schema": { "$ref": "#/definitions/commands.Response" } } } } }, "/user": { "delete": { "produces": [ "application/json" ], "tags": [ "user" ], "summary": "Deletes the currently signed in user", "responses": { "200": {} } } }, "/user/add-apple-calendar-account": { "post": { "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "user" ], "summary": "Adds an apple calendar account", "parameters": [ { "description": "Object containing the email and app password of the apple account", "name": "payload", "in": "body", "required": true, "schema": { "allOf": [ { "type": "object" }, { "type": "object", "properties": { "email": { "type": "string" }, "password": { "type": "string" } } } ] } } ], "responses": { "200": {} } } }, "/user/add-google-calendar-account": { "post": { "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "user" ], "summary": "Adds a new calendar account", "parameters": [ { "description": "Object containing the Google authorization code", "name": "payload", "in": "body", "required": true, "schema": { "allOf": [ { "type": "object" }, { "type": "object", "properties": { "code": { "type": "string" } } } ] } } ], "responses": { "200": {} } } }, "/user/calendar-options": { "patch": { "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "user" ], "summary": "Updates the user's calendar options", "parameters": [ { "description": "Object containing the updated options", "name": "payload", "in": "body", "required": true, "schema": { "allOf": [ { "type": "object" }, { "type": "object", "properties": { "bufferTime": { "$ref": "#/definitions/models.BufferTimeOptions" }, "workingHours": { "$ref": "#/definitions/models.WorkingHoursOptions" } } } ] } } ], "responses": { "200": {} } } }, "/user/calendars": { "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 }, { "type": "string", "description": "Comma separated list of accounts to fetch calendar events from", "name": "accounts", "in": "query" } ], "responses": { "200": { "description": "OK", "schema": { "type": "object", "additionalProperties": { "$ref": "#/definitions/calendar.CalendarEventsWithError" } } } } } }, "/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/name": { "patch": { "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "user" ], "summary": "Updates the user's name", "parameters": [ { "description": "Object containing the updated name", "name": "payload", "in": "body", "required": true, "schema": { "allOf": [ { "type": "object" }, { "type": "object", "properties": { "firstName": { "type": "string" }, "lastName": { "type": "string" } } } ] } } ], "responses": { "200": {} } } }, "/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.User" } } } } }, "/user/remove-calendar-account": { "delete": { "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "user" ], "summary": "Removes an existing calendar account", "parameters": [ { "description": "Object containing the email + type of the calendar account to remove", "name": "payload", "in": "body", "required": true, "schema": { "allOf": [ { "type": "object" }, { "type": "object", "properties": { "calendarType": { "$ref": "#/definitions/models.CalendarType" }, "email": { "type": "string" } } } ] } } ], "responses": { "200": {} } } }, "/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.User" } } } } } }, "/user/toggle-calendar": { "post": { "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "user" ], "summary": "Toggles whether the specified calendar is enabled or disabled for the user", "parameters": [ { "description": "Email of calendar account and whether to enable it", "name": "payload", "in": "body", "required": true, "schema": { "allOf": [ { "type": "object" }, { "type": "object", "properties": { "calendarAccountKey": { "type": "string" }, "enabled": { "type": "boolean" } } } ] } } ], "responses": { "200": {} } } }, "/user/toggle-sub-calendar": { "post": { "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "user" ], "summary": "Toggles whether the specified sub-calendar is enabled or disabled for the user", "parameters": [ { "description": "Email of calendar account, the sub calendar id, and whether to enable it", "name": "payload", "in": "body", "required": true, "schema": { "allOf": [ { "type": "object" }, { "type": "object", "properties": { "calendarAccountKey": { "type": "string" }, "enabled": { "type": "boolean" }, "subCalendarId": { "type": "string" } } } ] } } ], "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.User" } } } } } }, "/users/{userId}": { "get": { "produces": [ "application/json" ], "tags": [ "users" ], "summary": "Returns the user by their user id", "parameters": [ { "type": "string", "description": "User ID", "name": "userId", "in": "path", "required": true } ], "responses": { "200": { "description": "A user profile object", "schema": { "$ref": "#/definitions/models.User" } } } } } }, "definitions": { "calendar.CalendarEventsWithError": { "type": "object", "properties": { "calendarEvents": { "type": "array", "items": { "$ref": "#/definitions/models.CalendarEvent" } }, "error": { "type": "error" } } }, "commands.Response": { "type": "object", "properties": { "blocks": { "type": "string" }, "response_type": { "description": "ephemeral or in_channel", "type": "string" }, "text": { "type": "string" } } }, "models.AppleCalendarAuth": { "type": "object" }, "models.Attendee": { "type": "object", "properties": { "declined": { "type": "boolean" }, "email": { "type": "string" } } }, "models.BufferTimeOptions": { "type": "object", "properties": { "enabled": { "type": "boolean" }, "time": { "type": "integer" } } }, "models.CalendarAccount": { "type": "object", "properties": { "appleCalendarAuth": { "type": "object", "$ref": "#/definitions/models.AppleCalendarAuth" }, "calendarType": { "type": "string" }, "email": { "description": "Email is required for all calendar accounts", "type": "string" }, "enabled": { "type": "boolean" }, "googleCalendarAuth": { "type": "object", "$ref": "#/definitions/models.GoogleCalendarAuth" }, "outlookCalendarAuth": { "type": "object", "$ref": "#/definitions/models.OutlookCalendarAuth" }, "picture": { "type": "string" }, "subCalendars": { "type": "object", "additionalProperties": { "$ref": "#/definitions/models.SubCalendar" } } } }, "models.CalendarEvent": { "type": "object", "properties": { "calendarId": { "type": "string" }, "endDate": { "type": "string" }, "free": { "description": "Whether the user is free during this event", "type": "boolean" }, "id": { "type": "string" }, "startDate": { "type": "string" }, "summary": { "type": "string" } } }, "models.CalendarOptions": { "type": "object", "properties": { "bufferTime": { "type": "object", "$ref": "#/definitions/models.BufferTimeOptions" }, "workingHours": { "type": "object", "$ref": "#/definitions/models.WorkingHoursOptions" } } }, "models.CalendarType": { "type": "string" }, "models.Event": { "type": "object", "properties": { "_id": { "type": "string" }, "attendees": { "description": "Attendees for an availability group", "type": "array", "items": { "$ref": "#/definitions/models.Attendee" } }, "blindAvailabilityEnabled": { "description": "Whether to enable blind availability", "type": "boolean" }, "calendarEventId": { "type": "string" }, "collectEmails": { "type": "boolean" }, "dates": { "type": "string" }, "daysOnly": { "description": "Whether to only poll for days, not times", "type": "boolean" }, "duration": { "type": "number" }, "name": { "type": "string" }, "notificationsEnabled": { "type": "boolean" }, "ownerId": { "type": "string" }, "remindees": { "description": "Remindees", "type": "array", "items": { "$ref": "#/definitions/models.Remindee" } }, "responses": { "description": "Availability responses", "type": "object", "additionalProperties": { "$ref": "#/definitions/models.Response" } }, "scheduledEvent": { "description": "Scheduled event", "type": "object", "$ref": "#/definitions/models.CalendarEvent" }, "sendEmailAfterXResponses": { "type": "integer" }, "shortId": { "type": "string" }, "type": { "type": "string" }, "when2meetHref": { "type": "string" } } }, "models.EventType": { "type": "string" }, "models.GoogleCalendarAuth": { "type": "object" }, "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.OutlookCalendarAuth": { "type": "object" }, "models.Remindee": { "type": "object", "properties": { "email": { "type": "string" }, "responded": { "type": "boolean" } } }, "models.Response": { "type": "object", "properties": { "availability": { "description": "Availability", "type": "string" }, "calendarOptions": { "type": "object", "$ref": "#/definitions/models.CalendarOptions" }, "email": { "type": "string" }, "enabledCalendars": { "description": "Maps email to an array of sub calendar ids", "type": "object", "additionalProperties": { "type": "array", "items": { "type": "string" } } }, "ifNeeded": { "type": "string" }, "manualAvailability": { "description": "Mapping from the start date of a day to the available times for that day", "type": "object", "additionalProperties": { "type": "array", "items": { "$ref": "#/definitions/primitive.DateTime" } } }, "name": { "description": "Guest information", "type": "string" }, "useCalendarAvailability": { "description": "Calendar availability variables for Availability Groups feature", "type": "boolean" }, "user": { "type": "object", "$ref": "#/definitions/models.User" }, "userId": { "description": "User information", "type": "string" } } }, "models.SubCalendar": { "type": "object", "properties": { "enabled": { "type": "boolean" }, "name": { "type": "string" } } }, "models.User": { "type": "object", "properties": { "_id": { "description": "Profile info", "type": "string" }, "calendarAccounts": { "description": "CalendarAccounts is a mapping from {`email_CALENDARTYPE` =\u003e CalendarAccount} that contains all the\nadditional accounts the user wants to see google calendar events for", "type": "object", "additionalProperties": { "$ref": "#/definitions/models.CalendarAccount" } }, "calendarOptions": { "description": "Calendar options", "type": "object", "$ref": "#/definitions/models.CalendarOptions" }, "email": { "type": "string" }, "firstName": { "type": "string" }, "hasCustomName": { "description": "Whether the user has set a custom name for themselves, i.e. don't change their name when they sign in", "type": "boolean" }, "lastName": { "type": "string" }, "picture": { "type": "string" }, "timezoneOffset": { "type": "integer" } } }, "models.WorkingHoursOptions": { "type": "object", "properties": { "enabled": { "type": "boolean" }, "endTime": { "type": "number" }, "startTime": { "type": "number" } } }, "responses.Error": { "type": "object", "required": [ "error" ], "properties": { "error": { "type": "object" } } } } }