contracts/user/v1/openapi.yaml
2025-03-28 16:59:36 +05:00

309 lines
No EOL
6.4 KiB
YAML

openapi: 3.0.3
info:
title: UserService API
version: 0.0.1
paths:
/sessions/complete-logout:
post:
operationId: CompleteLogout
security:
- bearerAuth: [ ]
responses:
"200":
description: OK
content: { }
/sessions/login:
post:
operationId: Login
security:
- BasicAuth: [ ]
responses:
"200":
description: OK
content: { }
"404":
description: Not Found
content: { }
/sessions/logout:
post:
operationId: Logout
security:
- bearerAuth: [ ]
responses:
"200":
description: OK
content: { }
/sessions/refresh:
post:
operationId: Refresh
security:
- bearerAuth: [ ]
responses:
"200":
description: OK
content: { }
/sessions/verify:
get:
operationId: Verify
security:
- bearerAuth: [ ]
responses:
"200":
description: OK
content: { }
/sessions:
get:
operationId: ListSessions
security:
- bearerAuth: [ ]
responses:
"200":
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/ListSessionsResponse'
/users:
post:
operationId: CreateUser
security:
- bearerAuth: [ ]
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/CreateUserRequest'
required: true
responses:
"200":
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/CreateUserResponse'
get:
operationId: ListUsers
parameters:
- name: page
in: query
required: true
schema:
type: integer
format: int32
example: 1
- name: pageSize
in: query
required: true
schema:
type: integer
format: int32
example: 20
security:
- bearerAuth: [ ]
responses:
"200":
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/ListUsersResponse'
/users/{id}:
get:
operationId: GetUser
security:
- bearerAuth: [ ]
parameters:
- name: id
in: path
required: true
schema:
type: integer
format: int32
example: 2
responses:
"200":
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/GetUserResponse'
delete:
operationId: DeleteUser
security:
- bearerAuth: [ ]
parameters:
- name: id
in: path
required: true
schema:
type: integer
format: int32
example: 3
responses:
"200":
description: OK
content: { }
patch:
operationId: UpdateUser
security:
- bearerAuth: [ ]
parameters:
- name: id
in: path
required: true
schema:
type: integer
format: int32
example: 3
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/UpdateUserRequest'
required: true
responses:
"200":
description: OK
content: { }
components:
schemas:
Pagination:
type: object
required:
- page
- total
properties:
page:
type: integer
format: int32
example: 1
total:
type: integer
format: int32
example: 10
CreateUserRequest:
type: object
required:
- username
- password
properties:
username:
type: string
example: user123
password:
type: string
example: password123
CreateUserResponse:
type: object
required:
- id
properties:
id:
type: integer
format: int32
example: 13
GetUserResponse:
type: object
required:
- user
properties:
user:
$ref: '#/components/schemas/User'
UpdateUserRequest:
type: object
properties:
username:
type: string
example: user123
role:
type: integer
format: int32
example: 1
User:
type: object
required:
- id
- username
- createdAt
- modifiedAt
- role
properties:
id:
type: integer
format: int32
example: 13
username:
type: string
example: user123
createdAt:
type: string
format: date-time
modifiedAt:
type: string
format: date-time
role:
type: integer
format: int32
example: 1
Session:
type: object
required:
- id
- userId
- role
- createdAt
- expiresAt
- userAgent
- ip
properties:
id:
type: string
userId:
type: integer
format: int32
example: 13
role:
type: integer
format: int32
example: 1
createdAt:
type: string
format: date-time
expiresAt:
type: string
format: date-time
userAgent:
type: string
example: Mozilla/5.0
ip:
type: string
example: 154.23.50.1
ListSessionsResponse:
type: object
required:
- sessions
properties:
sessions:
type: array
items:
$ref: '#/components/schemas/Session'
ListUsersResponse:
type: object
required:
- users
- pagination
properties:
users:
type: array
items:
$ref: '#/components/schemas/User'
pagination:
$ref: '#/components/schemas/Pagination'
securitySchemes:
bearerAuth:
type: http
scheme: bearer
bearerFormat: JWT
BasicAuth:
type: http
scheme: basic