{"openapi":"3.0.0","servers":[{"description":"A4 swagger file for sending and receiving API","url":"https://virtserver.swaggerhub.com/rakshilmali/A4_invoice_sending_and_receiving_API/1.0.0"}],"info":{"version":"1.0.0","title":"A4_invoice_sending_and_receiving_API","description":"The API for A4 team's sending and receiving project"},"paths":{"/auth/signup":{"post":{"summary":"Allows the user to signup onto the website","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"firstName":{"type":"string"},"lastName":{"type":"string"},"email":{"type":"string","format":"email"},"password":{"type":"string","format":"password"},"confirmPassword":{"type":"string","format":"password"}},"required":["firstName","lastName","email","password","confirmPassword"]}}}},"responses":{"200":{"description":"Successfully allows user to signup onto the website and creates userId","content":{"application/json":{"schema":{"type":"object","properties":{"userId":{"type":"string"}}}}}},"400":{"description":"invalid inputs for signup","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}}}}}}},"tags":["Authentication"]}},"/auth/login":{"post":{"summary":"Allows the registered user to login onto the website and creates a JWT session for the user","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"email":{"type":"string","format":"email"},"password":{"type":"string","format":"password"}},"required":["email","password"]}}}},"responses":{"200":{"description":"Successfully allows registered user to login and creates session for user","content":{"application/json":{"schema":{"type":"object","properties":{"userId":{"type":"string"}}}}}},"400":{"description":"Invalid input for login","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}}}}}}},"tags":["Authentication"]}},"/auth/resetPassword":{"put":{"summary":"Allows the user to reset their password if they forgot it","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"userId":{"type":"string"},"password":{"type":"string","format":"password"},"confirmPassword":{"type":"string","format":"password"}},"required":["userId","password","confirmPassword"]}}}},"responses":{"200":{"description":"Successfully changes and resets password for user after they click forget password","content":{"application/json":{"schema":{"type":"object","properties":{"password":{"type":"string"}}}}}},"400":{"description":"userId is invalid, user is not logged in, invalid input for resetting password","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}}}}}}},"tags":["Authentication"]}},"/user/details":{"get":{"summary":"allows user to view their account information","parameters":[{"in":"query","name":"userId","required":true,"schema":{"type":"string","description":"userId is an identifier for the user - backend"}}],"responses":{"200":{"description":"successfully allows the user to view their account information","content":{"application/json":{"schema":{"type":"object","properties":{"userDetails":{"type":"object","properties":{"name":{"type":"string"},"email":{"type":"string"},"password":{"type":"string"},"dateRegistered":{"type":"string"}}}}}}}},"400":{"description":"userId is invalid","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}}}}}}},"tags":["User"]}},"/user/email":{"put":{"summary":"allows the user to change their email","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"userId":{"type":"string"},"email":{"type":"string","format":"email"}},"required":["userId","email"]}}}},"responses":{"200":{"description":"successfully allows the user to change their email","content":{"application/json":{"schema":{"type":"object","properties":{"email":{"type":"string"}}}}}},"400":{"description":"userId is invalid, invalid input for email","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}}}}}}},"tags":["User"]}},"/user/password":{"put":{"summary":"allows the user to change their password while staying logged in","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"userId":{"type":"string"},"password":{"type":"string","format":"password"},"confirmPassword":{"type":"string","format":"password"}},"required":["userId","password","confirmPassword"]}}}},"responses":{"200":{"description":"successfully allows logged in user to change their password","content":{"application/json":{"schema":{"type":"object","properties":{"password":{"type":"string"}}}}}},"400":{"description":"userId is invalid, password input is invalid","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}}}}}}},"tags":["User"]}},"/auth/logout":{"post":{"summary":"allows the logged in user to log out","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"userId":{"type":"string"}},"required":["userId"]}}}},"responses":{"200":{"description":"successfully allows the logged in user to log out","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"description":"invalid userId","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}}}}}}},"tags":["Authentication"]}},"/mailbox":{"get":{"summary":"mailbox for the user where they can track their received invoices and manage them","parameters":[{"in":"query","name":"userId","required":true,"schema":{"type":"string","description":"userId is an identifier for the user"}}],"responses":{"200":{"description":"allows the user to view their mailbox with their invoices that other people sent to them if empty it shows mailbox is empty","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/incomingPreview"}}}}},"400":{"description":"userId is invalid","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}}}}}}},"tags":["Mailbox"]}},"/mailbox/{invoiceId}":{"get":{"summary":"allows the user to view a particular invoice in detail","parameters":[{"in":"query","name":"userId","required":true,"schema":{"type":"string","description":"userId identifies the user"}},{"in":"path","name":"invoiceId","required":true,"schema":{"type":"string","description":"InvoiceId is an identifier for a particular invoice"}}],"responses":{"200":{"description":"user successfully views the invoice they intended to view in detail","content":{"application/json":{"schema":{"type":"object","properties":{"senderAddress":{"type":"string"},"timeSent":{"type":"string"},"invoiceSubject":{"type":"string"},"invoiceBody":{"type":"string"},"eInvoices":{"type":"array","items":{"$ref":"#/components/schemas/files"}}}}}}},"400":{"description":"userId is invalid","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}}}}}},"401":{"description":"user is not a recepient of this invoice","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}}}}}},"404":{"description":"invoice not found, invoiceId is invalid","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}}}}}}},"tags":["Mailbox"]}},"/mailbox/lookup":{"get":{"summary":"allows the suer to lookup for a particular invoice in their mail","parameters":[{"in":"query","name":"userId","required":true,"schema":{"type":"string","description":"userId is an identifier for the user"}},{"in":"query","name":"lookupString","required":true,"schema":{"type":"string","description":"lookupString allows the user to look for their invoice"}}],"responses":{"200":{"description":"successfully allows the user to search for their intended invoice by subject","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/incomingPreview"}}}}},"400":{"description":"userId is invalid, input is invalid","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}}}}}}},"tags":["Mailbox"]}},"/mailbox/sending":{"post":{"summary":"allows the user to send an invoice to another user by sending it as a mail with an invocie subject and recepient address as well as the timesent attached to it","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"userId":{"type":"string"},"recepientAddresses":{"type":"array","items":{"$ref":"#/components/schemas/recepientAddresses"}},"invoiceSubject":{"type":"string"},"invoiceBody":{"type":"string"},"eInvoices":{"type":"array","items":{"$ref":"#/components/schemas/files"}}},"required":["userId","recepientAddresses","invoiceSubject","invoiceBody","eInvoices"]}}}},"responses":{"200":{"description":"successfully allows the user to send an invoice to their intedned target recepieint","content":{"application/json":{"schema":{"type":"object","properties":{"communicationReport":{"type":"object","properties":{"content":{"type":"string"},"ReportId":{"type":"string"}}},"invoiceId":{"type":"string"}}}}}},"400":{"description":"userId is invalid, input is invalid for email and subject, invalid xml file","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}}}}}}},"tags":["Mailbox"]}},"/clear":{"delete":{"summary":"successfully clears the database - backend","responses":{"200":{"description":"clears the database successfully","content":{"application/json":{"schema":{"type":"object"}}}}},"tags":["Clear"]}},"/mailbox/{invoiceId}/delete":{"delete":{"summary":"allows the user to delete a particular invoice of the mailbox","parameters":[{"in":"query","name":"userId","required":true,"schema":{"type":"string","description":"userId is an identifier for the user - backend"}},{"in":"path","name":"invoiceId","required":true,"schema":{"type":"string","description":"fill in for later"}}],"responses":{"200":{"description":"deletes the invoice successfully for the user","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"description":"userId is invalid, user is not logged in","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}}}}}},"404":{"description":"invoice does not exist","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}}}}}}},"tags":["Mailbox"]}},"/reports":{"get":{"summary":"mailbox for the user where they can track their communication reports","parameters":[{"in":"query","name":"userId","required":true,"schema":{"type":"string","description":"userId is an identifier for the user"}}],"responses":{"200":{"description":"allows the user to view their communication reports","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/incomingPreview"}}}}},"400":{"description":"userId is invalid","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}}}}}}},"tags":["reports"]}}},"components":{"schemas":{"incomingPreview":{"type":"object","properties":{"senderAddress":{"type":"string"},"timeSent":{"type":"string"},"invoiceSubject":{"type":"string"}},"required":["senderAddress","timeSent","invoiceSubject"]},"recepientAddresses":{"type":"object","properties":{"recepientAddress":{"type":"string","format":"email"}},"required":["recepientAddress"]},"files":{"type":"object","properties":{"name":{"type":"string"},"content":{"type":"string"},"timeCreated":{"type":"string"},"owner":{"type":"string"}},"required":["name","content","timeCreated","owner"]}}}}