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
GetMapping
annotation to be accessible - Implementation Note:
- This class is not intended to be used directly., Inherited classes should implement
RestController
andRequestMapping
annotations!
-
Field Summary
-
Constructor Summary
ModifierConstructorDescriptionprotected
BaseController
(@NonNull BaseService service) Constructor for theBaseController
. -
Method Summary
-
Field Details
-
service
BaseService
for requesting the data
-
-
Constructor Details
-
BaseController
Constructor for theBaseController
.- Parameters:
service
- theBaseService
for requesting the data
-
-
Method Details
-
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 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 theuser
apiKey
- the api key of theaccount
. Can also be passed via theHttpHeaders.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 givenusername
- See Also:
-
service
GetMapping
-