313 lines
6.9 KiB
JSON
313 lines
6.9 KiB
JSON
{
|
|
"swagger": "2.0",
|
|
"info": {
|
|
"title": "Simple Bank API",
|
|
"version": "0.0.1",
|
|
"contact": {
|
|
"name": "fvideira",
|
|
"url": "https://github.com/FernandoJVideira/simple_bank",
|
|
"email": "[email protected]"
|
|
}
|
|
},
|
|
"tags": [
|
|
{
|
|
"name": "SimpleBank"
|
|
}
|
|
],
|
|
"consumes": [
|
|
"application/json"
|
|
],
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"paths": {
|
|
"/v1/create_user": {
|
|
"post": {
|
|
"summary": "Create User",
|
|
"description": "Create a new user in the Simple Bank system.",
|
|
"operationId": "SimpleBank_CreateUser",
|
|
"responses": {
|
|
"200": {
|
|
"description": "A successful response.",
|
|
"schema": {
|
|
"$ref": "#/definitions/pbCreateUserResponse"
|
|
}
|
|
},
|
|
"default": {
|
|
"description": "An unexpected error response.",
|
|
"schema": {
|
|
"$ref": "#/definitions/rpcStatus"
|
|
}
|
|
}
|
|
},
|
|
"parameters": [
|
|
{
|
|
"name": "body",
|
|
"in": "body",
|
|
"required": true,
|
|
"schema": {
|
|
"$ref": "#/definitions/pbCreateUserRequest"
|
|
}
|
|
}
|
|
],
|
|
"tags": [
|
|
"SimpleBank"
|
|
]
|
|
}
|
|
},
|
|
"/v1/login_user": {
|
|
"post": {
|
|
"summary": "Login User",
|
|
"description": "Login an existing user in the Simple Bank system.",
|
|
"operationId": "SimpleBank_LoginUser",
|
|
"responses": {
|
|
"200": {
|
|
"description": "A successful response.",
|
|
"schema": {
|
|
"$ref": "#/definitions/pbLoginUserResponse"
|
|
}
|
|
},
|
|
"default": {
|
|
"description": "An unexpected error response.",
|
|
"schema": {
|
|
"$ref": "#/definitions/rpcStatus"
|
|
}
|
|
}
|
|
},
|
|
"parameters": [
|
|
{
|
|
"name": "body",
|
|
"in": "body",
|
|
"required": true,
|
|
"schema": {
|
|
"$ref": "#/definitions/pbLoginUserRequest"
|
|
}
|
|
}
|
|
],
|
|
"tags": [
|
|
"SimpleBank"
|
|
]
|
|
}
|
|
},
|
|
"/v1/update_user": {
|
|
"patch": {
|
|
"summary": "Update User",
|
|
"description": "Update an existing user in the Simple Bank system.",
|
|
"operationId": "SimpleBank_UpdateUser",
|
|
"responses": {
|
|
"200": {
|
|
"description": "A successful response.",
|
|
"schema": {
|
|
"$ref": "#/definitions/pbUpdateUserResponse"
|
|
}
|
|
},
|
|
"default": {
|
|
"description": "An unexpected error response.",
|
|
"schema": {
|
|
"$ref": "#/definitions/rpcStatus"
|
|
}
|
|
}
|
|
},
|
|
"parameters": [
|
|
{
|
|
"name": "body",
|
|
"in": "body",
|
|
"required": true,
|
|
"schema": {
|
|
"$ref": "#/definitions/pbUpdateUserRequest"
|
|
}
|
|
}
|
|
],
|
|
"tags": [
|
|
"SimpleBank"
|
|
]
|
|
}
|
|
},
|
|
"/v1/verify_email": {
|
|
"get": {
|
|
"summary": "Verify Email",
|
|
"description": "Verify user's email in the Simple Bank system.",
|
|
"operationId": "SimpleBank_VerifyEmail",
|
|
"responses": {
|
|
"200": {
|
|
"description": "A successful response.",
|
|
"schema": {
|
|
"$ref": "#/definitions/pbVerifyEmailResponse"
|
|
}
|
|
},
|
|
"default": {
|
|
"description": "An unexpected error response.",
|
|
"schema": {
|
|
"$ref": "#/definitions/rpcStatus"
|
|
}
|
|
}
|
|
},
|
|
"parameters": [
|
|
{
|
|
"name": "id",
|
|
"in": "query",
|
|
"required": false,
|
|
"type": "string",
|
|
"format": "int64"
|
|
},
|
|
{
|
|
"name": "code",
|
|
"in": "query",
|
|
"required": false,
|
|
"type": "string"
|
|
}
|
|
],
|
|
"tags": [
|
|
"SimpleBank"
|
|
]
|
|
}
|
|
}
|
|
},
|
|
"definitions": {
|
|
"pbCreateUserRequest": {
|
|
"type": "object",
|
|
"properties": {
|
|
"username": {
|
|
"type": "string"
|
|
},
|
|
"fullName": {
|
|
"type": "string"
|
|
},
|
|
"email": {
|
|
"type": "string"
|
|
},
|
|
"password": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
},
|
|
"pbCreateUserResponse": {
|
|
"type": "object",
|
|
"properties": {
|
|
"user": {
|
|
"$ref": "#/definitions/pbUser"
|
|
}
|
|
}
|
|
},
|
|
"pbLoginUserRequest": {
|
|
"type": "object",
|
|
"properties": {
|
|
"username": {
|
|
"type": "string"
|
|
},
|
|
"password": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
},
|
|
"pbLoginUserResponse": {
|
|
"type": "object",
|
|
"properties": {
|
|
"sessionId": {
|
|
"type": "string"
|
|
},
|
|
"accessToken": {
|
|
"type": "string"
|
|
},
|
|
"accessTokenExpiresAt": {
|
|
"type": "string",
|
|
"format": "date-time"
|
|
},
|
|
"refreshToken": {
|
|
"type": "string"
|
|
},
|
|
"refreshTokenExpiresAt": {
|
|
"type": "string",
|
|
"format": "date-time"
|
|
},
|
|
"user": {
|
|
"$ref": "#/definitions/pbUser"
|
|
}
|
|
}
|
|
},
|
|
"pbUpdateUserRequest": {
|
|
"type": "object",
|
|
"properties": {
|
|
"username": {
|
|
"type": "string"
|
|
},
|
|
"fullName": {
|
|
"type": "string"
|
|
},
|
|
"email": {
|
|
"type": "string"
|
|
},
|
|
"password": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
},
|
|
"pbUpdateUserResponse": {
|
|
"type": "object",
|
|
"properties": {
|
|
"user": {
|
|
"$ref": "#/definitions/pbUser"
|
|
}
|
|
}
|
|
},
|
|
"pbUser": {
|
|
"type": "object",
|
|
"properties": {
|
|
"username": {
|
|
"type": "string"
|
|
},
|
|
"fullName": {
|
|
"type": "string"
|
|
},
|
|
"email": {
|
|
"type": "string"
|
|
},
|
|
"passwordChangedAt": {
|
|
"type": "string",
|
|
"format": "date-time"
|
|
},
|
|
"createdAt": {
|
|
"type": "string",
|
|
"format": "date-time"
|
|
}
|
|
}
|
|
},
|
|
"pbVerifyEmailResponse": {
|
|
"type": "object",
|
|
"properties": {
|
|
"isVerified": {
|
|
"type": "boolean"
|
|
}
|
|
}
|
|
},
|
|
"protobufAny": {
|
|
"type": "object",
|
|
"properties": {
|
|
"@type": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"additionalProperties": {}
|
|
},
|
|
"rpcStatus": {
|
|
"type": "object",
|
|
"properties": {
|
|
"code": {
|
|
"type": "integer",
|
|
"format": "int32"
|
|
},
|
|
"message": {
|
|
"type": "string"
|
|
},
|
|
"details": {
|
|
"type": "array",
|
|
"items": {
|
|
"type": "object",
|
|
"$ref": "#/definitions/protobufAny"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|