{"openapi":"3.0.0","info":{"version":"1.0.0","title":"2.4Api","description":"2.4Api"},"tags":[{"name":"Authentication","description":"Actions related to authenticating the current user"},{"name":"Users","description":"Actions performed on the User model"},{"name":"Accounts","description":"Actions performed on the Account model"},{"name":"Transaction","description":"Actions related to money transactions"}],"security":[{"ApiKeyAuth":[]}],"paths":{"/users":{"get":{"operationId":"getUsers","description":"Gets all users that exist in the database.","tags":["Users"],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/User"}}}}},"304":{"description":"Not different since last request"}}}},"/users/{userId}":{"get":{"operationId":"getUser","description":"Gets the details of the user that has the specified ID.","tags":["Users"],"parameters":[{"in":"path","name":"userId","schema":{"type":"integer"},"required":true}],"responses":{"200":{"description":"OK"}}},"put":{"operationId":"updateUser","description":"Updates the information of the user with the specified ID.","tags":["Users"],"parameters":[{"in":"path","name":"userId","schema":{"type":"integer"},"required":true}],"responses":{"200":{"description":"OK"}}},"delete":{"operationId":"deleteUser","tags":["Users"],"parameters":[{"in":"path","name":"userId","schema":{"type":"integer"},"required":true}],"responses":{"200":{"description":"OK"}}}},"/users/{userId}/accounts":{"get":{"operationId":"getAccountsByUser","description":"Gets all accounts belonging to the user with the specified ID.","tags":["Accounts"],"parameters":[{"in":"path","name":"userId","schema":{"type":"integer"},"required":true}],"responses":{"200":{"description":"OK"}}},"post":{"operationId":"createAccount","description":"Creates an account that will belong to the user in UserId.","tags":["Accounts"],"parameters":[{"in":"path","name":"userId","schema":{"type":"integer"},"required":true}],"requestBody":{"required":true,"content":{"application/x-www-form-urlencoded":{"schema":{"$ref":"#/components/schemas/Account"}}}},"responses":{"200":{"description":"OK"}}}},"/users/{userId}/accounts/{iban}":{"get":{"operationId":"getAccountByUser","description":"Gets the account info from the specified IBAN if it belongs to the user given in the ID.","tags":["Accounts"],"parameters":[{"in":"path","name":"userId","schema":{"type":"integer"},"required":true},{"in":"path","name":"iban","schema":{"type":"integer"},"required":true}],"responses":{"200":{"description":"OK"}}}},"/accounts":{"get":{"operationId":"getAccounts","description":"Gets all accounts that are currently in the database.","tags":["Accounts"],"responses":{"200":{"description":"OK"}}}},"/accounts/{iban}":{"get":{"operationId":"getAccount","description":"Gets the given account from the database.","tags":["Accounts"],"parameters":[{"in":"path","name":"iban","schema":{"type":"string","pattern":"^\\w{2}\\d{2}\\w{4}\\d{10}$"},"required":true}],"responses":{"200":{"description":"OK"}}},"put":{"operationId":"updateAccount","description":"Updates the given account.","tags":["Accounts"],"parameters":[{"in":"path","name":"iban","schema":{"type":"string","pattern":"^\\w{2}\\d{2}\\w{4}\\d{10}$"},"required":true}],"requestBody":{"required":true,"content":{"application/x-www-form-urlencoded":{"schema":{"$ref":"#/components/schemas/Account"}}}},"responses":{"200":{"description":"OK"}}},"delete":{"operationId":"deleteAccount","description":"Deletes the given account from the database.","tags":["Accounts"],"parameters":[{"in":"path","name":"iban","schema":{"type":"integer"},"required":true}],"responses":{"200":{"description":"OK"}}}},"/transactions":{"get":{"operationId":"getTransactions","description":"Gets all transactions performed up until this point.","tags":["Transaction"],"responses":{"200":{"description":"OK"}}}},"/accounts/{iban}/transactions":{"get":{"operationId":"getTransactionsByAccount","description":"Gets all transactions performed to or from the account with the specified IBAN.","tags":["Transaction"],"parameters":[{"in":"path","name":"iban","schema":{"type":"string"},"required":true}],"responses":{"200":{"description":"OK"}}}},"/transaction":{"post":{"operationId":"performTransaction","description":"Performs a transaction from the specified account if it belongs to the given user.","tags":["Transaction"],"parameters":[{"in":"query","name":"sender","schema":{"type":"string","pattern":"^\\w{2}\\d{2}\\w{4}\\d{10}$"},"required":true},{"in":"query","name":"recipient","schema":{"type":"string","pattern":"^\\w{2}\\d{2}\\w{4}\\d{10}$"},"required":true},{"in":"query","name":"amount","schema":{"type":"number","minimum":0},"required":true}],"responses":{"200":{"description":"OK"}}}},"/deposit":{"post":{"operationId":"performDeposit","description":"Performs a deposit onto the given account if it belongs to the specified user.","tags":["Transaction"],"parameters":[{"in":"query","name":"recipient","schema":{"type":"string","pattern":"^\\w{2}\\d{2}\\w{4}\\d{10}$"},"required":true},{"in":"query","name":"amount","schema":{"type":"number"},"required":true}],"responses":{"200":{"description":"OK"}}}},"/withdraw":{"post":{"operationId":"performWithdrawal","description":"Performs a withdrawal from the given account if it belongs to the specified user.","tags":["Transaction"],"parameters":[{"in":"query","name":"sender","schema":{"type":"string","pattern":"^\\w{2}\\d{2}\\w{4}\\d{10}$"},"required":true},{"in":"query","name":"amount","schema":{"type":"number"},"required":true}],"responses":{"200":{"description":"OK"}}}},"/login":{"post":{"operationId":"login","description":"authenticates a user with a given username/password combination, and returns an authentication token for future requests.","tags":["Authentication"],"security":[],"requestBody":{"content":{"application/x-www-form-urlencoded":{"schema":{"$ref":"#/components/schemas/Login"}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"string"}}}},"401":{"description":"Wrong auth details"}}}},"/register":{"post":{"operationId":"register","description":"Registers a new user and stores their information in the database.","tags":["Authentication"],"requestBody":{"content":{"application/x-www-form-urlencoded":{"schema":{"$ref":"#/components/schemas/User"}}}},"responses":{"200":{"description":"OK"}}}}},"components":{"schemas":{"Account":{"type":"object","properties":{"iban":{"type":"string","pattern":"^\\w{2}\\d{2}\\w{4}\\d{10}$"},"owner":{"$ref":"#/components/schemas/Account"},"type":{"type":"string","enum":["current","savings"]},"balance":{"type":"number"},"transactionDayLimit":{"type":"integer"},"transactionAmountLimit":{"type":"number"},"balanceLimit":{"type":"number"}}},"User":{"type":"object","properties":{"firstName":{"type":"string"},"lastName":{"type":"string"},"username":{"type":"string"},"password":{"type":"string"},"type":{"type":"string","enum":["CUSTOMER","EMPLOYEE","MACHINE"]}}},"Transaction":{"type":"object","properties":{"id":{"type":"number"},"date":{"type":"string","format":"date"},"time":{"type":"string","format":"time"},"sender":{"type":"string"},"recipient":{"type":"string"},"amount":{"type":"number"},"type":{"type":"string","enum":["TRANSFER","DEPOSIT","WITHDRAW"]},"userPerforming":{"type":"integer"}}},"Login":{"type":"object","properties":{"username":{"type":"string"},"password":{"type":"string"}},"required":["username","password"]}},"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","name":"X-Auth-Token","in":"header"}}}}