Files
d3m0k1d.ru/backend/docs/swagger.json

310 lines
10 KiB
JSON

{
"swagger": "2.0",
"info": {
"contact": {}
},
"paths": {
"/auth/github": {
"get": {
"description": "Redirects to GitHub authorization",
"tags": [
"auth"
],
"summary": "Start GitHub OAuth login",
"responses": {
"302": {
"description": "Found"
}
}
}
},
"/callback/github": {
"get": {
"description": "Exchanges authorization code for access token",
"produces": [
"application/json"
],
"tags": [
"auth"
],
"summary": "GitHub OAuth callback",
"parameters": [
{
"type": "string",
"description": "Authorization code",
"name": "code",
"in": "query",
"required": true
}
],
"responses": {
"200": {
"description": "Access token",
"schema": {
"type": "object",
"additionalProperties": true
}
},
"400": {
"description": "Missing code",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
},
"500": {
"description": "Exchange failed",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
}
}
}
},
"/posts": {
"get": {
"description": "Get all posts",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"posts"
],
"summary": "Get all posts",
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/gitea_d3m0k1d_ru_d3m0k1d_d3m0k1d_ru_backend_internal_storage.PostReq"
}
}
}
}
},
"post": {
"description": "Create new post",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"posts"
],
"summary": "Create post",
"parameters": [
{
"description": "Post data",
"name": "post",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/gitea_d3m0k1d_ru_d3m0k1d_d3m0k1d_ru_backend_internal_storage.PostCreate"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/gitea_d3m0k1d_ru_d3m0k1d_d3m0k1d_ru_backend_internal_storage.PostReq"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/gin.H"
}
}
}
}
},
"/posts/{id}": {
"get": {
"description": "Get post by id",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"posts"
],
"summary": "Get post by id",
"parameters": [
{
"type": "integer",
"description": "Post ID",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/gitea_d3m0k1d_ru_d3m0k1d_d3m0k1d_ru_backend_internal_storage.PostReq"
}
},
"400": {
"description": "Invalid ID format",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
},
"404": {
"description": "Post not found",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
},
"500": {
"description": "Internal server error",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
}
}
},
"put": {
"description": "Update post",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"posts"
],
"summary": "Update post",
"parameters": [
{
"type": "integer",
"description": "Post ID",
"name": "id",
"in": "path",
"required": true
},
{
"description": "Post data",
"name": "post",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/gitea_d3m0k1d_ru_d3m0k1d_d3m0k1d_ru_backend_internal_storage.PostCreate"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/gitea_d3m0k1d_ru_d3m0k1d_d3m0k1d_ru_backend_internal_storage.PostCreate"
}
}
}
},
"delete": {
"description": "Delete post",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"posts"
],
"summary": "Delete post",
"parameters": [
{
"type": "integer",
"description": "Post ID",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/gitea_d3m0k1d_ru_d3m0k1d_d3m0k1d_ru_backend_internal_storage.Post"
}
}
}
}
}
},
"definitions": {
"gin.H": {
"type": "object",
"additionalProperties": {}
},
"gitea_d3m0k1d_ru_d3m0k1d_d3m0k1d_ru_backend_internal_storage.Post": {
"type": "object",
"properties": {
"content": {
"type": "string"
},
"created_at": {
"type": "string"
},
"id": {
"type": "integer"
},
"title": {
"type": "string"
}
}
},
"gitea_d3m0k1d_ru_d3m0k1d_d3m0k1d_ru_backend_internal_storage.PostCreate": {
"type": "object",
"properties": {
"content": {
"type": "string"
},
"title": {
"type": "string"
}
}
},
"gitea_d3m0k1d_ru_d3m0k1d_d3m0k1d_ru_backend_internal_storage.PostReq": {
"type": "object",
"properties": {
"content": {
"type": "string"
},
"id": {
"type": "integer"
},
"title": {
"type": "string"
}
}
}
}
}