Class UserTemplate
java.lang.Object
dev.voroby.springframework.telegram.client.templates.UserTemplate
This class simplifies the use of
TelegramClient
for TdApi.User
related objects.- Author:
- Pavel Vorobyev
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetMe()
Returns the current user.getProfilePhoto
(long userId) Returns profile photo of the user.getPublicPhoto
(long userId) Returns user profile photo visible if the main photo is hidden by privacy settings.getUser
(long userId) Returns information about a user by their identifier.getUserFullInfo
(long userId) Returns full information about a user by their identifier.Returns an HTTPS link, which can be used to get information about the current user.getUserProfilePhotos
(long userId, int offset, int limit) Returns the profile photos of a user.searchUserByPhoneNumber
(String phoneNumber) Searches a user by their phone number.searchUserByUsername
(String username) Searches a user by username.
-
Constructor Details
-
UserTemplate
-
-
Method Details
-
getUser
Returns information about a user by their identifier. This is an offline request.- Parameters:
userId
- User identifier.- Returns:
CompletableFuture<Response<TdApi.User>>
.
-
getUserFullInfo
Returns full information about a user by their identifier.- Parameters:
userId
- User identifier.- Returns:
CompletableFuture<Response<TdApi.UserFullInfo>>
.
-
getUserLink
Returns an HTTPS link, which can be used to get information about the current user.- Returns:
CompletableFuture<Response<TdApi.UserLink>>
.
-
getMe
Returns the current user.- Returns:
CompletableFuture<Response<TdApi.User>>
.
-
getProfilePhoto
Returns profile photo of the user. May be null.- Parameters:
userId
- User identifier.- Returns:
CompletableFuture<Response<TdApi.ProfilePhoto>>
. TdApi.ProfilePhoto may be null.
-
getPublicPhoto
Returns user profile photo visible if the main photo is hidden by privacy settings. May be null.- Parameters:
userId
- User identifier.- Returns:
CompletableFuture<Response<TdApi.ChatPhoto>>
. TdApi.ChatPhoto may be null.
-
getUserProfilePhotos
public CompletableFuture<Response<TdApi.ChatPhotos>> getUserProfilePhotos(long userId, int offset, int limit) Returns the profile photos of a user. Personal and public photo aren't returned.- Parameters:
userId
- User identifier.offset
- The number of photos to skip; must be non-negative.limit
- The maximum number of photos to be returned; up to 100.- Returns:
CompletableFuture<Response<TdApi.ChatPhotos>>
.
-
searchUserByPhoneNumber
Searches a user by their phone number. Returns null if user can't be found.- Parameters:
phoneNumber
- Phone number in international format to search for.- Returns:
CompletableFuture<Response<TdApi.User>>
. TdApi.User may be null.
-
searchUserByUsername
Searches a user by username. Returns null if user can't be found.- Parameters:
username
- Username to search for.- Returns:
CompletableFuture<Response<TdApi.User>>
. TdApi.User may be null.
-