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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected StringgetPostRequestUri(String username, int limit) Gets the uri for requesting the posts dataprotected StringgetUserRequestUri(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 ofpostsmapJsonToUser(@NotBlank String json) Maps the JSON data to auserobjectMethods 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 tokenis not set.- API Note:
- This will set the bearer token to the property
twitter.bearer - Implementation Note:
- The
TwitterServiceis aBaseServicewith the
-
-
Method Details
-
mapJsonToUser
Description copied from class:BaseServiceMaps the JSON data to auserobject- Specified by:
mapJsonToUserin classBaseService- Parameters:
json- the JSON data to map- Returns:
- the created
userobject - 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:BaseServiceMaps the JSON data to a set ofposts- Specified by:
mapJsonToPostsin 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:BaseServiceGets the uri for requesting the user data- Specified by:
getUserRequestUriin classBaseService- Parameters:
username- the username of the user- Returns:
- the uri for requesting the user data
- See Also:
-
User
-
getPostRequestUri
Description copied from class:BaseServiceGets the uri for requesting the posts data- Specified by:
getPostRequestUriin classBaseService- Parameters:
username- the username of the userlimit- the limit of the posts- Returns:
- the uri for requesting the posts data
- See Also:
-
User
-