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: "comedian-new.maddevs.co" basePath: "/" 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" securityDefinitions: JWT: description: "insert as follows: Bearer + JWT from login responce" type: apiKey name: Authorization in: header 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: - "application/json" produces: - "application/json" parameters: - in: body name: body required: true description: login params schema: $ref: '#/definitions/Login' 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" consumes: - "application/json" produces: - "application/json" parameters: - in: body name: body required: true description: "note: slack attachment has particular structure, learn more at slack documentation" schema: $ref: '#/definitions/ServiceMessage' responses: 400: description: "incorrect data format" 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" /v1/bots: get: security: - JWT: [] tags: - "bots" summary: "Returns all bots" description: "Returns a map of bot settings" produces: - "application/json" responses: 200: description: "success" schema: type: "array" items: $ref: "#/definitions/Bot" 401: description: "Unauthorized" 500: description: "Internal Error" /v1/bots/{id}: get: security: - JWT: [] 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: security: - JWT: [] tags: - "bots" summary: "Updates a bot in the database with form data" description: "Update language, notifier_interval, reminder_repeat_max and reminder_time of the bot" consumes: - "application/json" produces: - "application/json" parameters: - name: "id" in: "path" description: "id of bot that needs to be updated" required: true type: "integer" - in: body name: body required: true description: Bot params that needs to be updated schema: $ref: '#/definitions/Bot' 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: security: - JWT: [] 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" /v1/bots/{id}/update-password: post: security: - JWT: [] summary: "updates bot password" consumes: - "application/json" produces: - "application/json" parameters: - name: "id" in: "path" description: "Bot id to change password for" required: true type: "integer" format: "int" - name: "old_password" in: "query" description: "current password" required: true type: "string" - name: "new_password" in: "query" description: "desired password" required: true type: "string" responses: 400: description: "Invalid data" 403: description: "Access Denied" 500: description: "Internal Error" 201: description: "successful operation" /v1/users: get: security: - JWT: [] tags: - "users" summary: "Returns all users belonging to one slack team" description: "Returns a map of users" produces: - "application/json" responses: 200: description: "success" schema: type: "array" items: $ref: "#/definitions/User" 401: description: "Unauthorized" 500: description: "Internal Error" /v1/users/{id}: get: security: - JWT: [] 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: type: "array" items: $ref: "#/definitions/User" 400: description: "Invalid data format" 401: description: "No JWT Token" 403: description: "No access to resource" 500: description: "Internal Error" patch: security: - JWT: [] tags: - "users" summary: "Updates a user in the database with form data" description: "" consumes: - "application/json" produces: - "application/json" parameters: - name: "id" in: "path" description: "id of user to return" required: true type: "integer" - in: body name: body required: true description: User params that needs to be updated. Currently only role can be modified schema: $ref: '#/definitions/User' 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" /v1/channels: get: security: - JWT: [] tags: - "channels" summary: "Returns all channels" description: "Returns a map of channel objects" produces: - "application/json" parameters: [] responses: 200: description: "successful operation" schema: type: "array" items: $ref: "#/definitions/Channel" 401: description: "Unauthorized" 500: description: "Internal Error" /v1/channels/{id}: get: security: - JWT: [] 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: security: - JWT: [] tags: - "channels" summary: "Updates a channel in the database" consumes: - "application/json" produces: - "application/json" parameters: - name: "id" in: "path" description: "id of channel that needs to be updated" required: true type: "integer" - in: body name: body required: true description: Channel params that needs to be updated. Currently only standup time can be modified schema: $ref: '#/definitions/Channel' 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" /v1/channels/{id}/standupers: get: security: - JWT: [] tags: - "channels" summary: "Find standupers by channel's id" description: "Returns a list of channels" produces: - "application/json" parameters: - name: "id" in: "path" description: "id of a channel" required: true type: "integer" responses: 200: description: "successful operation" schema: type: "array" items: $ref: "#/definitions/Standuper" 400: description: "Invalid data format" 401: description: "No JWT Token" 403: description: "No access to resource" 500: description: "Internal Error" /v1/standupers: get: security: - JWT: [] tags: - "standupers" summary: "Returns all standupers" description: "Returns a map of standuper objects" produces: - "application/json" parameters: [] responses: 200: description: "successful operation" schema: type: "array" items: $ref: "#/definitions/Standuper" 401: description: "Unauthorized" 500: description: "Internal Error" /v1/standupers/{id}: get: security: - JWT: [] 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: security: - JWT: [] tags: - "standupers" summary: "Updates a standuper in the database with form data" consumes: - "application/json" produces: - "application/json" parameters: - name: "id" in: "path" description: "id of standuper that needs to be updated" required: true type: "integer" - in: body name: body required: true description: Standuper params that needs to be updated. Currently only role can be modified schema: $ref: '#/definitions/Standuper' 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: security: - JWT: [] 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" /v1/standups: get: security: - JWT: [] tags: - "standups" summary: "Returns all standups" description: "Returns a map of standup objects" produces: - "application/json" parameters: [] responses: 200: description: "successful operation" schema: type: "array" items: $ref: "#/definitions/Standup" 401: description: "Unauthorized" 500: description: "Internal Error" /v1/standups/{id}: get: security: - JWT: [] 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" 404: description: "Not found" 403: description: "No access to resource" 500: description: "Internal Error" patch: security: - JWT: [] tags: - "standups" summary: "Updates a standup in the database with form data" consumes: - "application/json" produces: - "application/json" parameters: - name: "id" in: "path" description: "id of standup that needs to be updated" required: true type: "integer" - in: body name: body required: true description: standup params that needs to be updated schema: $ref: '#/definitions/Standup' 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: security: - JWT: [] 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" /v1/logout: post: security: - JWT: [] summary: "logs user out" responses: 401: description: "Unauthorzed" 201: description: "successful operation" definitions: Login: type: "object" properties: teamname: type: "string" password: type: "string" ServiceMessage: type: "object" properties: team_name: type: "string" bot_access_token: type: "string" channel: type: "string" message: type: "string" 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" real_name: type: "string" channel_name: 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" properties: id: type: "integer" format: "int64" team_id: type: "string" example: "TB9KS3E13" admin: type: "boolean" example: false 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" reporting_channel: type: "string" example: "TBA234GH" reporting_time: type: "string" example: "9:00" individual_reports_on: type: "boolean" example: false