Class BaseController

java.lang.Object
ch.bztf.m226blb1.Base.BaseController
Direct Known Subclasses:
InstagramController, TwitterController

public abstract class BaseController extends Object
This class is the base class for all other controllers.
See Also:
Category:
Base
API Note:
Methods need the GetMapping annotation to be accessible
Implementation Note:
This class is not intended to be used directly., Inherited classes should implement RestController and RequestMapping annotations!
  • Field Details

  • Constructor Details

    • BaseController

      protected BaseController(@NonNull @NonNull BaseService service)
      Constructor for the BaseController.
      Parameters:
      service - the BaseService for requesting the data
  • Method Details

    • status

      public ResponseHandler<String> status()
      Check if the controller is up and running. It can be requested via the base path / .
      Returns:
      A ResponseHandler with the status of the controller
    • getUser

      public ResponseHandler<User> getUser(@RequestParam("username") @NotBlank @NotBlank String username, @RequestParam(name="api_key",required=false) @RequestHeader(name="Authorization",required=false) @Size(min=128,max=128) @NotBlank @Size(min=128,max=128) @NotBlank String apiKey)
      Gets the stats of a user by its username. It can be requested via the path /user .
      Parameters:
      username - the username of the user
      apiKey - the api key of the account. Can also be passed via the HttpHeaders.AUTHORIZATION header.
      Returns:
      the stats of the user by the username
      See Also:
    • getPosts

      public ResponseHandler<Set<Post>> getPosts(@RequestParam("username") @NotBlank @NotBlank String username, @RequestParam(name="api_key",required=false) @RequestHeader(name="Authorization",required=false) @Size(min=128,max=128) @NotBlank @Size(min=128,max=128) @NotBlank String apiKey, @RequestParam(name="limit",required=false) @RequestHeader(name="Content-Length",required=false) Optional<Integer> limit)
      Gets the posts of a user by its username. It can be requested via the path /posts .
      Parameters:
      username - the username of the user
      apiKey - the api key of the account. Can also be passed via the HttpHeaders.AUTHORIZATION header.
      limit - the limit for the posts (must be greater than 0)
      Returns:
      a ResponseHandler with a set of the last (limit) posts of the user with the given username
      See Also: