changes...

This commit is contained in:
KamilM1205 2025-09-22 22:12:49 +04:00
parent 41944884b4
commit ab4b53fd40
26 changed files with 600 additions and 51 deletions

View file

@ -21,6 +21,20 @@ definitions:
- title
- userId
type: object
requests.CreateUserRequest:
properties:
password:
maxLength: 32
minLength: 6
type: string
username:
maxLength: 32
minLength: 3
type: string
required:
- password
- username
type: object
requests.PutPostRequest:
properties:
content:
@ -30,6 +44,20 @@ definitions:
title:
type: string
type: object
requests.PutUserRequest:
properties:
password:
maxLength: 32
minLength: 6
type: string
username:
maxLength: 32
minLength: 3
type: string
required:
- password
- username
type: object
responses.ErrorResponse:
properties:
error_code:
@ -63,6 +91,13 @@ definitions:
userId:
type: string
type: object
responses.UserResponse:
properties:
id:
type: string
username:
type: string
type: object
host: localhost:8080
info:
contact:
@ -79,7 +114,7 @@ info:
paths:
/images/{path}:
get:
description: Creates new user in system
description: get image by path
parameters:
- description: Path to image
in: query
@ -87,11 +122,12 @@ paths:
required: true
type: string
produces:
- application/json
- image/png
- image/jpeg
responses:
"200":
description: OK
summary: Create new user
summary: Get an image by path
/post:
get:
description: Return first 5 posts
@ -125,8 +161,8 @@ paths:
produces:
- application/json
responses:
"200":
description: OK
"201":
description: Created
schema:
$ref: '#/definitions/responses.PostResponse'
"400":
@ -238,6 +274,150 @@ paths:
summary: Get posts after offset
tags:
- post
/user/:
get:
description: Return all registered users
produces:
- application/json
responses:
"200":
description: OK
schema:
items:
$ref: '#/definitions/responses.UserResponse'
type: array
"400":
description: Bad Request
schema:
$ref: '#/definitions/responses.ErrorResponse'
summary: Get all users
tags:
- user
post:
consumes:
- application/json
description: Creates new user in system
parameters:
- description: User data
in: body
name: request
required: true
schema:
$ref: '#/definitions/requests.CreateUserRequest'
produces:
- application/json
responses:
"201":
description: Created
schema:
$ref: '#/definitions/responses.UserResponse'
"400":
description: Bad Request
schema:
$ref: '#/definitions/responses.ErrorResponse'
summary: Create new user
tags:
- user
/user/{id}:
delete:
description: Delete user
parameters:
- description: User id
in: path
name: id
required: true
type: string
produces:
- application/json
responses:
"200":
description: OK
"400":
description: Bad Request
schema:
$ref: '#/definitions/responses.ErrorResponse'
summary: Delete user
tags:
- user
get:
consumes:
- application/json
description: Find user by id
parameters:
- description: user id
in: path
name: id
required: true
type: string
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/responses.UserResponse'
"400":
description: Bad Request
schema:
$ref: '#/definitions/responses.ErrorResponse'
summary: Find user by id
tags:
- user
put:
consumes:
- application/json
description: Change the user's name and password
parameters:
- description: User id
in: path
name: id
required: true
type: string
- description: User data
in: body
name: request
required: true
schema:
$ref: '#/definitions/requests.PutUserRequest'
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/responses.UserResponse'
"400":
description: Bad Request
schema:
$ref: '#/definitions/responses.ErrorResponse'
summary: Change user
tags:
- user
/user/name/{name}:
get:
consumes:
- application/json
description: Find user by username
parameters:
- description: User name
in: path
name: name
required: true
type: string
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/responses.UserResponse'
"400":
description: Bad Request
schema:
$ref: '#/definitions/responses.ErrorResponse'
summary: Find user by username
tags:
- user
securityDefinitions:
BasicAuth:
type: basic