Skip to content

Instantly share code, notes, and snippets.

@cupuyc
Created October 23, 2021 14:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cupuyc/8b533cb238547278adbfb503b2ba9036 to your computer and use it in GitHub Desktop.
Save cupuyc/8b533cb238547278adbfb503b2ba9036 to your computer and use it in GitHub Desktop.
openapi: 3.1.0
info:
title: Digital Bank sign-in API
version: '1.0'
summary: Allows bank clients to sign in.
contact:
name: G2
servers:
- url: 'http://localhost:3000'
paths:
/api/v1/client-device:
post:
summary: Initiate a new client device registration
operationId: client-device-init
responses:
'200':
description: OK
content:
application/json:
schema:
type: object
properties:
processId:
type: string
required:
- processId
examples:
example-1:
value:
processId: abcdef123456
'406':
description: App error 1002
content:
application/json:
schema:
description: ''
type: object
properties:
errorCode:
type: number
errorMessage:
type: string
minLength: 1
required:
- errorCode
- errorMessage
x-examples:
example-1:
errorCode: 1002
errorMessage: Operation can not be done. Please contact support.
examples:
example-1:
value:
errorCode: 1002
errorMessage: Operation can not be done. Please contact support.
example-2:
value:
errorCode: 1003
errorMessage: 'Please retry in ${n} seconds.'
example-3:
value:
errorCode: 1004
errorMessage: Contract was not found.
requestBody:
content:
application/json:
schema:
type: object
properties:
phoneNumber:
type: string
contractNumber:
type: string
required:
- phoneNumber
- contractNumber
examples:
example-1:
value:
phoneNumber: '+380990000000'
contractNumber: AB123456
description: ''
description: Initiate a new client device registration
parameters: []
/api/v1/client-device/confirmation:
post:
summary: Confirm client device
operationId: client-device-confirmation
responses:
'200':
$ref: '#/components/responses/HomeScreenDTO'
'406':
$ref: '#/components/responses/AppError'
requestBody:
content:
application/json:
schema:
type: object
properties:
processId:
type: string
otpCode:
type: string
publicKey:
type: string
notificationDeviceId:
type: string
required:
- processId
- otpCode
- publicKey
- notificationDeviceId
examples:
example-1:
value:
processId: process-abcdef123456
otpCode: '1234'
publicKey: ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA3G/hGhaDa7lJEXOvlDBJARKWRaapN7Kgmja1Fsklb0v5nX4nFEBdMTOjNzKp5Kez4PSfdBMzhkNdxV48TbWeG4yiEJmDfej7v24bKDi3XQokfnzgilui0qjO1wyX1HCU0208cIBDeAhE37L4GPx30tIujZ3xn4KUCV+AyWbWx7QhgUdyYQZI5WHsqSZ+hiA388CPKOeSP8B7ly0Nv5H3KSCi0y8Th2tTXCT/FP9oGbCMtCyzcYq/96I7aX0xyyzPul0wcckCPavJuB0hMivydxyhIW8yxJn8yrECXBPjNiOh77k1hYZFcauUTCGM6wj8XuP0tEtV1xE7DbNHWu2P2Q==
notificationDeviceId: device-abcdef123456
description: ''
parameters: []
description: Confirm client device
parameters: []
/api/v1/home:
parameters: []
get:
summary: Get home screen info
tags: []
responses:
'200':
$ref: '#/components/responses/HomeScreenDTO'
'406':
$ref: '#/components/responses/AppError'
'':
$ref: '#/components/responses/HomeScreenDTO'
operationId: loads
description: Get home screen info
security:
- request_signature: []
/api/v1/client-device/change:
post:
summary: Initiate changing client device
operationId: client-device-change
responses:
'200':
description: OK
content:
application/json:
schema:
type: object
properties:
processId:
type: string
required:
- processId
'400':
$ref: '#/components/responses/AppError'
requestBody:
content:
application/json:
schema:
description: ''
type: object
x-examples:
example-1:
phoneNumber: string
contractNumber: string
deviceKey: string
properties:
oldDeviceSignature:
type: string
required:
- oldDeviceSignature
description: ''
security:
- request_signature: []
description: Initiate changing client device
parameters: []
components:
schemas:
ClientInfoDTO:
title: ClientAccount
type: object
description: ''
examples:
- id: 142
firstName: Alice
lastName: Smith
email: alice.smith@gmail.com
dateOfBirth: '1997-10-31'
emailVerified: true
signUpDate: '2019-08-24'
properties:
id:
type: string
description: Unique identifier for the given user.
firstName:
type: string
lastName:
type: string
phone:
type: string
format: email
dateOfBirth:
type: string
format: date
example: '1997-10-31'
required:
- id
- firstName
- lastName
- phone
LoanDTO:
title: LoanDTO
type: object
properties:
id:
type: string
name:
type: string
next_payment_amount:
type: string
next_payment_date:
type: string
required:
- id
- name
responses:
AppError:
description: Generic app error
content:
application/json:
schema:
type: object
properties:
errorCode:
type: number
errorMessage:
type: string
fields:
allOf:
- properties:
fieldName:
type: string
fieldError:
type: string
type: object
examples:
example-operation-denied:
errorCode: 1002
errorMessage: Operation can not be done. Please contact support.
example-account-exists:
errorCode: 1001
errorMessage: 'Account already exists for phone ${0}.'
fields:
fieldName: phoneNumber
fieldError: Already exists
HomeScreenDTO:
description: Example response
content:
application/json:
schema:
type: object
properties:
profile:
$ref: '#/components/schemas/ClientInfoDTO'
loans:
type: array
items:
$ref: '#/components/schemas/LoanDTO'
examples:
example-1:
profile:
firstName: Maharet
lastName: Blane
phoneNumber: '+380990000000'
loans:
- id: abcdef123456
name: Macbook USB Adapter
next_payment_amount: 100.00 UAH
next_payment_date: '2021-11-21T01:11:11Z'
securitySchemes:
request_signature:
type: http
scheme: bearer
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment