This commit is contained in:
2026-04-06 22:57:57 +02:00
commit 54c681ef31
18 changed files with 1775 additions and 0 deletions

252
docs/docs.go Normal file
View File

@@ -0,0 +1,252 @@
// 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}}",
"termsOfService": "TODO",
"contact": {
"name": "TODO",
"url": "TODO",
"email": "TODO"
},
"license": {
"name": "TODO",
"url": "TODO"
},
"version": "{{.Version}}"
},
"host": "{{.Host}}",
"basePath": "{{.BasePath}}",
"paths": {
"/user/login": {
"post": {
"description": "Login user",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"user"
],
"summary": "Login user",
"parameters": [
{
"description": "user data",
"name": "user",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/controllers.LoginRequest"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/controllers.EmptyResponse"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/httputil.HTTPError"
}
},
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/httputil.HTTPError"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/httputil.HTTPError"
}
}
}
}
},
"/user/register/{token}": {
"post": {
"description": "register user with invite token",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"user"
],
"summary": "Register user with invite token",
"parameters": [
{
"type": "string",
"description": "invite token",
"name": "token",
"in": "path"
},
{
"description": "user data",
"name": "user",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/controllers.RegisterRequest"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/controllers.EmptyResponse"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/httputil.HTTPError"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/httputil.HTTPError"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/httputil.HTTPError"
}
}
}
}
},
"/user/status": {
"get": {
"description": "Get user status of current session",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"user"
],
"summary": "User Status",
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/controllers.EmptyResponse"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/httputil.HTTPError"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/httputil.HTTPError"
}
}
}
}
}
},
"definitions": {
"controllers.EmptyResponse": {
"type": "object"
},
"controllers.LoginRequest": {
"type": "object",
"required": [
"email",
"password"
],
"properties": {
"email": {
"type": "string"
},
"password": {
"type": "string"
}
}
},
"controllers.RegisterRequest": {
"type": "object",
"required": [
"email",
"name",
"password"
],
"properties": {
"email": {
"type": "string"
},
"name": {
"type": "string"
},
"password": {
"type": "string"
}
}
},
"httputil.HTTPError": {
"type": "object",
"properties": {
"code": {
"type": "integer",
"example": 400
},
"message": {
"type": "string",
"example": "status bad request"
}
}
}
},
"securityDefinitions": {
"BasicAuth": {
"type": "basic"
}
},
"externalDocs": {
"description": "OpenAPI",
"url": "https://swagger.io/resources/open-api/"
}
}`
// SwaggerInfo holds exported Swagger Info so clients can modify it
var SwaggerInfo = &swag.Spec{
Version: "0.1",
Host: "localhost:8080",
BasePath: "/api/v0",
Schemes: []string{},
Title: "Harakat Rest-API",
Description: "This is harakat backend server.",
InfoInstanceName: "swagger",
SwaggerTemplate: docTemplate,
LeftDelim: "{{",
RightDelim: "}}",
}
func init() {
swag.Register(SwaggerInfo.InstanceName(), SwaggerInfo)
}

228
docs/swagger.json Normal file
View File

@@ -0,0 +1,228 @@
{
"swagger": "2.0",
"info": {
"description": "This is harakat backend server.",
"title": "Harakat Rest-API",
"termsOfService": "TODO",
"contact": {
"name": "TODO",
"url": "TODO",
"email": "TODO"
},
"license": {
"name": "TODO",
"url": "TODO"
},
"version": "0.1"
},
"host": "localhost:8080",
"basePath": "/api/v0",
"paths": {
"/user/login": {
"post": {
"description": "Login user",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"user"
],
"summary": "Login user",
"parameters": [
{
"description": "user data",
"name": "user",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/controllers.LoginRequest"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/controllers.EmptyResponse"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/httputil.HTTPError"
}
},
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/httputil.HTTPError"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/httputil.HTTPError"
}
}
}
}
},
"/user/register/{token}": {
"post": {
"description": "register user with invite token",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"user"
],
"summary": "Register user with invite token",
"parameters": [
{
"type": "string",
"description": "invite token",
"name": "token",
"in": "path"
},
{
"description": "user data",
"name": "user",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/controllers.RegisterRequest"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/controllers.EmptyResponse"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/httputil.HTTPError"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/httputil.HTTPError"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/httputil.HTTPError"
}
}
}
}
},
"/user/status": {
"get": {
"description": "Get user status of current session",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"user"
],
"summary": "User Status",
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/controllers.EmptyResponse"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/httputil.HTTPError"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/httputil.HTTPError"
}
}
}
}
}
},
"definitions": {
"controllers.EmptyResponse": {
"type": "object"
},
"controllers.LoginRequest": {
"type": "object",
"required": [
"email",
"password"
],
"properties": {
"email": {
"type": "string"
},
"password": {
"type": "string"
}
}
},
"controllers.RegisterRequest": {
"type": "object",
"required": [
"email",
"name",
"password"
],
"properties": {
"email": {
"type": "string"
},
"name": {
"type": "string"
},
"password": {
"type": "string"
}
}
},
"httputil.HTTPError": {
"type": "object",
"properties": {
"code": {
"type": "integer",
"example": 400
},
"message": {
"type": "string",
"example": "status bad request"
}
}
}
},
"securityDefinitions": {
"BasicAuth": {
"type": "basic"
}
},
"externalDocs": {
"description": "OpenAPI",
"url": "https://swagger.io/resources/open-api/"
}
}

152
docs/swagger.yaml Normal file
View File

@@ -0,0 +1,152 @@
basePath: /api/v0
definitions:
controllers.EmptyResponse:
type: object
controllers.LoginRequest:
properties:
email:
type: string
password:
type: string
required:
- email
- password
type: object
controllers.RegisterRequest:
properties:
email:
type: string
name:
type: string
password:
type: string
required:
- email
- name
- password
type: object
httputil.HTTPError:
properties:
code:
example: 400
type: integer
message:
example: status bad request
type: string
type: object
externalDocs:
description: OpenAPI
url: https://swagger.io/resources/open-api/
host: localhost:8080
info:
contact:
email: TODO
name: TODO
url: TODO
description: This is harakat backend server.
license:
name: TODO
url: TODO
termsOfService: TODO
title: Harakat Rest-API
version: "0.1"
paths:
/user/login:
post:
consumes:
- application/json
description: Login user
parameters:
- description: user data
in: body
name: user
required: true
schema:
$ref: '#/definitions/controllers.LoginRequest'
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/controllers.EmptyResponse'
"400":
description: Bad Request
schema:
$ref: '#/definitions/httputil.HTTPError'
"401":
description: Unauthorized
schema:
$ref: '#/definitions/httputil.HTTPError'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/httputil.HTTPError'
summary: Login user
tags:
- user
/user/register/{token}:
post:
consumes:
- application/json
description: register user with invite token
parameters:
- description: invite token
in: path
name: token
type: string
- description: user data
in: body
name: user
required: true
schema:
$ref: '#/definitions/controllers.RegisterRequest'
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/controllers.EmptyResponse'
"400":
description: Bad Request
schema:
$ref: '#/definitions/httputil.HTTPError'
"404":
description: Not Found
schema:
$ref: '#/definitions/httputil.HTTPError'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/httputil.HTTPError'
summary: Register user with invite token
tags:
- user
/user/status:
get:
consumes:
- application/json
description: Get user status of current session
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/controllers.EmptyResponse'
"400":
description: Bad Request
schema:
$ref: '#/definitions/httputil.HTTPError'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/httputil.HTTPError'
summary: User Status
tags:
- user
securityDefinitions:
BasicAuth:
type: basic
swagger: "2.0"