Class TwitterService
java.lang.Object
ch.bztf.m226blb1.Base.BaseService
ch.bztf.m226blb1.Platforms.Twitter.TwitterService
-
Field Summary
Fields inherited from class ch.bztf.m226blb1.Base.BaseService
accountRepository, postRepository, userRepository, webClient
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected String
getPostRequestUri
(String username, int limit) Gets the uri for requesting the posts dataprotected String
getUserRequestUri
(String username) Gets the uri for requesting the user datamapJsonToPosts
(@NotBlank String json, @javax.validation.constraints.Min(10L) int limit) Maps the JSON data to a set ofposts
mapJsonToUser
(@NotBlank String json) Maps the JSON data to auser
objectMethods inherited from class ch.bztf.m226blb1.Base.BaseService
getBaseWebClient, getJsonData, getPosts, getUser
-
Constructor Details
-
TwitterService
- Parameters:
bearer
- The bearer token for the Twitter API.- Throws:
IllegalArgumentException
- If thebearer token
is not set.- API Note:
- This will set the bearer token to the property
twitter.bearer
- Implementation Note:
- The
TwitterService
is aBaseService
with the
-
-
Method Details
-
mapJsonToUser
Description copied from class:BaseService
Maps the JSON data to auser
object- Specified by:
mapJsonToUser
in classBaseService
- Parameters:
json
- the JSON data to map- Returns:
- the created
user
object - See Also:
-
ObjectMapper
-
mapJsonToPosts
public Set<Post> mapJsonToPosts(@NotBlank @NotBlank String json, @Min(10L) @javax.validation.constraints.Min(10L) int limit) Description copied from class:BaseService
Maps the JSON data to a set ofposts
- Specified by:
mapJsonToPosts
in classBaseService
- Parameters:
json
- the JSON data to maplimit
- the limit of theposts
- Returns:
- the created set of posts limited by
limit
- See Also:
-
ObjectMapper
-
getUserRequestUri
Description copied from class:BaseService
Gets the uri for requesting the user data- Specified by:
getUserRequestUri
in classBaseService
- Parameters:
username
- the username of the user- Returns:
- the uri for requesting the user data
- See Also:
-
User
-
getPostRequestUri
Description copied from class:BaseService
Gets the uri for requesting the posts data- Specified by:
getPostRequestUri
in classBaseService
- Parameters:
username
- the username of the userlimit
- the limit of the posts- Returns:
- the uri for requesting the posts data
- See Also:
-
User
-