update account.go, docs.go, service.go, swagger.json, swagger.yaml

This commit is contained in:
redtea committed 2024-10-23 12:00:00 +03:00
1 parent 47ea2eacd0
commit be5630cbd9
5 files changed
+1434

No files matched your search

+527
View File
@@ -0,0 +1,527 @@
// 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": {
"name": "API Support",
"email": "red.tea.dev@gmail.com"
},
"version": "{{.Version}}"
},
"host": "{{.Host}}",
"basePath": "{{.BasePath}}",
"paths": {
"/api/account": {
"get": {
"produces": [
"application/json"
],
"tags": [
"account"
],
"summary": "Get account information",
"parameters": [
{
"type": "string",
"description": "JWT Bearer token (authorization)",
"name": "Authorization",
"in": "header",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/handler.accountResponce"
}
}
}
},
"post": {
"produces": [
"application/json"
],
"tags": [
"account"
],
"summary": "Set account information",
"parameters": [
{
"type": "string",
"description": "JWT Bearer token (authorization)",
"name": "Authorization",
"in": "header",
"required": true
},
{
"description": "account info",
"name": "account",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/handler.accountInput"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/handler.accountInput"
}
}
}
}
},
"/api/account/:id": {
"get": {
"produces": [
"application/json"
],
"tags": [
"account"
],
"summary": "Get account information by id",
"parameters": [
{
"type": "string",
"description": "JWT Bearer token (authorization)",
"name": "Authorization",
"in": "header",
"required": true
},
{
"type": "integer",
"description": "account id",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/handler.accountResponce"
}
}
}
}
},
"/api/account/picture": {
"post": {
"produces": [
"application/json"
],
"tags": [
"account"
],
"summary": "Get account information",
"parameters": [
{
"type": "string",
"description": "JWT Bearer token (authorization)",
"name": "Authorization",
"in": "header",
"required": true
},
{
"type": "file",
"description": "Picture",
"name": "file",
"in": "formData",
"required": true
}
],
"responses": {
"200": {
"description": "OK"
}
}
}
},
"/api/account/{id}": {
"post": {
"produces": [
"application/json"
],
"tags": [
"account"
],
"summary": "Set account information by id",
"parameters": [
{
"type": "string",
"description": "JWT Bearer token (authorization)",
"name": "Authorization",
"in": "header",
"required": true
},
{
"description": "account info",
"name": "account",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/handler.accountResponce"
}
},
{
"type": "integer",
"description": "account id",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/handler.accountResponce"
}
}
}
},
"delete": {
"produces": [
"application/json"
],
"tags": [
"account"
],
"summary": "Delete account by id",
"parameters": [
{
"type": "integer",
"description": "id of user",
"name": "id",
"in": "path",
"required": true
},
{
"type": "string",
"description": "JWT Bearer token (authorization)",
"name": "Authorization",
"in": "header",
"required": true
}
],
"responses": {
"200": {
"description": "OK"
}
}
}
},
"/api/confidential/": {
"get": {
"produces": [
"application/json"
],
"tags": [
"confidential"
],
"summary": "Get all confidential settings",
"parameters": [
{
"type": "string",
"description": "JWT Bearer token (authorization)",
"name": "Authorization",
"in": "header",
"required": true
}
],
"responses": {
"200": {
"description": "OK"
}
}
},
"post": {
"produces": [
"application/json"
],
"tags": [
"confidential"
],
"summary": "Set confidential settings",
"parameters": [
{
"type": "string",
"description": "JWT Bearer token (authorization)",
"name": "Authorization",
"in": "header",
"required": true
},
{
"description": "Confidencial settings",
"name": "confidencial",
"in": "body",
"required": true,
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/esaccount.AuthorizedUser"
}
}
}
}
},
"/api/confidential/{id}": {
"get": {
"produces": [
"application/json"
],
"tags": [
"confidential"
],
"summary": "Get all confidential settings by id",
"parameters": [
{
"type": "integer",
"description": "id of user",
"name": "id",
"in": "path",
"required": true
},
{
"type": "string",
"description": "JWT Bearer token (authorization)",
"name": "Authorization",
"in": "header",
"required": true
}
],
"responses": {
"200": {
"description": "OK"
}
}
},
"post": {
"produces": [
"application/json"
],
"tags": [
"confidential"
],
"summary": "Set confidential settings by id",
"parameters": [
{
"type": "integer",
"description": "id of user",
"name": "id",
"in": "path",
"required": true
},
{
"type": "string",
"description": "JWT Bearer token (authorization)",
"name": "Authorization",
"in": "header",
"required": true
},
{
"description": "Confidencial settings",
"name": "confidencial",
"in": "body",
"required": true,
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/esaccount.AuthorizedUser"
}
}
}
}
},
"/api/following/follow/{id}": {
"put": {
"produces": [
"application/json"
],
"tags": [
"following"
],
"summary": "Follow to user",
"parameters": [
{
"type": "string",
"description": "JWT Bearer token (authorization)",
"name": "Authorization",
"in": "header",
"required": true
}
],
"responses": {
"200": {
"description": "OK"
}
}
}
},
"/api/following/unfollow/{id}": {
"put": {
"produces": [
"application/json"
],
"tags": [
"following"
],
"summary": "Unfollow user",
"parameters": [
{
"type": "string",
"description": "JWT Bearer token (authorization)",
"name": "Authorization",
"in": "header",
"required": true
}
],
"responses": {
"200": {
"description": "OK"
}
}
}
},
"/api/public/{id}": {
"get": {
"produces": [
"application/json"
],
"tags": [
"confidential"
],
"summary": "Get all public data of users",
"parameters": [
{
"type": "string",
"description": "JWT Bearer token (authorization)",
"name": "Authorization",
"in": "header"
},
{
"type": "integer",
"description": "user id",
"name": "id",
"in": "query",
"required": true
}
],
"responses": {
"200": {
"description": "OK"
}
}
}
}
},
"definitions": {
"esaccount.AuthorizedUser": {
"type": "object",
"properties": {
"access": {
"type": "string"
},
"email": {
"type": "string"
},
"first_name": {
"type": "string"
},
"google_id": {
"type": "string"
},
"id": {
"type": "integer"
},
"last_name": {
"type": "string"
},
"picture_url": {
"type": "string"
},
"telegram_id": {
"type": "string"
},
"username": {
"type": "string"
}
}
},
"handler.accountInput": {
"type": "object",
"properties": {
"date_of_birth": {
"type": "string"
},
"description": {
"type": "string"
}
}
},
"handler.accountResponce": {
"type": "object",
"properties": {
"date_of_birth": {
"type": "string"
},
"description": {
"type": "string"
},
"followers": {
"type": "array",
"items": {
"type": "integer"
}
},
"follows": {
"type": "array",
"items": {
"type": "integer"
}
}
}
}
}
}`
// SwaggerInfo holds exported Swagger Info so clients can modify it
var SwaggerInfo = &swag.Spec{
Version: "1.0",
Host: "account.easystartup.su",
BasePath: "/api",
Schemes: []string{},
Title: "EasyStartup Account",
Description: "Account service for EasyStartup.",
InfoInstanceName: "swagger",
SwaggerTemplate: docTemplate,
LeftDelim: "{{",
RightDelim: "}}",
}
func init() {
swag.Register(SwaggerInfo.InstanceName(), SwaggerInfo)
}
+503
View File
@@ -0,0 +1,503 @@
{
"swagger": "2.0",
"info": {
"description": "Account service for EasyStartup.",
"title": "EasyStartup Account",
"contact": {
"name": "API Support",
"email": "red.tea.dev@gmail.com"
},
"version": "1.0"
},
"host": "account.easystartup.su",
"basePath": "/api",
"paths": {
"/api/account": {
"get": {
"produces": [
"application/json"
],
"tags": [
"account"
],
"summary": "Get account information",
"parameters": [
{
"type": "string",
"description": "JWT Bearer token (authorization)",
"name": "Authorization",
"in": "header",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/handler.accountResponce"
}
}
}
},
"post": {
"produces": [
"application/json"
],
"tags": [
"account"
],
"summary": "Set account information",
"parameters": [
{
"type": "string",
"description": "JWT Bearer token (authorization)",
"name": "Authorization",
"in": "header",
"required": true
},
{
"description": "account info",
"name": "account",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/handler.accountInput"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/handler.accountInput"
}
}
}
}
},
"/api/account/:id": {
"get": {
"produces": [
"application/json"
],
"tags": [
"account"
],
"summary": "Get account information by id",
"parameters": [
{
"type": "string",
"description": "JWT Bearer token (authorization)",
"name": "Authorization",
"in": "header",
"required": true
},
{
"type": "integer",
"description": "account id",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/handler.accountResponce"
}
}
}
}
},
"/api/account/picture": {
"post": {
"produces": [
"application/json"
],
"tags": [
"account"
],
"summary": "Get account information",
"parameters": [
{
"type": "string",
"description": "JWT Bearer token (authorization)",
"name": "Authorization",
"in": "header",
"required": true
},
{
"type": "file",
"description": "Picture",
"name": "file",
"in": "formData",
"required": true
}
],
"responses": {
"200": {
"description": "OK"
}
}
}
},
"/api/account/{id}": {
"post": {
"produces": [
"application/json"
],
"tags": [
"account"
],
"summary": "Set account information by id",
"parameters": [
{
"type": "string",
"description": "JWT Bearer token (authorization)",
"name": "Authorization",
"in": "header",
"required": true
},
{
"description": "account info",
"name": "account",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/handler.accountResponce"
}
},
{
"type": "integer",
"description": "account id",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/handler.accountResponce"
}
}
}
},
"delete": {
"produces": [
"application/json"
],
"tags": [
"account"
],
"summary": "Delete account by id",
"parameters": [
{
"type": "integer",
"description": "id of user",
"name": "id",
"in": "path",
"required": true
},
{
"type": "string",
"description": "JWT Bearer token (authorization)",
"name": "Authorization",
"in": "header",
"required": true
}
],
"responses": {
"200": {
"description": "OK"
}
}
}
},
"/api/confidential/": {
"get": {
"produces": [
"application/json"
],
"tags": [
"confidential"
],
"summary": "Get all confidential settings",
"parameters": [
{
"type": "string",
"description": "JWT Bearer token (authorization)",
"name": "Authorization",
"in": "header",
"required": true
}
],
"responses": {
"200": {
"description": "OK"
}
}
},
"post": {
"produces": [
"application/json"
],
"tags": [
"confidential"
],
"summary": "Set confidential settings",
"parameters": [
{
"type": "string",
"description": "JWT Bearer token (authorization)",
"name": "Authorization",
"in": "header",
"required": true
},
{
"description": "Confidencial settings",
"name": "confidencial",
"in": "body",
"required": true,
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/esaccount.AuthorizedUser"
}
}
}
}
},
"/api/confidential/{id}": {
"get": {
"produces": [
"application/json"
],
"tags": [
"confidential"
],
"summary": "Get all confidential settings by id",
"parameters": [
{
"type": "integer",
"description": "id of user",
"name": "id",
"in": "path",
"required": true
},
{
"type": "string",
"description": "JWT Bearer token (authorization)",
"name": "Authorization",
"in": "header",
"required": true
}
],
"responses": {
"200": {
"description": "OK"
}
}
},
"post": {
"produces": [
"application/json"
],
"tags": [
"confidential"
],
"summary": "Set confidential settings by id",
"parameters": [
{
"type": "integer",
"description": "id of user",
"name": "id",
"in": "path",
"required": true
},
{
"type": "string",
"description": "JWT Bearer token (authorization)",
"name": "Authorization",
"in": "header",
"required": true
},
{
"description": "Confidencial settings",
"name": "confidencial",
"in": "body",
"required": true,
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/esaccount.AuthorizedUser"
}
}
}
}
},
"/api/following/follow/{id}": {
"put": {
"produces": [
"application/json"
],
"tags": [
"following"
],
"summary": "Follow to user",
"parameters": [
{
"type": "string",
"description": "JWT Bearer token (authorization)",
"name": "Authorization",
"in": "header",
"required": true
}
],
"responses": {
"200": {
"description": "OK"
}
}
}
},
"/api/following/unfollow/{id}": {
"put": {
"produces": [
"application/json"
],
"tags": [
"following"
],
"summary": "Unfollow user",
"parameters": [
{
"type": "string",
"description": "JWT Bearer token (authorization)",
"name": "Authorization",
"in": "header",
"required": true
}
],
"responses": {
"200": {
"description": "OK"
}
}
}
},
"/api/public/{id}": {
"get": {
"produces": [
"application/json"
],
"tags": [
"confidential"
],
"summary": "Get all public data of users",
"parameters": [
{
"type": "string",
"description": "JWT Bearer token (authorization)",
"name": "Authorization",
"in": "header"
},
{
"type": "integer",
"description": "user id",
"name": "id",
"in": "query",
"required": true
}
],
"responses": {
"200": {
"description": "OK"
}
}
}
}
},
"definitions": {
"esaccount.AuthorizedUser": {
"type": "object",
"properties": {
"access": {
"type": "string"
},
"email": {
"type": "string"
},
"first_name": {
"type": "string"
},
"google_id": {
"type": "string"
},
"id": {
"type": "integer"
},
"last_name": {
"type": "string"
},
"picture_url": {
"type": "string"
},
"telegram_id": {
"type": "string"
},
"username": {
"type": "string"
}
}
},
"handler.accountInput": {
"type": "object",
"properties": {
"date_of_birth": {
"type": "string"
},
"description": {
"type": "string"
}
}
},
"handler.accountResponce": {
"type": "object",
"properties": {
"date_of_birth": {
"type": "string"
},
"description": {
"type": "string"
},
"followers": {
"type": "array",
"items": {
"type": "integer"
}
},
"follows": {
"type": "array",
"items": {
"type": "integer"
}
}
}
}
}
}
+329
View File
@@ -0,0 +1,329 @@
basePath: /api
definitions:
esaccount.AuthorizedUser:
properties:
access:
type: string
email:
type: string
first_name:
type: string
google_id:
type: string
id:
type: integer
last_name:
type: string
picture_url:
type: string
telegram_id:
type: string
username:
type: string
type: object
handler.accountInput:
properties:
date_of_birth:
type: string
description:
type: string
type: object
handler.accountResponce:
properties:
date_of_birth:
type: string
description:
type: string
followers:
items:
type: integer
type: array
follows:
items:
type: integer
type: array
type: object
host: account.easystartup.su
info:
contact:
email: red.tea.dev@gmail.com
name: API Support
description: Account service for EasyStartup.
title: EasyStartup Account
version: "1.0"
paths:
/api/account:
get:
parameters:
- description: JWT Bearer token (authorization)
in: header
name: Authorization
required: true
type: string
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/handler.accountResponce'
summary: Get account information
tags:
- account
post:
parameters:
- description: JWT Bearer token (authorization)
in: header
name: Authorization
required: true
type: string
- description: account info
in: body
name: account
required: true
schema:
$ref: '#/definitions/handler.accountInput'
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/handler.accountInput'
summary: Set account information
tags:
- account
/api/account/:id:
get:
parameters:
- description: JWT Bearer token (authorization)
in: header
name: Authorization
required: true
type: string
- description: account id
in: path
name: id
required: true
type: integer
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/handler.accountResponce'
summary: Get account information by id
tags:
- account
/api/account/{id}:
delete:
parameters:
- description: id of user
in: path
name: id
required: true
type: integer
- description: JWT Bearer token (authorization)
in: header
name: Authorization
required: true
type: string
produces:
- application/json
responses:
"200":
description: OK
summary: Delete account by id
tags:
- account
post:
parameters:
- description: JWT Bearer token (authorization)
in: header
name: Authorization
required: true
type: string
- description: account info
in: body
name: account
required: true
schema:
$ref: '#/definitions/handler.accountResponce'
- description: account id
in: path
name: id
required: true
type: integer
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/handler.accountResponce'
summary: Set account information by id
tags:
- account
/api/account/picture:
post:
parameters:
- description: JWT Bearer token (authorization)
in: header
name: Authorization
required: true
type: string
- description: Picture
in: formData
name: file
required: true
type: file
produces:
- application/json
responses:
"200":
description: OK
summary: Get account information
tags:
- account
/api/confidential/:
get:
parameters:
- description: JWT Bearer token (authorization)
in: header
name: Authorization
required: true
type: string
produces:
- application/json
responses:
"200":
description: OK
summary: Get all confidential settings
tags:
- confidential
post:
parameters:
- description: JWT Bearer token (authorization)
in: header
name: Authorization
required: true
type: string
- description: Confidencial settings
in: body
name: confidencial
required: true
schema:
type: string
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/esaccount.AuthorizedUser'
summary: Set confidential settings
tags:
- confidential
/api/confidential/{id}:
get:
parameters:
- description: id of user
in: path
name: id
required: true
type: integer
- description: JWT Bearer token (authorization)
in: header
name: Authorization
required: true
type: string
produces:
- application/json
responses:
"200":
description: OK
summary: Get all confidential settings by id
tags:
- confidential
post:
parameters:
- description: id of user
in: path
name: id
required: true
type: integer
- description: JWT Bearer token (authorization)
in: header
name: Authorization
required: true
type: string
- description: Confidencial settings
in: body
name: confidencial
required: true
schema:
type: string
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/esaccount.AuthorizedUser'
summary: Set confidential settings by id
tags:
- confidential
/api/following/follow/{id}:
put:
parameters:
- description: JWT Bearer token (authorization)
in: header
name: Authorization
required: true
type: string
produces:
- application/json
responses:
"200":
description: OK
summary: Follow to user
tags:
- following
/api/following/unfollow/{id}:
put:
parameters:
- description: JWT Bearer token (authorization)
in: header
name: Authorization
required: true
type: string
produces:
- application/json
responses:
"200":
description: OK
summary: Unfollow user
tags:
- following
/api/public/{id}:
get:
parameters:
- description: JWT Bearer token (authorization)
in: header
name: Authorization
type: string
- description: user id
in: query
name: id
required: true
type: integer
produces:
- application/json
responses:
"200":
description: OK
summary: Get all public data of users
tags:
- confidential
swagger: "2.0"