This commit is contained in:
nquidox 2026-01-03 15:25:31 +03:00
commit 73b524d203
18 changed files with 1279 additions and 0 deletions

196
docs/docs.go Normal file
View file

@ -0,0 +1,196 @@
// Package docs Code generated by swaggo/swag. DO NOT EDIT
package docs
import "github.com/swaggo/swag"
const docTemplate = `{
"schemes": {{ marshal .Schemes }},
"swagger": "2.0",
"info": {
"description": "{{escape .Description}}",
"title": "{{.Title}}",
"contact": {},
"version": "{{.Version}}"
},
"host": "{{.Host}}",
"basePath": "{{.BasePath}}",
"paths": {
"/auth/login": {
"post": {
"description": "Логин. Принимает пару юзернейм+пароль.",
"consumes": [
"application/json"
],
"tags": [
"Auth"
],
"summary": "Логин",
"parameters": [
{
"description": "логин",
"name": "login",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/auth.loginDTO"
}
}
],
"responses": {
"200": {
"description": "OK"
},
"400": {
"description": "Bad Request"
},
"500": {
"description": "Internal Server Error"
}
}
}
},
"/auth/logout": {
"post": {
"security": [
{
"ApiKeyAuth": []
}
],
"description": "Логаут. Принимает токен авторизации в заголовке \"Authorization\"",
"tags": [
"Auth"
],
"summary": "Логаут",
"responses": {
"200": {
"description": "OK"
},
"400": {
"description": "Bad Request"
},
"500": {
"description": "Internal Server Error"
}
}
}
},
"/auth/me": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
"description": "Информация о пользователе. Выдается по токену сессии. Без поля пароль.",
"tags": [
"Auth"
],
"summary": "Информация о пользователе",
"responses": {
"200": {
"description": "OK"
},
"400": {
"description": "Bad Request"
},
"500": {
"description": "Internal Server Error"
}
}
}
},
"/auth/register": {
"post": {
"description": "Регистрация",
"consumes": [
"application/json"
],
"tags": [
"Auth"
],
"summary": "Регистрация",
"parameters": [
{
"description": "Регистрация",
"name": "register",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/auth.user"
}
}
],
"responses": {
"200": {
"description": "OK"
},
"400": {
"description": "Bad Request"
},
"500": {
"description": "Internal Server Error"
}
}
}
}
},
"definitions": {
"auth.loginDTO": {
"type": "object",
"properties": {
"login": {
"type": "string"
},
"password": {
"type": "string"
}
}
},
"auth.user": {
"type": "object",
"properties": {
"email": {
"type": "string"
},
"name": {
"type": "string"
},
"password": {
"type": "string"
},
"surname": {
"type": "string"
},
"username": {
"type": "string"
}
}
}
},
"securityDefinitions": {
"ApiKeyAuth": {
"description": "Введите \"token\" для аутентификации",
"type": "apiKey",
"name": "Authorization",
"in": "header"
}
}
}`
// SwaggerInfo holds exported Swagger Info so clients can modify it
var SwaggerInfo = &swag.Spec{
Version: "1.0.0",
Host: "",
BasePath: "/api",
Schemes: []string{},
Title: "Mobile Example API",
Description: "",
InfoInstanceName: "swagger",
SwaggerTemplate: docTemplate,
LeftDelim: "{{",
RightDelim: "}}",
}
func init() {
swag.Register(SwaggerInfo.InstanceName(), SwaggerInfo)
}

170
docs/swagger.json Normal file
View file

@ -0,0 +1,170 @@
{
"swagger": "2.0",
"info": {
"title": "Mobile Example API",
"contact": {},
"version": "1.0.0"
},
"basePath": "/api",
"paths": {
"/auth/login": {
"post": {
"description": "Логин. Принимает пару юзернейм+пароль.",
"consumes": [
"application/json"
],
"tags": [
"Auth"
],
"summary": "Логин",
"parameters": [
{
"description": "логин",
"name": "login",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/auth.loginDTO"
}
}
],
"responses": {
"200": {
"description": "OK"
},
"400": {
"description": "Bad Request"
},
"500": {
"description": "Internal Server Error"
}
}
}
},
"/auth/logout": {
"post": {
"security": [
{
"ApiKeyAuth": []
}
],
"description": "Логаут. Принимает токен авторизации в заголовке \"Authorization\"",
"tags": [
"Auth"
],
"summary": "Логаут",
"responses": {
"200": {
"description": "OK"
},
"400": {
"description": "Bad Request"
},
"500": {
"description": "Internal Server Error"
}
}
}
},
"/auth/me": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
"description": "Информация о пользователе. Выдается по токену сессии. Без поля пароль.",
"tags": [
"Auth"
],
"summary": "Информация о пользователе",
"responses": {
"200": {
"description": "OK"
},
"400": {
"description": "Bad Request"
},
"500": {
"description": "Internal Server Error"
}
}
}
},
"/auth/register": {
"post": {
"description": "Регистрация",
"consumes": [
"application/json"
],
"tags": [
"Auth"
],
"summary": "Регистрация",
"parameters": [
{
"description": "Регистрация",
"name": "register",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/auth.user"
}
}
],
"responses": {
"200": {
"description": "OK"
},
"400": {
"description": "Bad Request"
},
"500": {
"description": "Internal Server Error"
}
}
}
}
},
"definitions": {
"auth.loginDTO": {
"type": "object",
"properties": {
"login": {
"type": "string"
},
"password": {
"type": "string"
}
}
},
"auth.user": {
"type": "object",
"properties": {
"email": {
"type": "string"
},
"name": {
"type": "string"
},
"password": {
"type": "string"
},
"surname": {
"type": "string"
},
"username": {
"type": "string"
}
}
}
},
"securityDefinitions": {
"ApiKeyAuth": {
"description": "Введите \"token\" для аутентификации",
"type": "apiKey",
"name": "Authorization",
"in": "header"
}
}
}

109
docs/swagger.yaml Normal file
View file

@ -0,0 +1,109 @@
basePath: /api
definitions:
auth.loginDTO:
properties:
login:
type: string
password:
type: string
type: object
auth.user:
properties:
email:
type: string
name:
type: string
password:
type: string
surname:
type: string
username:
type: string
type: object
info:
contact: {}
title: Mobile Example API
version: 1.0.0
paths:
/auth/login:
post:
consumes:
- application/json
description: Логин. Принимает пару юзернейм+пароль.
parameters:
- description: логин
in: body
name: login
required: true
schema:
$ref: '#/definitions/auth.loginDTO'
responses:
"200":
description: OK
"400":
description: Bad Request
"500":
description: Internal Server Error
summary: Логин
tags:
- Auth
/auth/logout:
post:
description: Логаут. Принимает токен авторизации в заголовке "Authorization"
responses:
"200":
description: OK
"400":
description: Bad Request
"500":
description: Internal Server Error
security:
- ApiKeyAuth: []
summary: Логаут
tags:
- Auth
/auth/me:
get:
description: Информация о пользователе. Выдается по токену сессии. Без поля
пароль.
responses:
"200":
description: OK
"400":
description: Bad Request
"500":
description: Internal Server Error
security:
- ApiKeyAuth: []
summary: Информация о пользователе
tags:
- Auth
/auth/register:
post:
consumes:
- application/json
description: Регистрация
parameters:
- description: Регистрация
in: body
name: register
required: true
schema:
$ref: '#/definitions/auth.user'
responses:
"200":
description: OK
"400":
description: Bad Request
"500":
description: Internal Server Error
summary: Регистрация
tags:
- Auth
securityDefinitions:
ApiKeyAuth:
description: Введите "token" для аутентификации
in: header
name: Authorization
type: apiKey
swagger: "2.0"