Untitled
unknown
plain_text
a year ago
5.4 kB
13
Indexable
openapi: 3.0.3
info:
title: EsimController API
version: 1.0.0
servers:
- url: api/integrations
paths:
/users/{userId}/balance/:
get:
summary: Получить текущий баланс пользователя
operationId: getUserBalance
parameters:
- name: userId
in: path
description: Уникальный идентификатор пользователя
required: true
schema:
type: integer
responses:
'200':
description: Успешное получение баланса
headers:
X-S2S-Key:
description: Токен авторизации
schema:
type: string
content:
application/json:
schema:
$ref: '#/components/schemas/UserBalanceResponse'
'404':
description: Пользователь не найден
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
security:
- ApiKeyAuth: []
/users/{userId}/balance/write-off:
post:
summary: Списать определенную сумму с баланса пользователя
operationId: writeOffBalance
parameters:
- name: userId
in: path
description: Уникальный идентификатор пользователя
required: true
schema:
type: integer
- name: X-Idempotency-Key
in: header
description: Уникальный ключ идемпотентности
required: true
schema:
type: string
maxLength: 64
- name: X-S2S-Key
in: header
description: Токен авторизации
required: true
schema:
type: string
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/WriteOffRequest'
responses:
'200':
description: Успешное списание средств
content:
application/json:
schema:
$ref: '#/components/schemas/UserBalanceResponse'
'400':
description: Недостаточно средств на балансе
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'404':
description: Пользователь не найден
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
security:
- ApiKeyAuth: []
/users/{userId}/balance/topup:
post:
summary: Пополнить баланс пользователя на определенную сумму
operationId: topUpBalance
parameters:
- name: userId
in: path
description: Уникальный идентификатор пользователя
required: true
schema:
type: integer
- name: X-Idempotency-Key
in: header
description: Уникальный ключ идемпотентности
required: true
schema:
type: string
maxLength: 64
- name: X-S2S-Key
in: header
description: Токен авторизации
required: true
schema:
type: string
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/TopUpRequest'
responses:
'200':
description: Баланс успешно пополнен
content:
application/json:
schema:
type: string
example: ''
'404':
description: Пользователь не найден
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
security:
- ApiKeyAuth: []
components:
securitySchemes:
ApiKeyAuth:
type: apiKey
in: header
name: X-S2S-Key
schemas:
UserBalanceResponse:
type: object
properties:
userId:
type: integer
example: 123
balances:
type: object
properties:
mb:
type: integer
example: 1000
pts:
type: integer
example: 1000
WriteOffRequest:
type: object
required:
- amount
properties:
amount:
type: number
example: 500
TopUpRequest:
type: object
required:
- amount
- currency
properties:
amount:
type: number
example: 1000
currency:
type: string
example: USD
ErrorResponse:
type: object
properties:
message:
type: string
example: Описание ошибки
code:
type: string
example: ERROR_CODE
httpCode:
type: integer
example: 400Editor is loading...
Leave a Comment