Update template go
This commit is contained in:
@@ -49,6 +49,86 @@ definitions:
|
||||
version:
|
||||
type: string
|
||||
type: object
|
||||
models.LoginRequest:
|
||||
properties:
|
||||
password:
|
||||
type: string
|
||||
username:
|
||||
type: string
|
||||
required:
|
||||
- password
|
||||
- username
|
||||
type: object
|
||||
models.ProductCreateRequest:
|
||||
properties:
|
||||
name:
|
||||
type: string
|
||||
required:
|
||||
- name
|
||||
type: object
|
||||
models.ProductCreateResponse:
|
||||
properties:
|
||||
data: {}
|
||||
id:
|
||||
type: string
|
||||
message:
|
||||
type: string
|
||||
type: object
|
||||
models.ProductDeleteResponse:
|
||||
properties:
|
||||
id:
|
||||
type: string
|
||||
message:
|
||||
type: string
|
||||
type: object
|
||||
models.ProductGetByIDResponse:
|
||||
properties:
|
||||
id:
|
||||
type: string
|
||||
message:
|
||||
type: string
|
||||
type: object
|
||||
models.ProductGetResponse:
|
||||
properties:
|
||||
data: {}
|
||||
message:
|
||||
type: string
|
||||
type: object
|
||||
models.ProductUpdateRequest:
|
||||
properties:
|
||||
name:
|
||||
type: string
|
||||
required:
|
||||
- name
|
||||
type: object
|
||||
models.ProductUpdateResponse:
|
||||
properties:
|
||||
data: {}
|
||||
id:
|
||||
type: string
|
||||
message:
|
||||
type: string
|
||||
type: object
|
||||
models.TokenResponse:
|
||||
properties:
|
||||
access_token:
|
||||
type: string
|
||||
expires_in:
|
||||
type: integer
|
||||
token_type:
|
||||
type: string
|
||||
type: object
|
||||
models.User:
|
||||
properties:
|
||||
email:
|
||||
type: string
|
||||
id:
|
||||
type: string
|
||||
role:
|
||||
type: string
|
||||
username:
|
||||
type: string
|
||||
type: object
|
||||
host: localhost:8080
|
||||
info:
|
||||
contact:
|
||||
@@ -78,6 +158,129 @@ paths:
|
||||
summary: Hello World endpoint
|
||||
tags:
|
||||
- root
|
||||
/api/v1/auth/login:
|
||||
post:
|
||||
consumes:
|
||||
- application/json
|
||||
description: Authenticate user with username and password to receive JWT token
|
||||
parameters:
|
||||
- description: Login credentials
|
||||
in: body
|
||||
name: login
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/models.LoginRequest'
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
$ref: '#/definitions/models.TokenResponse'
|
||||
"400":
|
||||
description: Bad request
|
||||
schema:
|
||||
additionalProperties:
|
||||
type: string
|
||||
type: object
|
||||
"401":
|
||||
description: Unauthorized
|
||||
schema:
|
||||
additionalProperties:
|
||||
type: string
|
||||
type: object
|
||||
summary: Login user and get JWT token
|
||||
tags:
|
||||
- Authentication
|
||||
/api/v1/auth/me:
|
||||
get:
|
||||
description: Get information about the currently authenticated user
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
$ref: '#/definitions/models.User'
|
||||
"401":
|
||||
description: Unauthorized
|
||||
schema:
|
||||
additionalProperties:
|
||||
type: string
|
||||
type: object
|
||||
security:
|
||||
- Bearer: []
|
||||
summary: Get current user info
|
||||
tags:
|
||||
- Authentication
|
||||
/api/v1/auth/refresh:
|
||||
post:
|
||||
consumes:
|
||||
- application/json
|
||||
description: Refresh the JWT token using a valid refresh token
|
||||
parameters:
|
||||
- description: Refresh token
|
||||
in: body
|
||||
name: refresh
|
||||
required: true
|
||||
schema:
|
||||
additionalProperties:
|
||||
type: string
|
||||
type: object
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
$ref: '#/definitions/models.TokenResponse'
|
||||
"400":
|
||||
description: Bad request
|
||||
schema:
|
||||
additionalProperties:
|
||||
type: string
|
||||
type: object
|
||||
"401":
|
||||
description: Unauthorized
|
||||
schema:
|
||||
additionalProperties:
|
||||
type: string
|
||||
type: object
|
||||
summary: Refresh JWT token
|
||||
tags:
|
||||
- Authentication
|
||||
/api/v1/auth/register:
|
||||
post:
|
||||
consumes:
|
||||
- application/json
|
||||
description: Register a new user account
|
||||
parameters:
|
||||
- description: Registration data
|
||||
in: body
|
||||
name: register
|
||||
required: true
|
||||
schema:
|
||||
additionalProperties:
|
||||
type: string
|
||||
type: object
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"201":
|
||||
description: Created
|
||||
schema:
|
||||
additionalProperties:
|
||||
type: string
|
||||
type: object
|
||||
"400":
|
||||
description: Bad request
|
||||
schema:
|
||||
additionalProperties:
|
||||
type: string
|
||||
type: object
|
||||
summary: Register new user
|
||||
tags:
|
||||
- Authentication
|
||||
/api/v1/example:
|
||||
get:
|
||||
consumes:
|
||||
@@ -118,6 +321,194 @@ paths:
|
||||
summary: Example POST service
|
||||
tags:
|
||||
- example
|
||||
/api/v1/products:
|
||||
get:
|
||||
consumes:
|
||||
- application/json
|
||||
description: Returns a list of products
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: Product GET response
|
||||
schema:
|
||||
$ref: '#/definitions/models.ProductGetResponse'
|
||||
summary: Get product
|
||||
tags:
|
||||
- product
|
||||
post:
|
||||
consumes:
|
||||
- application/json
|
||||
description: Creates a new product
|
||||
parameters:
|
||||
- description: Product creation request
|
||||
in: body
|
||||
name: request
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/models.ProductCreateRequest'
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"201":
|
||||
description: Product created successfully
|
||||
schema:
|
||||
$ref: '#/definitions/models.ProductCreateResponse'
|
||||
"400":
|
||||
description: Bad request
|
||||
schema:
|
||||
$ref: '#/definitions/models.ErrorResponse'
|
||||
summary: Create product
|
||||
tags:
|
||||
- product
|
||||
/api/v1/products/{id}:
|
||||
delete:
|
||||
consumes:
|
||||
- application/json
|
||||
description: Deletes a product by ID
|
||||
parameters:
|
||||
- description: Product ID
|
||||
in: path
|
||||
name: id
|
||||
required: true
|
||||
type: string
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: Product deleted successfully
|
||||
schema:
|
||||
$ref: '#/definitions/models.ProductDeleteResponse'
|
||||
"404":
|
||||
description: Product not found
|
||||
schema:
|
||||
$ref: '#/definitions/models.ErrorResponse'
|
||||
summary: Delete product
|
||||
tags:
|
||||
- product
|
||||
get:
|
||||
consumes:
|
||||
- application/json
|
||||
description: Returns a single product by ID
|
||||
parameters:
|
||||
- description: Product ID
|
||||
in: path
|
||||
name: id
|
||||
required: true
|
||||
type: string
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: Product GET by ID response
|
||||
schema:
|
||||
$ref: '#/definitions/models.ProductGetByIDResponse'
|
||||
"404":
|
||||
description: Product not found
|
||||
schema:
|
||||
$ref: '#/definitions/models.ErrorResponse'
|
||||
summary: Get product by ID
|
||||
tags:
|
||||
- product
|
||||
put:
|
||||
consumes:
|
||||
- application/json
|
||||
description: Updates an existing product
|
||||
parameters:
|
||||
- description: Product ID
|
||||
in: path
|
||||
name: id
|
||||
required: true
|
||||
type: string
|
||||
- description: Product update request
|
||||
in: body
|
||||
name: request
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/models.ProductUpdateRequest'
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: Product updated successfully
|
||||
schema:
|
||||
$ref: '#/definitions/models.ProductUpdateResponse'
|
||||
"400":
|
||||
description: Bad request
|
||||
schema:
|
||||
$ref: '#/definitions/models.ErrorResponse'
|
||||
"404":
|
||||
description: Product not found
|
||||
schema:
|
||||
$ref: '#/definitions/models.ErrorResponse'
|
||||
summary: Update product
|
||||
tags:
|
||||
- product
|
||||
/api/v1/token/generate:
|
||||
post:
|
||||
consumes:
|
||||
- application/json
|
||||
description: Generate a JWT token for a user
|
||||
parameters:
|
||||
- description: User credentials
|
||||
in: body
|
||||
name: token
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/models.LoginRequest'
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
$ref: '#/definitions/models.TokenResponse'
|
||||
"400":
|
||||
description: Bad request
|
||||
schema:
|
||||
additionalProperties:
|
||||
type: string
|
||||
type: object
|
||||
"401":
|
||||
description: Unauthorized
|
||||
schema:
|
||||
additionalProperties:
|
||||
type: string
|
||||
type: object
|
||||
summary: Generate JWT token
|
||||
tags:
|
||||
- Token
|
||||
/api/v1/token/generate-direct:
|
||||
post:
|
||||
consumes:
|
||||
- application/json
|
||||
description: Generate a JWT token directly without password verification (for
|
||||
testing)
|
||||
parameters:
|
||||
- description: User info
|
||||
in: body
|
||||
name: user
|
||||
required: true
|
||||
schema:
|
||||
additionalProperties:
|
||||
type: string
|
||||
type: object
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
$ref: '#/definitions/models.TokenResponse'
|
||||
"400":
|
||||
description: Bad request
|
||||
schema:
|
||||
additionalProperties:
|
||||
type: string
|
||||
type: object
|
||||
summary: Generate token directly
|
||||
tags:
|
||||
- Token
|
||||
/health:
|
||||
get:
|
||||
consumes:
|
||||
|
||||
Reference in New Issue
Block a user