PHP Classes

File: public/openapi.yaml

Recommend this page to a friend!
  Classes of Mateo   PHP Banking System API   public/openapi.yaml   Download  
File: public/openapi.yaml
Role: Auxiliary data
Content type: text/plain
Description: Auxiliary data
Class: PHP Banking System API
API to implement banking transactions
Author: By
Last change:
Date: 6 months ago
Size: 13,550 bytes
 

Contents

Class file image Download
openapi: 3.0.0 info: title: 'Bank api' version: '0.1' paths: '/api/transactions/{id}': get: tags: - Transactions description: 'Get transaction by id' operationId: c10e046e1546d9a65b3c5cb9f4d711f3 parameters: - name: id in: path description: 'Transaction id' required: true schema: type: string responses: '200': description: Transaction content: application/json: schema: properties: ok: { type: boolean } data: { $ref: '#/components/schemas/Transaction' } type: object '404': description: 'Transaction not found' content: application/json: schema: $ref: '#/components/schemas/Error' /api/transactions/: post: tags: - Transactions description: 'Create new transaction' operationId: bc1671024b0e5badf721efe367c86c1f requestBody: content: application/json: schema: properties: mount: description: 'Transaction mount' type: number format: float user_id: description: 'User id' type: string user_pin: description: 'Secret user pin' type: integer target_id: description: 'User id target' type: string type: object responses: '200': description: 'Transaction created' content: application/json: schema: properties: ok: { type: boolean } data: { $ref: '#/components/schemas/Transaction' } type: object '400': description: 'Insufficient user funds' content: application/json: schema: $ref: '#/components/schemas/Error' '401': description: 'Invalid user pin' content: application/json: schema: $ref: '#/components/schemas/Error' '404': description: 'User not found' content: application/json: schema: $ref: '#/components/schemas/Error' '409': description: 'Duplicated transaction' content: application/json: schema: $ref: '#/components/schemas/Error' '500': description: 'Fail to update user info / Transaction not created' content: application/json: schema: $ref: '#/components/schemas/Error' /api/users/: get: tags: - Users description: 'Get all users' operationId: 85a0926c2137b7e26bbfa647ad90ef0a parameters: - name: limit in: query required: false schema: type: integer - name: offset in: query required: false schema: type: integer responses: '200': description: 'Users list' content: application/json: schema: properties: ok: { type: boolean } data: { $ref: '#/components/schemas/User' } type: object post: tags: - Users description: 'Create new user' operationId: 973ae153132a70362405b06dc2850a23 requestBody: content: application/json: schema: properties: name: description: 'New user name' type: string balance: description: 'User balance' type: number format: float pin: description: 'Secret user pin' type: integer type: object responses: '200': description: 'User create' content: application/json: schema: properties: ok: { type: boolean } data: { $ref: '#/components/schemas/User' } type: object '409': description: 'Duplicated user' content: application/json: schema: $ref: '#/components/schemas/Error' '500': description: 'Invalid payload / Fail to save user' content: application/json: schema: $ref: '#/components/schemas/Error' '/api/users/{id}': get: tags: - Users description: 'Find user by id' operationId: 71d110b10b1ac4766abfa25e4fb35916 parameters: - name: id in: path description: 'User id' required: true schema: type: string responses: '200': description: User content: application/json: schema: properties: ok: { type: boolean } data: { $ref: '#/components/schemas/User' } type: object '404': description: 'User not found' content: application/json: schema: $ref: '#/components/schemas/Error' put: tags: - Users description: 'Update existing user' operationId: 87d6391a31447c282f8cda50910af407 parameters: - name: id in: path description: 'User id' required: true schema: type: string requestBody: content: application/json: schema: properties: name: description: 'New user name' type: string balance: description: 'User balance' type: number format: float type: object responses: '200': description: 'User update' content: application/json: schema: properties: ok: { type: boolean } data: { $ref: '#/components/schemas/User' } type: object '500': description: 'Invalid payload / Fail to save user' content: application/json: schema: $ref: '#/components/schemas/Error' delete: tags: - Users description: 'Delete user' operationId: 0b491e804fd1661d3b62451995d0ed41 parameters: - name: id in: path description: 'User id' required: true schema: type: string responses: '200': description: 'User deleted' content: application/json: schema: properties: ok: { type: boolean } data: { $ref: '#/components/schemas/User' } type: object '400': description: 'User not deleted / Fail to delete user' content: application/json: schema: $ref: '#/components/schemas/Error' '404': description: 'User not found' content: application/json: schema: $ref: '#/components/schemas/Error' /api/users/login/: post: tags: - Users description: 'Login in a user account with id and pin' operationId: a57fbcb38ed405eab1ddc5d06b3cd68e requestBody: content: application/json: schema: properties: id: description: 'User id' type: string pin: description: 'User secret pin' type: integer type: object responses: '200': description: 'User data' content: application/json: schema: properties: ok: { type: boolean } data: { $ref: '#/components/schemas/User' } type: object '401': description: 'Invalid user pin' content: application/json: schema: $ref: '#/components/schemas/Error' '404': description: 'User not found' content: application/json: schema: $ref: '#/components/schemas/Error' '/api/users/{id}/withdraw/': put: tags: - Users description: 'Withdraw money from an account' operationId: e82114e9603606db81f6f2281bb65f81 parameters: - name: id in: path description: 'User id' required: true schema: type: string requestBody: content: application/json: schema: properties: amount: description: 'Amount to withdraw' type: number format: float pin: description: 'User secret pin' type: integer type: object responses: '200': description: 'User data' content: application/json: schema: properties: ok: { type: boolean } data: { $ref: '#/components/schemas/User' } type: object '400': description: 'Invalid amount to withdraw' content: application/json: schema: $ref: '#/components/schemas/Error' '401': description: 'Invalid user pin' content: application/json: schema: $ref: '#/components/schemas/Error' '404': description: 'User not found' content: application/json: schema: $ref: '#/components/schemas/Error' '500': description: 'Fail to update user' content: application/json: schema: $ref: '#/components/schemas/Error' '/api/users/{id}/transactions': get: tags: - Users description: 'Get all user transactions' operationId: ae38fe71c97a64c95fb80f26fae59cc5 parameters: - name: id in: path description: 'User id' required: true schema: type: string responses: '200': description: 'User transactions' content: application/json: schema: properties: ok: { type: boolean } data: { type: array, items: { $ref: '#/components/schemas/Transaction' } } type: object '404': description: 'User not found' content: application/json: schema: $ref: '#/components/schemas/Error' /: get: tags: - Home operationId: c3271c668d930dbb2f7e8adb51d83b30 responses: '302': description: 'Redirect to api docs' /api/docs: get: tags: - Home operationId: de102a4ebfde0ca96112adb3afd74bd1 responses: '200': description: 'Swagger docs' components: schemas: Error: properties: ok: description: 'Indicates if the request was successful. Always false' type: boolean error: properties: code: description: 'HTTP status code' type: integer message: description: 'Error message' type: string type: object type: object Success: properties: ok: description: 'Indicates if the request was successful. Always true' type: boolean data: description: 'Request content, can be User, Transaction or an array of these' type: mixed type: object Transaction: title: Transaction properties: id: description: 'Transaction unique id' type: string mount: description: 'Transaction mount' type: number format: float created_at: description: 'Transaction date' type: string format: date-time user_id: description: 'User id' type: string target_id: description: 'Target id' type: string type: object User: title: User properties: id: description: 'User unique id' type: string name: description: 'User name' type: string balance: description: 'User balance' type: number format: float created_at: description: 'User created date' type: string format: date-time type: object