Class WebAccountSvc

java.lang.Object
com.patreonshout.rest.BaseSvc
com.patreonshout.rest.WebAccountSvc
All Implemented Interfaces:
WebAccountImpl

@RestController
public class WebAccountSvc
extends BaseSvc
implements WebAccountImpl
Web Account RESTful Endpoint Interface

Responsibilities: 1) Add items to our webaccounts table in our database 2) Direct communication between the frontend portion of our application with the backend

  • Field Summary

    Fields
    Modifier and Type Field Description
    (package private) WebAccountFunctions webAccountFunctions
    An autowired Spring component that endpoints utilize to send or receive data from the database
  • Constructor Summary

    Constructors
    Constructor Description
    WebAccountSvc()  
  • Method Summary

    Modifier and Type Method Description
    org.springframework.http.ResponseEntity<?> GetPatreonTokens​(java.lang.String loginToken)
    Endpoint that allows retrieval of Patreon access and refresh tokens for a WebAccount containing the given login token
    org.springframework.http.ResponseEntity<?> GetSocialIntegration​(java.lang.String loginToken)
    Endpoint that returns the social integration tokens and webhook URLs for social platforms for a given login token
    org.springframework.http.ResponseEntity<?> Login​(LoginRequest loginRequest)
    Endpoint that will create a new WebAccountFunctions into the database
    org.springframework.http.ResponseEntity<?> Logout​(java.lang.String loginToken)
    Endpoint that will delete a login token from a WebAccountFunctions in the database
    org.springframework.http.HttpStatus PutSocialIntegration​(PutSocialIntegrationRequest putSocialIntegrationRequest)
    Endpoint that allows registering, updating or deleting integrations for social platforms.
    org.springframework.http.HttpStatus Register​(RegisterRequest registerRequest)
    Endpoint that will create a new WebAccountFunctions into the database.
    org.springframework.http.ResponseEntity<?> ResetPassword​(ResetPasswordRequest resetPasswordRequest)
    Endpoint that allows WebAccount password resetting.
    org.springframework.http.ResponseEntity<?> Webhook​(java.lang.String loginToken)
    Test for a webhook endpoint

    Methods inherited from class com.patreonshout.rest.BaseSvc

    catchCustomException, catchSQLIntegrityConstraintViolationException

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • webAccountFunctions

      @Autowired WebAccountFunctions webAccountFunctions
      An autowired Spring component that endpoints utilize to send or receive data from the database
  • Constructor Details

    • WebAccountSvc

      public WebAccountSvc()
  • Method Details

    • Register

      public org.springframework.http.HttpStatus Register​(@RequestBody RegisterRequest registerRequest) throws PSException
      Endpoint that will create a new WebAccountFunctions into the database.
      Specified by:
      Register in interface WebAccountImpl
      Parameters:
      registerRequest - RegisterRequest object that contains the desired login details for a new
      Returns:
      HttpStatus.OK if the registration was successful, HttpStatus.CONFLICT if the account already exists
      Throws:
      PSException
    • Login

      public org.springframework.http.ResponseEntity<?> Login​(@RequestBody LoginRequest loginRequest) throws PSException
      Endpoint that will create a new WebAccountFunctions into the database
      Specified by:
      Login in interface WebAccountImpl
      Parameters:
      loginRequest - is the json request
      Returns:
      a token signifying valid login or no token signifying invalid login
      Throws:
      PSException
    • Logout

      public org.springframework.http.ResponseEntity<?> Logout​(@RequestParam(name="login_token") java.lang.String loginToken)
      Endpoint that will delete a login token from a WebAccountFunctions in the database
      Specified by:
      Logout in interface WebAccountImpl
      Parameters:
      loginToken - Login token to delete from the database
      Returns:
      HttpStatus.OK if successful
    • PutSocialIntegration

      public org.springframework.http.HttpStatus PutSocialIntegration​(@RequestBody PutSocialIntegrationRequest putSocialIntegrationRequest) throws PSException
      Endpoint that allows registering, updating or deleting integrations for social platforms.
      Specified by:
      PutSocialIntegration in interface WebAccountImpl
      Parameters:
      putSocialIntegrationRequest - PutSocialIntegrationRequest object that contains WebAccountFunctions and request details.
      Returns:
      HttpStatus.OK if successful, HttpStatus.CONFLICT if the provided PutSocialIntegrationRequest does not contain a valid WebAccount ID number.
      Throws:
      PSException
    • GetSocialIntegration

      public org.springframework.http.ResponseEntity<?> GetSocialIntegration​(@RequestParam(name="login_token") java.lang.String loginToken) throws PSException
      Endpoint that returns the social integration tokens and webhook URLs for social platforms for a given login token
      Specified by:
      GetSocialIntegration in interface WebAccountImpl
      Parameters:
      loginToken - Login token belonging to a WebAccount
      Returns:
      SocialIntegration Social integration tokens and webhook URLs
      Throws:
      PSException
    • GetPatreonTokens

      public org.springframework.http.ResponseEntity<?> GetPatreonTokens​(@RequestParam(name="login_token") java.lang.String loginToken) throws PSException
      Endpoint that allows retrieval of Patreon access and refresh tokens for a WebAccount containing the given login token
      Specified by:
      GetPatreonTokens in interface WebAccountImpl
      Parameters:
      loginToken - Login token belonging to a WebAccount
      Returns:
      WebAccount Patreon access and refresh token
      Throws:
      PSException
    • ResetPassword

      public org.springframework.http.ResponseEntity<?> ResetPassword​(@RequestBody ResetPasswordRequest resetPasswordRequest) throws PSException
      Endpoint that allows WebAccount password resetting.
      Specified by:
      ResetPassword in interface WebAccountImpl
      Parameters:
      resetPasswordRequest - ResetPasswordRequest object generated from a user calling this endpoint
      Returns:
      HttpStatus.OK if successful, HttpStatus.UNAUTHORIZED if the given oldPassword did not match any current passwords belonging to the WebAccount found with the given loginToken
      Throws:
      PSException
    • Webhook

      @PostMapping("webhook") public org.springframework.http.ResponseEntity<?> Webhook​(@RequestParam(name="login_token") java.lang.String loginToken) throws PSException
      Test for a webhook endpoint
      Parameters:
      loginToken - is a user's loginToken
      Returns:
      an HttpStatus.OK
      Throws:
      PSException - in case of a database problem or a user mismatch