swagger: "2.0" info: version: "1.0.0" title: "Mad Devs Comedian" contact: email: "fedorenko.tolik@gmail.com" license: name: "Apache 2.0" url: "http://www.apache.org/licenses/LICENSE-2.0.html" host: "staging.comedian.maddevs.co" basePath: "/v1" tags: - name: "standups" description: "Everything about standups" - name: "users" description: "Slack team users" - name: "channels" description: "Slack team channels (aka projects) tracked by Comedian" - name: "standupers" description: "Project standupers tracked by Comedian" - name: "bots" description: "Slack team bot settings (configuration)" schemes: - "https" - "http" paths: /healthcheck: get: summary: "Check if Comedian is healthy" produces: - "application/json" responses: 200: description: "successful operation" /login: post: summary: "check if login & pass correspond to values in DB and return JWT token" consumes: - "multipart/form-data" produces: - "application/json" parameters: - name: "teamname" in: "formData" description: "team name to login to" required: true type: "string" - name: "password" in: "formData" description: "password of the team" required: true type: "string" responses: 400: description: "Invalid login/password" 500: description: "Internal Error" 200: description: "successful operation" schema: type: object properties: bot: type: object $ref: "#/definitions/Bot" token: type: string description: JWT access token /event: post: summary: "Handles Slack events" description: "Handles different Slack triggers such as bot removal, or URL verification, does not belong to UI" responses: 200: description: "Success" 500: description: "Error" 400: description: "Incorrect data" /service-message: post: summary: "Handles messages from different Comedian services. Does not belong to UI. Needed for services only" responses: 200: description: "Message handled!" /commands: post: summary: "Handles Slack slash commands requests, does not belong to UI. Used to integration with Slack API" responses: 200: description: "Message from Comedian to Slack" /auth: get: summary: "Handles Comedian distribution into other Slack Teams. Does not belong to UI. This endpoint handles Slack API Requests" responses: 200: description: "Renders login page" /bots: get: tags: - "bots" summary: "Returns all bots" description: "Returns a map of bot settings, currently bot access token is empty in response for security reasons" produces: - "application/json" responses: 200: description: "success" schema: $ref: "#/definitions/Bot" 401: description: "Unauthorized" 500: description: "Internal Error" /bots/{id}: get: tags: - "bots" summary: "Find bot by id" description: "Returns a single bot" produces: - "application/json" parameters: - name: "id" in: "path" description: "id of bot to return" required: true type: "integer" responses: 200: description: "success" schema: $ref: "#/definitions/Bot" 400: description: "Invalid data format" 401: description: "No JWT Token" 403: description: "No access to resource" 500: description: "Internal Error" patch: tags: - "bots" summary: "Updates a bot in the database with form data" description: "" consumes: - "application/x-www-form-urlencoded" produces: - "application/json" parameters: - name: "id" in: "path" description: "id of bot that needs to be updated" required: true type: "integer" - name: "password" in: "formData" description: "Update password of the bot" required: true type: "string" - name: "language" in: "formData" description: "Update language of the bot" required: true type: "string" - name: "notifier_interval" in: "formData" description: "Update notifier interval of the bot" required: true type: "integer" maximum: 59 minimum: 1 format: "int" - name: "reminder_time" in: "formData" description: "Update reminder time (in minutes) of the bot" required: true type: "integer" minimum: 1 format: "int" - name: "reminder_repeat_max" in: "formData" description: "Update maximum reminder attempts of the bot" required: true type: "integer" minimum: 1 format: "int" responses: 200: description: "successful operation" schema: $ref: "#/definitions/Bot" 400: description: "Invalid data format" 401: description: "No JWT Token" 403: description: "No access to resource" 500: description: "Internal Error" delete: tags: - "bots" summary: "Deletes a bot" description: "Turns off the bot in someone's slack" produces: - "application/json" parameters: - name: "id" in: "path" description: "Bot id to delete" required: true type: "integer" format: "int" responses: 204: description: "successful operation" 400: description: "Invalid data format" 401: description: "No JWT Token" 403: description: "No access to resource" 500: description: "Internal Error" /users: get: tags: - "users" summary: "Returns all users" description: "Returns a map of user objects" produces: - "application/json" parameters: [] responses: 200: description: "successful operation" schema: $ref: "#/definitions/User" 401: description: "Unauthorized" 500: description: "Internal Error" /users/{id}: get: tags: - "users" summary: "Returns user by its ID" description: "Returns user object" produces: - "application/json" parameters: - name: "id" in: "path" description: "id of user to return" required: true type: "integer" responses: 200: description: "successful operation" schema: $ref: "#/definitions/User" 400: description: "Invalid data format" 401: description: "No JWT Token" 403: description: "No access to resource" 500: description: "Internal Error" patch: tags: - "users" summary: "Updates a user in the database with form data" description: "" consumes: - "application/x-www-form-urlencoded" produces: - "application/json" parameters: - name: "id" in: "path" description: "id of user to return" required: true type: "integer" - name: "role" in: "formData" description: "User role" required: true type: "string" responses: 200: description: "successful operation" schema: $ref: "#/definitions/User" 400: description: "Invalid data format" 401: description: "No JWT Token" 403: description: "No access to resource" 500: description: "Internal Error" /channels: get: tags: - "channels" summary: "Returns all channels" description: "Returns a map of channel objects" produces: - "application/json" parameters: [] responses: 200: description: "successful operation" schema: $ref: "#/definitions/Channel" 401: description: "Unauthorized" 500: description: "Internal Error" /channels/{id}: get: tags: - "channels" summary: "Find channel by id" description: "Returns a single channel" produces: - "application/json" parameters: - name: "id" in: "path" description: "id of a channel to return" required: true type: "integer" responses: 200: description: "successful operation" schema: $ref: "#/definitions/Channel" 400: description: "Invalid data format" 401: description: "No JWT Token" 403: description: "No access to resource" 500: description: "Internal Error" patch: tags: - "channels" summary: "Updates a channel in the database with form data" consumes: - "application/x-www-form-urlencoded" produces: - "application/json" parameters: - name: "id" in: "path" description: "id of channel that needs to be updated" required: true type: "integer" - name: "channel_standup_time" in: "formData" description: "Update standuptime of the channel" required: true type: "integer" format: "bigint" responses: 200: description: "successful operation" schema: $ref: "#/definitions/Channel" 400: description: "Invalid data format" 401: description: "No JWT Token" 403: description: "No access to resource" 500: description: "Internal Error" delete: tags: - "channels" summary: "Deletes a channel" description: "Removes comedian fro the channel in someone's slack" produces: - "application/json" parameters: - name: "id" in: "path" description: "id of channel that needs to be deleted" required: true type: "integer" - name: "channel_id" in: "path" description: "channel id to delete" required: true type: "integer" format: "int" responses: 204: description: "successful operation" 400: description: "Invalid data format" 401: description: "No JWT Token" 403: description: "No access to resource" 500: description: "Internal Error" /standupers: get: tags: - "standupers" summary: "Returns all standupers" description: "Returns a map of standuper objects" produces: - "application/json" parameters: [] responses: 200: description: "successful operation" schema: $ref: "#/definitions/Standuper" 401: description: "Unauthorized" 500: description: "Internal Error" /standupers/{id}: get: tags: - "standupers" summary: "Find standuper by id" description: "Returns a single standuper" produces: - "application/json" parameters: - name: "id" in: "path" description: "id of a standuper to return" required: true type: "integer" responses: 200: description: "successful operation" schema: $ref: "#/definitions/Standuper" 400: description: "Invalid data format" 401: description: "No JWT Token" 403: description: "No access to resource" 500: description: "Internal Error" patch: tags: - "standupers" summary: "Updates a standuper in the database with form data" consumes: - "application/x-www-form-urlencoded" produces: - "application/json" parameters: - name: "id" in: "path" description: "id of standuper that needs to be updated" required: true type: "integer" - name: "member_standup_time" in: "formData" description: "Update standup time of the standuper" required: true type: "integer" format: "bigint" - name: "role_in_channel" in: "formData" description: "Update role in channel of the standuper" required: true type: "string" responses: 200: description: "successful operation" schema: $ref: "#/definitions/Standuper" 400: description: "Invalid data format" 401: description: "No JWT Token" 403: description: "No access to resource" 500: description: "Internal Error" delete: tags: - "standupers" summary: "Deletes a standuper" description: "Untracks user in channel" produces: - "application/json" parameters: - name: "id" in: "path" description: "standuper id to delete" required: true type: "integer" format: "int" responses: 204: description: "successful operation" 400: description: "Invalid data format" 401: description: "No JWT Token" 403: description: "No access to resource" 500: description: "Internal Error" /standups: get: tags: - "standups" summary: "Returns all standups" description: "Returns a map of standup objects" produces: - "application/json" parameters: [] responses: 200: description: "successful operation" schema: $ref: "#/definitions/Standup" 401: description: "Unauthorized" 500: description: "Internal Error" /standups/{id}: get: tags: - "standups" summary: "Find standup by id" description: "Returns a single standup" produces: - "application/json" parameters: - name: "id" in: "path" description: "id of a standup to return" required: true type: "integer" responses: 200: description: "successful operation" schema: $ref: "#/definitions/Standup" 400: description: "Invalid data format" 401: description: "No JWT Token" 403: description: "No access to resource" 500: description: "Internal Error" patch: tags: - "standups" summary: "Updates a standup in the database with form data" consumes: - "application/x-www-form-urlencoded" produces: - "application/json" parameters: - name: "id" in: "path" description: "id of standup that needs to be updated" required: true type: "integer" - name: "comment" in: "formData" description: "Update standup body" required: true type: "string" format: "text" responses: 200: description: "successful operation" schema: $ref: "#/definitions/Standup" 400: description: "Invalid data format" 401: description: "No JWT Token" 403: description: "No access to resource" 500: description: "Internal Error" delete: tags: - "standups" summary: "Deletes a standup" produces: - "application/json" parameters: - name: "id" in: "path" description: "standup id to delete" required: true type: "integer" format: "int" responses: 204: description: "successful operation" 400: description: "Invalid data format" 401: description: "No JWT Token" 403: description: "No access to resource" 500: description: "Internal Error" definitions: User: type: "object" properties: id: type: "integer" user_name: type: "string" userID: type: "string" role: type: "string" realName: type: "string" Channel: type: "object" properties: id: type: "integer" channelName: type: "string" channel_id: type: "string" channel_standup_time: type: "integer" format: "bigint" Standuper: type: "object" properties: id: type: "integer" userId: type: "string" channel_id: type: "string" submitted_standup_today: type: "boolean" created: type: "string" role_in_channel: type: "string" Standup: type: "object" properties: id: type: "integer" userId: type: "string" channel_id: type: "string" comment: type: "string" format: "text" created: type: "string" modified: type: "string" message_ts: type: "string" team_id: type: "string" Bot: type: "object" required: - "name" - "photoUrls" properties: id: type: "integer" format: "int64" team_id: type: "string" example: "TB9KS3E13" team_name: type: "string" example: "example" password: type: "string" example: "example" language: type: "string" description: "bot language" enum: - "ru_Ru" - "en_US" notifier_interval: type: "integer" format: "int64" reminder_repeat_max: type: "integer" format: "int64" reminder_time: type: "integer" format: "int64"