Package ch.bztf.m226blb1.Base
Class BaseController
java.lang.Object
ch.bztf.m226blb1.Base.BaseController
- Direct Known Subclasses:
InstagramController,TwitterController
This class is the base class for all other controllers.
- See Also:
- Category:
- Base
- API Note:
- Methods need the
GetMappingannotation to be accessible - Implementation Note:
- This class is not intended to be used directly., Inherited classes should implement
RestControllerandRequestMappingannotations!
-
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedBaseController(@NonNull BaseService service) Constructor for theBaseController. -
Method Summary
-
Field Details
-
service
BaseServicefor requesting the data
-
-
Constructor Details
-
BaseController
Constructor for theBaseController.- Parameters:
service- theBaseServicefor requesting the data
-
-
Method Details
-
status
Check if the controller is up and running. It can be requested via the base path/.- Returns:
- A
ResponseHandlerwith 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 itsusername. It can be requested via the path/user. -
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) - Parameters:
username- the username of theuserapiKey- the api key of theaccount. Can also be passed via theHttpHeaders.AUTHORIZATIONheader.limit- the limit for the posts (must be greater than 0)- Returns:
- a
ResponseHandlerwith a set of the last (limit)postsof the user with the givenusername - See Also:
-
serviceGetMapping
-