{ "schemes": [ "http" ], "swagger": "2.0", "info": { "description": "API для AnalogYouTube: пользователи, видео, чаты, донаты и остальное.\nДля закрытых запросов нажмите Authorize и вставьте: Bearer \u003ctoken\u003e.", "title": "AnalogYouTube API", "contact": { "name": "AnalogYouTube Backend", "email": "analogyoutube@example.com" }, "version": "1.0" }, "host": "localhost:8080", "basePath": "/", "paths": { "/api/admin/videos/{id}": { "delete": { "security": [ { "BearerAuth": [] } ], "description": "Полностью удаляет видео.", "produces": [ "application/json" ], "tags": [ "Admin", "Videos" ], "summary": "Админское удаление", "parameters": [ { "type": "integer", "description": "ID видео", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/httpdelivery.CommonResponse" } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/httpdelivery.CommonError" } }, "403": { "description": "Forbidden", "schema": { "$ref": "#/definitions/httpdelivery.CommonError" } } } } }, "/api/categories": { "get": { "description": "Список категорий.", "produces": [ "application/json" ], "tags": [ "Categories" ], "summary": "Все категории", "responses": { "200": { "description": "OK", "schema": { "type": "array", "items": { "$ref": "#/definitions/domain.Category" } } } } }, "post": { "security": [ { "BearerAuth": [] } ], "description": "Новая категория для видео.", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "Categories", "Admin" ], "summary": "Создать категорию", "parameters": [ { "description": "Данные категории", "name": "input", "in": "body", "required": true, "schema": { "$ref": "#/definitions/dto.CreateCategoryRequest" } } ], "responses": { "201": { "description": "Created", "schema": { "$ref": "#/definitions/domain.Category" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/httpdelivery.CommonError" } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/httpdelivery.CommonError" } }, "403": { "description": "Forbidden", "schema": { "$ref": "#/definitions/httpdelivery.CommonError" } } } } }, "/api/categories/{id}": { "put": { "security": [ { "BearerAuth": [] } ], "description": "Меняет название или описание категории.", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "Categories", "Admin" ], "summary": "Обновить категорию", "parameters": [ { "type": "integer", "description": "ID категории", "name": "id", "in": "path", "required": true }, { "description": "Новые данные", "name": "input", "in": "body", "required": true, "schema": { "$ref": "#/definitions/dto.UpdateCategoryRequest" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/domain.Category" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/httpdelivery.CommonError" } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/httpdelivery.CommonError" } }, "403": { "description": "Forbidden", "schema": { "$ref": "#/definitions/httpdelivery.CommonError" } } } }, "delete": { "security": [ { "BearerAuth": [] } ], "description": "Удаляет категорию.", "produces": [ "application/json" ], "tags": [ "Categories", "Admin" ], "summary": "Удалить категорию", "parameters": [ { "type": "integer", "description": "ID категории", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/httpdelivery.CommonResponse" } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/httpdelivery.CommonError" } }, "403": { "description": "Forbidden", "schema": { "$ref": "#/definitions/httpdelivery.CommonError" } } } } }, "/api/categories/{name}": { "get": { "description": "Данные одной категории.", "produces": [ "application/json" ], "tags": [ "Categories" ], "summary": "Категория по имени", "parameters": [ { "type": "string", "description": "Имя категории", "name": "name", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/domain.Category" } }, "404": { "description": "Not Found", "schema": { "$ref": "#/definitions/httpdelivery.CommonError" } } } } }, "/api/chats": { "get": { "security": [ { "BearerAuth": [] } ], "description": "Список уже открытых чатов.", "produces": [ "application/json" ], "tags": [ "Chats" ], "summary": "Мои чаты", "responses": { "200": { "description": "OK", "schema": { "type": "array", "items": { "$ref": "#/definitions/domain.Chat" } } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/httpdelivery.CommonError" } } } }, "post": { "security": [ { "BearerAuth": [] } ], "description": "Отправляет пользователю запрос на личный чат.", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "Chats" ], "summary": "Заявка на чат", "parameters": [ { "description": "Кому отправить", "name": "input", "in": "body", "required": true, "schema": { "$ref": "#/definitions/dto.CreateChatRequest" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/domain.ChatRequest" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/httpdelivery.CommonError" } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/httpdelivery.CommonError" } } } } }, "/api/chats/requests/incoming": { "get": { "security": [ { "BearerAuth": [] } ], "description": "Запросы на чат, которые отправили вам.", "produces": [ "application/json" ], "tags": [ "Chats" ], "summary": "Входящие заявки", "responses": { "200": { "description": "OK", "schema": { "type": "array", "items": { "$ref": "#/definitions/domain.ChatRequest" } } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/httpdelivery.CommonError" } } } } }, "/api/chats/requests/outgoing": { "get": { "security": [ { "BearerAuth": [] } ], "description": "Запросы на чат, которые отправили вы.", "produces": [ "application/json" ], "tags": [ "Chats" ], "summary": "Исходящие заявки", "responses": { "200": { "description": "OK", "schema": { "type": "array", "items": { "$ref": "#/definitions/domain.ChatRequest" } } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/httpdelivery.CommonError" } } } } }, "/api/chats/requests/{id}/accept": { "post": { "security": [ { "BearerAuth": [] } ], "description": "Принимает запрос и создает чат.", "produces": [ "application/json" ], "tags": [ "Chats" ], "summary": "Принять заявку", "parameters": [ { "type": "integer", "description": "ID заявки", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/domain.AcceptedChatRequest" } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/httpdelivery.CommonError" } }, "403": { "description": "Forbidden", "schema": { "$ref": "#/definitions/httpdelivery.CommonError" } }, "404": { "description": "Not Found", "schema": { "$ref": "#/definitions/httpdelivery.CommonError" } } } } }, "/api/chats/requests/{id}/reject": { "post": { "security": [ { "BearerAuth": [] } ], "description": "Отклоняет запрос без создания чата.", "produces": [ "application/json" ], "tags": [ "Chats" ], "summary": "Отклонить заявку", "parameters": [ { "type": "integer", "description": "ID заявки", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/domain.ChatRequest" } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/httpdelivery.CommonError" } }, "403": { "description": "Forbidden", "schema": { "$ref": "#/definitions/httpdelivery.CommonError" } }, "404": { "description": "Not Found", "schema": { "$ref": "#/definitions/httpdelivery.CommonError" } } } } }, "/api/chats/{id}/messages": { "get": { "security": [ { "BearerAuth": [] } ], "description": "История сообщений выбранного чата.", "produces": [ "application/json" ], "tags": [ "Chats" ], "summary": "Сообщения чата", "parameters": [ { "type": "integer", "description": "ID чата", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "type": "array", "items": { "$ref": "#/definitions/domain.ChatMessage" } } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/httpdelivery.CommonError" } }, "403": { "description": "Forbidden", "schema": { "$ref": "#/definitions/httpdelivery.CommonError" } } } }, "post": { "security": [ { "BearerAuth": [] } ], "description": "Создает сообщение в выбранном чате.", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "Chats" ], "summary": "Отправить сообщение", "parameters": [ { "type": "integer", "description": "ID чата", "name": "id", "in": "path", "required": true }, { "description": "Текст сообщения", "name": "input", "in": "body", "required": true, "schema": { "$ref": "#/definitions/dto.CreateChatMessageRequest" } } ], "responses": { "201": { "description": "Created", "schema": { "$ref": "#/definitions/domain.ChatMessage" } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/httpdelivery.CommonError" } }, "403": { "description": "Forbidden", "schema": { "$ref": "#/definitions/httpdelivery.CommonError" } } } } }, "/api/comments/{id}": { "put": { "security": [ { "BearerAuth": [] } ], "description": "Меняет текст комментария.", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "Comments" ], "summary": "Обновить комментарий", "parameters": [ { "type": "integer", "description": "ID комментария", "name": "id", "in": "path", "required": true }, { "description": "Новый текст", "name": "input", "in": "body", "required": true, "schema": { "$ref": "#/definitions/dto.UpdateCommentRequest" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/domain.Comment" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/httpdelivery.CommonError" } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/httpdelivery.CommonError" } }, "403": { "description": "Forbidden", "schema": { "$ref": "#/definitions/httpdelivery.CommonError" } } } }, "delete": { "security": [ { "BearerAuth": [] } ], "description": "Удаляет комментарий.", "produces": [ "application/json" ], "tags": [ "Comments" ], "summary": "Удалить комментарий", "parameters": [ { "type": "integer", "description": "ID комментария", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/httpdelivery.CommonResponse" } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/httpdelivery.CommonError" } }, "403": { "description": "Forbidden", "schema": { "$ref": "#/definitions/httpdelivery.CommonError" } } } } }, "/api/donations": { "post": { "security": [ { "BearerAuth": [] } ], "description": "Сохраняет донат без настоящей оплаты.", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "Donations" ], "summary": "Создать донат", "parameters": [ { "description": "Данные доната", "name": "input", "in": "body", "required": true, "schema": { "$ref": "#/definitions/dto.CreateDonationRequest" } } ], "responses": { "201": { "description": "Created", "schema": { "$ref": "#/definitions/domain.Donation" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/httpdelivery.CommonError" } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/httpdelivery.CommonError" } } } } }, "/api/donations/received": { "get": { "security": [ { "BearerAuth": [] } ], "description": "Донаты, которые получили вы.", "produces": [ "application/json" ], "tags": [ "Donations" ], "summary": "Мои полученные донаты", "responses": { "200": { "description": "OK", "schema": { "type": "array", "items": { "$ref": "#/definitions/domain.Donation" } } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/httpdelivery.CommonError" } } } } }, "/api/donations/sent": { "get": { "security": [ { "BearerAuth": [] } ], "description": "Донаты, которые отправили вы.", "produces": [ "application/json" ], "tags": [ "Donations" ], "summary": "Мои отправленные донаты", "responses": { "200": { "description": "OK", "schema": { "type": "array", "items": { "$ref": "#/definitions/domain.Donation" } } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/httpdelivery.CommonError" } } } } }, "/api/login": { "post": { "description": "Возвращает access и refresh токены.", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "Auth" ], "summary": "Вход", "parameters": [ { "description": "Данные входа", "name": "input", "in": "body", "required": true, "schema": { "$ref": "#/definitions/dto.SignInRequest" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/dto.TokenPairResponse" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/httpdelivery.CommonError" } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/httpdelivery.CommonError" } } } } }, "/api/me": { "get": { "security": [ { "BearerAuth": [] } ], "description": "Данные текущего пользователя.", "produces": [ "application/json" ], "tags": [ "Profile" ], "summary": "Мой профиль", "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/domain.UserProfile" } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/httpdelivery.CommonError" } } } }, "put": { "security": [ { "BearerAuth": [] } ], "description": "Меняет мои данные, аватарку или пароль.", "consumes": [ "multipart/form-data" ], "produces": [ "application/json" ], "tags": [ "Profile" ], "summary": "Обновить профиль", "parameters": [ { "type": "string", "description": "Новое имя пользователя", "name": "username", "in": "formData", "required": true }, { "type": "string", "description": "Email, например user@gmail.com", "name": "email", "in": "formData" }, { "type": "string", "description": "Новый пароль", "name": "password", "in": "formData" }, { "type": "string", "description": "Описание канала", "name": "description", "in": "formData" }, { "type": "file", "description": "Файл аватарки", "name": "avatar", "in": "formData" } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/domain.User" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/httpdelivery.CommonError" } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/httpdelivery.CommonError" } }, "422": { "description": "Unprocessable Entity", "schema": { "$ref": "#/definitions/httpdelivery.CommonError" } } } } }, "/api/playlists": { "post": { "security": [ { "BearerAuth": [] } ], "description": "Новый публичный плейлист.", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "Playlists" ], "summary": "Создать плейлист", "parameters": [ { "description": "Данные плейлиста", "name": "input", "in": "body", "required": true, "schema": { "$ref": "#/definitions/dto.CreatePlaylistRequest" } } ], "responses": { "201": { "description": "Created", "schema": { "$ref": "#/definitions/domain.Playlist" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/httpdelivery.CommonError" } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/httpdelivery.CommonError" } } } } }, "/api/playlists/{id}": { "get": { "description": "Плейлист и его видео.", "produces": [ "application/json" ], "tags": [ "Playlists" ], "summary": "Плейлист по ID", "parameters": [ { "type": "integer", "description": "ID плейлиста", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/domain.Playlist" } }, "404": { "description": "Not Found", "schema": { "$ref": "#/definitions/httpdelivery.CommonError" } } } }, "put": { "security": [ { "BearerAuth": [] } ], "description": "Меняет название или описание.", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "Playlists" ], "summary": "Обновить плейлист", "parameters": [ { "type": "integer", "description": "ID плейлиста", "name": "id", "in": "path", "required": true }, { "description": "Новые данные", "name": "input", "in": "body", "required": true, "schema": { "$ref": "#/definitions/dto.UpdatePlaylistRequest" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/domain.Playlist" } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/httpdelivery.CommonError" } }, "403": { "description": "Forbidden", "schema": { "$ref": "#/definitions/httpdelivery.CommonError" } } } }, "delete": { "security": [ { "BearerAuth": [] } ], "description": "Удаляет плейлист автора.", "produces": [ "application/json" ], "tags": [ "Playlists" ], "summary": "Удалить плейлист", "parameters": [ { "type": "integer", "description": "ID плейлиста", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/httpdelivery.CommonResponse" } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/httpdelivery.CommonError" } }, "403": { "description": "Forbidden", "schema": { "$ref": "#/definitions/httpdelivery.CommonError" } } } } }, "/api/playlists/{id}/videos": { "post": { "security": [ { "BearerAuth": [] } ], "description": "Добавляет ролик в плейлист.", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "Playlists" ], "summary": "Добавить видео", "parameters": [ { "type": "integer", "description": "ID плейлиста", "name": "id", "in": "path", "required": true }, { "description": "ID видео", "name": "input", "in": "body", "required": true, "schema": { "$ref": "#/definitions/dto.AddVideoToPlaylistRequest" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/httpdelivery.CommonResponse" } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/httpdelivery.CommonError" } }, "403": { "description": "Forbidden", "schema": { "$ref": "#/definitions/httpdelivery.CommonError" } } } } }, "/api/playlists/{id}/videos/{video_id}": { "delete": { "security": [ { "BearerAuth": [] } ], "description": "Убирает ролик из плейлиста.", "produces": [ "application/json" ], "tags": [ "Playlists" ], "summary": "Убрать видео", "parameters": [ { "type": "integer", "description": "ID плейлиста", "name": "id", "in": "path", "required": true }, { "type": "integer", "description": "ID видео", "name": "video_id", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/httpdelivery.CommonResponse" } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/httpdelivery.CommonError" } }, "403": { "description": "Forbidden", "schema": { "$ref": "#/definitions/httpdelivery.CommonError" } } } } }, "/api/register": { "post": { "description": "Создает нового пользователя. Email можно не указывать.", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "Auth" ], "summary": "Регистрация", "parameters": [ { "description": "Данные регистрации", "name": "input", "in": "body", "required": true, "schema": { "$ref": "#/definitions/dto.SignUpRequest" } } ], "responses": { "201": { "description": "Created", "schema": { "$ref": "#/definitions/httpdelivery.CommonResponse" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/httpdelivery.CommonError" } }, "422": { "description": "Unprocessable Entity", "schema": { "$ref": "#/definitions/httpdelivery.CommonError" } } } } }, "/api/users/{id}": { "get": { "description": "Публичная страница канала.", "produces": [ "application/json" ], "tags": [ "Profile" ], "summary": "Профиль пользователя", "parameters": [ { "type": "integer", "description": "ID пользователя", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/domain.UserProfile" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/httpdelivery.CommonError" } }, "404": { "description": "Not Found", "schema": { "$ref": "#/definitions/httpdelivery.CommonError" } } } } }, "/api/users/{id}/donations": { "get": { "description": "Публичный список полученных донатов.", "produces": [ "application/json" ], "tags": [ "Donations" ], "summary": "Донаты пользователя", "parameters": [ { "type": "integer", "description": "ID пользователя", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "type": "array", "items": { "$ref": "#/definitions/domain.Donation" } } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/httpdelivery.CommonError" } } } } }, "/api/users/{id}/playlists": { "get": { "description": "Публичные плейлисты автора.", "produces": [ "application/json" ], "tags": [ "Playlists" ], "summary": "Плейлисты пользователя", "parameters": [ { "type": "integer", "description": "ID пользователя", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "type": "array", "items": { "$ref": "#/definitions/domain.Playlist" } } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/httpdelivery.CommonError" } } } } }, "/api/users/{id}/subscribe": { "post": { "security": [ { "BearerAuth": [] } ], "description": "Подписка на автора.", "produces": [ "application/json" ], "tags": [ "Subscriptions" ], "summary": "Подписаться", "parameters": [ { "type": "integer", "description": "ID пользователя, на которого подписываемся", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/httpdelivery.CommonResponse" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/httpdelivery.CommonError" } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/httpdelivery.CommonError" } } } }, "delete": { "security": [ { "BearerAuth": [] } ], "description": "Отмена подписки.", "produces": [ "application/json" ], "tags": [ "Subscriptions" ], "summary": "Отписаться", "parameters": [ { "type": "integer", "description": "ID пользователя", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/httpdelivery.CommonResponse" } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/httpdelivery.CommonError" } } } } }, "/api/users/{id}/subscribed": { "get": { "security": [ { "BearerAuth": [] } ], "description": "Показывает, подписан ли я на автора.", "produces": [ "application/json" ], "tags": [ "Subscriptions" ], "summary": "Моя подписка", "parameters": [ { "type": "integer", "description": "ID пользователя", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "type": "object", "additionalProperties": { "type": "boolean" } } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/httpdelivery.CommonError" } } } } }, "/api/users/{id}/subscribers/count": { "get": { "description": "Сколько людей подписано на автора.", "produces": [ "application/json" ], "tags": [ "Subscriptions" ], "summary": "Подписчики", "parameters": [ { "type": "integer", "description": "ID пользователя", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "type": "object", "additionalProperties": { "type": "integer" } } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/httpdelivery.CommonError" } } } } }, "/api/users/{id}/subscriptions/count": { "get": { "description": "Сколько подписок у пользователя.", "produces": [ "application/json" ], "tags": [ "Subscriptions" ], "summary": "Подписки", "parameters": [ { "type": "integer", "description": "ID пользователя", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "type": "object", "additionalProperties": { "type": "integer" } } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/httpdelivery.CommonError" } } } } }, "/api/users/{id}/videos": { "get": { "description": "Ролики выбранного автора.", "produces": [ "application/json" ], "tags": [ "Profile" ], "summary": "Видео пользователя", "parameters": [ { "type": "integer", "description": "ID пользователя", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "type": "array", "items": { "$ref": "#/definitions/domain.Video" } } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/httpdelivery.CommonError" } }, "404": { "description": "Not Found", "schema": { "$ref": "#/definitions/httpdelivery.CommonError" } } } } }, "/api/videos": { "get": { "description": "Видео для главной ленты.", "produces": [ "application/json" ], "tags": [ "Videos" ], "summary": "Рекомендации", "responses": { "200": { "description": "OK", "schema": { "type": "array", "items": { "$ref": "#/definitions/domain.Video" } } } } }, "post": { "security": [ { "BearerAuth": [] } ], "description": "Загружает видеофайл, обложку и данные ролика.", "consumes": [ "multipart/form-data" ], "produces": [ "application/json" ], "tags": [ "Videos" ], "summary": "Создать видео", "parameters": [ { "type": "string", "description": "Название видео", "name": "title", "in": "formData", "required": true }, { "type": "string", "description": "Описание видео", "name": "description", "in": "formData" }, { "type": "string", "description": "Имя категории", "name": "category_name", "in": "formData" }, { "type": "file", "description": "Файл видео", "name": "video", "in": "formData", "required": true }, { "type": "file", "description": "Файл обложки", "name": "thumbnail", "in": "formData", "required": true } ], "responses": { "201": { "description": "Created", "schema": { "$ref": "#/definitions/domain.Video" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/httpdelivery.CommonError" } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/httpdelivery.CommonError" } } } } }, "/api/videos/allvideos": { "get": { "security": [ { "BearerAuth": [] } ], "description": "Админский список всех видео.", "produces": [ "application/json" ], "tags": [ "Admin", "Videos" ], "summary": "Все видео", "responses": { "200": { "description": "OK", "schema": { "type": "array", "items": { "$ref": "#/definitions/domain.Video" } } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/httpdelivery.CommonError" } }, "403": { "description": "Forbidden", "schema": { "$ref": "#/definitions/httpdelivery.CommonError" } } } } }, "/api/videos/playback-speeds": { "get": { "description": "Доступные скорости плеера.", "produces": [ "application/json" ], "tags": [ "Videos" ], "summary": "Скорости видео", "responses": { "200": { "description": "OK", "schema": { "type": "object", "additionalProperties": { "type": "array", "items": { "type": "number", "format": "float64" } } } } } } }, "/api/videos/search": { "get": { "description": "Ищет ролики по названию.", "produces": [ "application/json" ], "tags": [ "Videos" ], "summary": "Поиск видео", "parameters": [ { "type": "string", "description": "Часть названия видео", "name": "title", "in": "query", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "type": "array", "items": { "$ref": "#/definitions/domain.Video" } } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/httpdelivery.CommonError" } } } } }, "/api/videos/{id}": { "get": { "description": "Данные видео и новый просмотр.", "produces": [ "application/json" ], "tags": [ "Videos" ], "summary": "Видео по ID", "parameters": [ { "type": "integer", "description": "ID видео", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/domain.Video" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/httpdelivery.CommonError" } }, "404": { "description": "Not Found", "schema": { "$ref": "#/definitions/httpdelivery.CommonError" } } } }, "put": { "security": [ { "BearerAuth": [] } ], "description": "Меняет данные ролика без замены видеофайла.", "consumes": [ "multipart/form-data" ], "produces": [ "application/json" ], "tags": [ "Videos" ], "summary": "Обновить видео", "parameters": [ { "type": "integer", "description": "ID видео", "name": "id", "in": "path", "required": true }, { "type": "string", "description": "Название видео", "name": "title", "in": "formData", "required": true }, { "type": "string", "description": "Описание видео", "name": "description", "in": "formData" }, { "type": "string", "description": "Имя категории", "name": "category_name", "in": "formData" }, { "type": "file", "description": "Новая обложка", "name": "thumbnail", "in": "formData" } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/domain.Video" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/httpdelivery.CommonError" } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/httpdelivery.CommonError" } }, "403": { "description": "Forbidden", "schema": { "$ref": "#/definitions/httpdelivery.CommonError" } } } }, "delete": { "security": [ { "BearerAuth": [] } ], "description": "Скрывает видео и оставляет архивную копию.", "produces": [ "application/json" ], "tags": [ "Videos" ], "summary": "Удалить видео", "parameters": [ { "type": "integer", "description": "ID видео", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/httpdelivery.CommonResponse" } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/httpdelivery.CommonError" } }, "403": { "description": "Forbidden", "schema": { "$ref": "#/definitions/httpdelivery.CommonError" } }, "404": { "description": "Not Found", "schema": { "$ref": "#/definitions/httpdelivery.CommonError" } } } } }, "/api/videos/{id}/comments": { "get": { "description": "Список комментариев под видео.", "produces": [ "application/json" ], "tags": [ "Comments" ], "summary": "Комментарии видео", "parameters": [ { "type": "integer", "description": "ID видео", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "type": "array", "items": { "$ref": "#/definitions/domain.Comment" } } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/httpdelivery.CommonError" } } } }, "post": { "security": [ { "BearerAuth": [] } ], "description": "Добавляет комментарий к видео.", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "Comments" ], "summary": "Создать комментарий", "parameters": [ { "type": "integer", "description": "ID видео", "name": "id", "in": "path", "required": true }, { "description": "Текст комментария", "name": "input", "in": "body", "required": true, "schema": { "$ref": "#/definitions/dto.CreateCommentRequest" } } ], "responses": { "201": { "description": "Created", "schema": { "$ref": "#/definitions/domain.Comment" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/httpdelivery.CommonError" } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/httpdelivery.CommonError" } } } } }, "/api/videos/{id}/like": { "post": { "security": [ { "BearerAuth": [] } ], "description": "Лайк от текущего пользователя.", "produces": [ "application/json" ], "tags": [ "Likes" ], "summary": "Поставить лайк", "parameters": [ { "type": "integer", "description": "ID видео", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/httpdelivery.CommonResponse" } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/httpdelivery.CommonError" } } } }, "delete": { "security": [ { "BearerAuth": [] } ], "description": "Удаляет мой лайк с видео.", "produces": [ "application/json" ], "tags": [ "Likes" ], "summary": "Убрать лайк", "parameters": [ { "type": "integer", "description": "ID видео", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/httpdelivery.CommonResponse" } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/httpdelivery.CommonError" } } } } }, "/api/videos/{id}/liked": { "get": { "security": [ { "BearerAuth": [] } ], "description": "Показывает, лайкнул ли я видео.", "produces": [ "application/json" ], "tags": [ "Likes" ], "summary": "Мой лайк", "parameters": [ { "type": "integer", "description": "ID видео", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "type": "object", "additionalProperties": { "type": "boolean" } } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/httpdelivery.CommonError" } } } } }, "/api/videos/{id}/likes/count": { "get": { "description": "Сколько лайков у видео.", "produces": [ "application/json" ], "tags": [ "Likes" ], "summary": "Количество лайков", "parameters": [ { "type": "integer", "description": "ID видео", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "type": "object", "additionalProperties": { "type": "integer" } } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/httpdelivery.CommonError" } } } } }, "/auth/refresh": { "get": { "description": "Меняет refresh token на новую пару токенов.", "produces": [ "application/json" ], "tags": [ "Auth" ], "summary": "Обновить токены", "parameters": [ { "type": "string", "description": "Refresh token", "name": "Refresh-Token", "in": "header", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/dto.TokenPairResponse" } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/httpdelivery.CommonError" } } } } }, "/auth/sign-in": { "post": { "description": "Возвращает access и refresh токены.", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "Auth" ], "summary": "Вход", "parameters": [ { "description": "Данные входа", "name": "input", "in": "body", "required": true, "schema": { "$ref": "#/definitions/dto.SignInRequest" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/dto.TokenPairResponse" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/httpdelivery.CommonError" } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/httpdelivery.CommonError" } } } } }, "/auth/sign-up": { "post": { "description": "Создает нового пользователя. Email можно не указывать.", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "Auth" ], "summary": "Регистрация", "parameters": [ { "description": "Данные регистрации", "name": "input", "in": "body", "required": true, "schema": { "$ref": "#/definitions/dto.SignUpRequest" } } ], "responses": { "201": { "description": "Created", "schema": { "$ref": "#/definitions/httpdelivery.CommonResponse" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/httpdelivery.CommonError" } }, "422": { "description": "Unprocessable Entity", "schema": { "$ref": "#/definitions/httpdelivery.CommonError" } } } } }, "/ping": { "get": { "description": "Быстрый ответ, что backend жив.", "produces": [ "application/json" ], "tags": [ "System" ], "summary": "Проверка сервера", "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/httpdelivery.CommonResponse" } } } } }, "/ws/chats/{id}": { "get": { "description": "Адрес для live-сообщений. Токен передается в access_token.", "tags": [ "WebSocket" ], "summary": "WebSocket чата", "parameters": [ { "type": "integer", "description": "ID чата", "name": "id", "in": "path", "required": true }, { "type": "string", "description": "Access token", "name": "access_token", "in": "query", "required": true } ], "responses": { "101": { "description": "WebSocket соединение открыто", "schema": { "type": "string" } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/httpdelivery.CommonError" } }, "403": { "description": "Forbidden", "schema": { "$ref": "#/definitions/httpdelivery.CommonError" } } } } } }, "definitions": { "domain.AcceptedChatRequest": { "type": "object", "properties": { "chat": { "$ref": "#/definitions/domain.Chat" }, "request": { "$ref": "#/definitions/domain.ChatRequest" } } }, "domain.Category": { "type": "object", "properties": { "created_at": { "type": "string" }, "description": { "type": "string" }, "id": { "type": "integer" }, "name": { "type": "string" }, "updated_at": { "type": "string" } } }, "domain.Chat": { "type": "object", "properties": { "created_at": { "type": "string" }, "first_user_id": { "type": "integer" }, "id": { "type": "integer" }, "second_user_id": { "type": "integer" } } }, "domain.ChatMessage": { "type": "object", "properties": { "chat_id": { "type": "integer" }, "created_at": { "type": "string" }, "id": { "type": "integer" }, "sender_id": { "type": "integer" }, "text": { "type": "string" } } }, "domain.ChatRequest": { "type": "object", "properties": { "chat_id": { "type": "integer" }, "created_at": { "type": "string" }, "id": { "type": "integer" }, "receiver_id": { "type": "integer" }, "sender_id": { "type": "integer" }, "status": { "type": "string" }, "updated_at": { "type": "string" } } }, "domain.Comment": { "type": "object", "properties": { "created_at": { "type": "string" }, "id": { "type": "integer" }, "status": { "type": "string" }, "text": { "type": "string" }, "updated_at": { "type": "string" }, "user_id": { "type": "integer" }, "video_id": { "type": "integer" } } }, "domain.Donation": { "type": "object", "properties": { "amount": { "type": "number" }, "created_at": { "type": "string" }, "id": { "type": "integer" }, "message": { "type": "string" }, "receiver_id": { "type": "integer" }, "sender_id": { "type": "integer" }, "video_id": { "type": "integer" } } }, "domain.Playlist": { "type": "object", "properties": { "created_at": { "type": "string" }, "description": { "type": "string" }, "id": { "type": "integer" }, "name": { "type": "string" }, "updated_at": { "type": "string" }, "user_id": { "type": "integer" }, "videos": { "type": "array", "items": { "$ref": "#/definitions/domain.Video" } } } }, "domain.User": { "type": "object", "properties": { "avatar_url": { "type": "string" }, "created_at": { "type": "string" }, "description": { "type": "string" }, "email": { "type": "string" }, "id": { "type": "integer" }, "role": { "type": "string" }, "updated_at": { "type": "string" }, "username": { "type": "string" } } }, "domain.UserProfile": { "type": "object", "properties": { "avatar_url": { "type": "string" }, "created_at": { "type": "string" }, "description": { "type": "string" }, "email": { "type": "string" }, "id": { "type": "integer" }, "role": { "type": "string" }, "subcribers": { "type": "array", "items": { "$ref": "#/definitions/domain.User" } }, "subscribers_count": { "type": "integer" }, "subscriptions": { "type": "array", "items": { "$ref": "#/definitions/domain.User" } }, "subscriptions_count": { "type": "integer" }, "updated_at": { "type": "string" }, "username": { "type": "string" }, "videos": { "type": "array", "items": { "$ref": "#/definitions/domain.Video" } } } }, "domain.Video": { "type": "object", "properties": { "author_id": { "type": "integer" }, "category_id": { "type": "integer" }, "category_name": { "type": "string" }, "created_at": { "type": "string" }, "description": { "type": "string" }, "id": { "type": "integer" }, "qualities": { "type": "array", "items": { "$ref": "#/definitions/domain.VideoQuality" } }, "status": { "type": "string" }, "thumbnail_url": { "type": "string" }, "title": { "type": "string" }, "updated_at": { "type": "string" }, "video_url": { "type": "string" }, "views": { "type": "integer" } } }, "domain.VideoQuality": { "type": "object", "properties": { "created_at": { "type": "string" }, "id": { "type": "integer" }, "quality": { "type": "string" }, "video_id": { "type": "integer" }, "video_url": { "type": "string" } } }, "dto.AddVideoToPlaylistRequest": { "type": "object", "properties": { "video_id": { "type": "integer" } } }, "dto.CreateCategoryRequest": { "type": "object", "properties": { "description": { "type": "string" }, "name": { "type": "string" } } }, "dto.CreateChatMessageRequest": { "type": "object", "properties": { "content": { "type": "string" }, "text": { "type": "string" } } }, "dto.CreateChatRequest": { "type": "object", "properties": { "user_id": { "type": "integer" } } }, "dto.CreateCommentRequest": { "type": "object", "properties": { "content": { "type": "string" }, "text": { "type": "string" } } }, "dto.CreateDonationRequest": { "type": "object", "properties": { "amount": { "type": "number" }, "message": { "type": "string" }, "receiver_id": { "type": "integer" }, "recipient_id": { "type": "integer" }, "video_id": { "type": "integer" } } }, "dto.CreatePlaylistRequest": { "type": "object", "properties": { "description": { "type": "string" }, "name": { "type": "string" } } }, "dto.SignInRequest": { "type": "object", "properties": { "password": { "type": "string" }, "username": { "type": "string" } } }, "dto.SignUpRequest": { "type": "object", "properties": { "email": { "type": "string" }, "password": { "type": "string" }, "username": { "type": "string" } } }, "dto.TokenPairResponse": { "type": "object", "properties": { "access_token": { "type": "string" }, "refresh_token": { "type": "string" } } }, "dto.UpdateCategoryRequest": { "type": "object", "properties": { "description": { "type": "string" }, "name": { "type": "string" } } }, "dto.UpdateCommentRequest": { "type": "object", "properties": { "content": { "type": "string" }, "text": { "type": "string" } } }, "dto.UpdatePlaylistRequest": { "type": "object", "properties": { "description": { "type": "string" }, "name": { "type": "string" } } }, "httpdelivery.CommonError": { "type": "object", "properties": { "error": { "type": "string" } } }, "httpdelivery.CommonResponse": { "type": "object", "properties": { "message": { "type": "string" } } } }, "securityDefinitions": { "BearerAuth": { "type": "apiKey", "name": "Authorization", "in": "header" } } }