@API(status=STABLE) public class UserService extends java.lang.Object implements OboUserService, OboService<OboUserService>
This service is used for retrieving information about a particular user, search users by ids, emails or usernames, perform some action related to user like:
Constructor and Description |
---|
UserService(UserApi userApi,
UsersApi usersApi,
AuditTrailApi auditTrailApi,
AuthSession authSession,
RetryWithRecoveryBuilder<?> retryBuilder) |
UserService(UserApi userApi,
UsersApi usersApi,
AuditTrailApi auditTrailApi,
RetryWithRecoveryBuilder<?> retryBuilder) |
Modifier and Type | Method and Description |
---|---|
void |
addDisclaimer(java.lang.Long userId,
java.lang.String disclaimerId)
Assign disclaimer to an user.
|
void |
addRole(java.lang.Long userId,
RoleId roleId)
Add a role to an user.
|
V2UserDetail |
create(V2UserCreate payload)
Creates a new user.
|
void |
followUser(java.util.List<java.lang.Long> followerIds,
java.lang.Long userId)
Make a list of users to start following a specific user.
|
java.util.List<Avatar> |
getAvatar(java.lang.Long userId)
Get the url of avatar of an user
|
java.util.List<java.lang.Long> |
getDelegates(java.lang.Long userId)
Get delegates assigned to an user.
|
Disclaimer |
getDisclaimer(java.lang.Long userId)
Get disclaimer assigned to an user.
|
java.util.List<Feature> |
getFeatureEntitlements(java.lang.Long userId)
Get feature entitlements of an user.
|
UserStatus |
getStatus(java.lang.Long userId)
Get status of an user.
|
V2UserDetail |
getUserDetail(java.lang.Long userId)
Retrieve user details of a particular user.
|
java.util.stream.Stream<V1AuditTrailInitiatorResponse> |
listAllAuditTrail(java.lang.Long startTimestamp,
java.lang.Long endTimestamp,
java.lang.Long initiatorId,
java.lang.String role,
java.lang.Integer chunkSize,
java.lang.Integer maxItems)
Returns all audit trail of actions performed by a privileged user in a given period of time.
|
java.util.stream.Stream<java.lang.Long> |
listAllUserFollowers(java.lang.Long userId)
Returns the
Stream of followers of a specific user with default chunk size and total size equals 100. |
java.util.stream.Stream<java.lang.Long> |
listAllUserFollowers(java.lang.Long userId,
StreamPaginationAttribute pagination)
Returns the
Stream of followers of a specific user. |
java.util.stream.Stream<java.lang.Long> |
listAllUserFollowing(java.lang.Long userId)
Returns a
Stream of users followed by a specific user with default chunk size and total size equals 100. |
java.util.stream.Stream<java.lang.Long> |
listAllUserFollowing(java.lang.Long userId,
StreamPaginationAttribute pagination)
Returns a
Stream of users followed by a specific user. |
java.util.stream.Stream<V2UserDetail> |
listAllUsersDetail()
Retrieve all users in the company (pod) and return in a
Stream with default chunk size and total size equals 100. |
java.util.stream.Stream<V2UserDetail> |
listAllUsersDetail(StreamPaginationAttribute pagination)
Retrieve all users in the company (pod) and return in a
Stream . |
java.util.stream.Stream<V2UserDetail> |
listAllUsersDetail(UserFilter filter)
Retrieve all of users in the company (pod) by a filter and return in a
Stream with default chunk size and total size equals 100. |
java.util.stream.Stream<V2UserDetail> |
listAllUsersDetail(UserFilter filter,
StreamPaginationAttribute pagination)
Retrieve all of users in the company (pod) by a filter and return in a
Stream . |
V1AuditTrailInitiatorList |
listAuditTrail(java.lang.Long startTimestamp,
java.lang.Long endTimestamp,
CursorPaginationAttribute pagination,
java.lang.Long initiatorId,
java.lang.String role)
Returns audit trail of actions performed by a privileged user in a given period of time.
|
java.util.List<RoleDetail> |
listRoles()
List all roles in the pod
|
FollowersListResponse |
listUserFollowers(java.lang.Long userId)
Returns the list of followers of a specific user.
|
FollowersListResponse |
listUserFollowers(java.lang.Long userId,
CursorPaginationAttribute pagination)
Returns the list of followers of a specific user.
|
java.util.List<UserV2> |
listUsersByEmails(java.util.List<java.lang.String> emailList)
|
java.util.List<UserV2> |
listUsersByEmails(java.util.List<java.lang.String> emailList,
java.lang.Boolean local,
java.lang.Boolean active)
|
java.util.List<UserV2> |
listUsersByIds(java.util.List<java.lang.Long> uidList)
|
java.util.List<UserV2> |
listUsersByIds(java.util.List<java.lang.Long> uidList,
java.lang.Boolean local,
java.lang.Boolean active)
|
java.util.List<UserV2> |
listUsersByUsernames(java.util.List<java.lang.String> usernameList)
|
java.util.List<UserV2> |
listUsersByUsernames(java.util.List<java.lang.String> usernameList,
java.lang.Boolean active)
|
java.util.List<V2UserDetail> |
listUsersDetail()
Retrieve all users in the company (pod).
|
java.util.List<V2UserDetail> |
listUsersDetail(PaginationAttribute pagination)
Retrieve all users in the company (pod).
|
java.util.List<V2UserDetail> |
listUsersDetail(UserFilter filter)
Retrieve a list of users in the company (pod) by a filter.
|
java.util.List<V2UserDetail> |
listUsersDetail(UserFilter filter,
PaginationAttribute pagination)
Retrieve a list of users in the company (pod) by a filter.
|
FollowingListResponse |
listUsersFollowing(java.lang.Long userId)
Returns the list of users followed by a specific user.
|
FollowingListResponse |
listUsersFollowing(java.lang.Long userId,
CursorPaginationAttribute pagination)
Returns the list of users followed by a specific user.
|
OboUserService |
obo(AuthSession oboSession)
Returns a new service instance with OBO-enabled endpoints from a given OBO session.
|
void |
removeDisclaimer(java.lang.Long userId)
Unassign disclaimer from an user.
|
void |
removeRole(java.lang.Long userId,
RoleId roleId)
Remove a role from an user.
|
java.util.stream.Stream<UserV2> |
searchAllUsers(UserSearchQuery query,
java.lang.Boolean local)
|
java.util.stream.Stream<UserV2> |
searchAllUsers(UserSearchQuery query,
java.lang.Boolean local,
StreamPaginationAttribute pagination)
|
java.util.List<UserV2> |
searchUsers(UserSearchQuery query,
java.lang.Boolean local)
|
java.util.List<UserV2> |
searchUsers(UserSearchQuery query,
java.lang.Boolean local,
PaginationAttribute pagination)
|
void |
suspendUser(java.lang.Long userId,
java.lang.String reason,
java.time.Instant until)
Suspends a user account.
|
void |
udpateDelegates(java.lang.Long userId,
java.lang.Long delegatedUserId,
DelegateAction.ActionEnum actionEnum)
Update delegates assigned to an user.
|
void |
unfollowUser(java.util.List<java.lang.Long> followerIds,
java.lang.Long userId)
Make a list of users to stop following a specific user.
|
void |
unsuspendUser(java.lang.Long userId)
Re-activates a user account.
|
V2UserDetail |
update(java.lang.Long userId,
V2UserAttributes payload)
Updates an existing user
|
void |
updateAvatar(java.lang.Long userId,
byte[] image)
Update avatar of an user
|
void |
updateAvatar(java.lang.Long userId,
java.io.InputStream imageStream)
Update avatar of an user
|
void |
updateAvatar(java.lang.Long userId,
java.lang.String image)
Update avatar of an user
|
void |
updateFeatureEntitlements(java.lang.Long userId,
java.util.List<Feature> features)
Update feature entitlements of an user.
|
void |
updateStatus(java.lang.Long userId,
UserStatus status)
Update the status of an user
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
checkAuthSession
public UserService(UserApi userApi, UsersApi usersApi, AuditTrailApi auditTrailApi, AuthSession authSession, RetryWithRecoveryBuilder<?> retryBuilder)
public UserService(UserApi userApi, UsersApi usersApi, AuditTrailApi auditTrailApi, RetryWithRecoveryBuilder<?> retryBuilder)
public OboUserService obo(AuthSession oboSession)
OboService
obo
in interface OboService<OboUserService>
oboSession
- the OBO sessionpublic java.util.List<UserV2> listUsersByIds(@Nonnull java.util.List<java.lang.Long> uidList, @Nullable java.lang.Boolean local, @Nullable java.lang.Boolean active)
listUsersByIds
in interface OboUserService
uidList
- List of user idslocal
- If true then a local DB search will be performed and only local pod users will be
returned. If absent or false then a directory search will be performed and users
from other pods who are visible to the calling user will also be returned.active
- If not set all user status will be returned,
if true all active users will be returned,
if false all inactive users will be returnedpublic java.util.List<UserV2> listUsersByIds(@Nonnull java.util.List<java.lang.Long> uidList)
listUsersByIds
in interface OboUserService
uidList
- List of user idspublic java.util.List<UserV2> listUsersByEmails(@Nonnull java.util.List<java.lang.String> emailList, @Nullable java.lang.Boolean local, @Nullable java.lang.Boolean active)
listUsersByEmails
in interface OboUserService
emailList
- List of emailslocal
- If true then a local DB search will be performed and only local pod users will be
returned. If absent or false then a directory search will be performed and users
from other pods who are visible to the calling user will also be returned.active
- If not set all user status will be returned,
if true all active users will be returned,
if false all inactive users will be returnedpublic java.util.List<UserV2> listUsersByEmails(@Nonnull java.util.List<java.lang.String> emailList)
listUsersByEmails
in interface OboUserService
emailList
- List of emailspublic java.util.List<UserV2> listUsersByUsernames(@Nonnull java.util.List<java.lang.String> usernameList, @Nullable java.lang.Boolean active)
listUsersByUsernames
in interface OboUserService
usernameList
- List of usernamesactive
- If not set all user status will be returned,
if true all active users will be returned,
if false all inactive users will be returnedpublic java.util.List<UserV2> listUsersByUsernames(@Nonnull java.util.List<java.lang.String> usernameList)
listUsersByUsernames
in interface OboUserService
usernameList
- List of usernamespublic java.util.List<UserV2> searchUsers(@Nonnull UserSearchQuery query, @Nullable java.lang.Boolean local)
searchUsers
in interface OboUserService
query
- Searching query containing complicated information like title, location, company...local
- If true then a local DB search will be performed and only local pod users will be
returned. If absent or false then a directory search will be performed and users
from other pods who are visible to the calling user will also be returned.public java.util.List<UserV2> searchUsers(@Nonnull UserSearchQuery query, @Nullable java.lang.Boolean local, @Nonnull PaginationAttribute pagination)
searchUsers
in interface OboUserService
query
- Searching query containing complicated information like title, location, company...local
- If true then a local DB search will be performed and only local pod users will be
returned. If absent or false then a directory search will be performed and users
from other pods who are visible to the calling user will also be returned.pagination
- The skip and limit for pagination.@API(status=EXPERIMENTAL) public java.util.stream.Stream<UserV2> searchAllUsers(@Nonnull UserSearchQuery query, @Nullable java.lang.Boolean local)
searchAllUsers
in interface OboUserService
query
- Searching query containing complicated information like title, location, company...local
- If true then a local DB search will be performed and only local pod users will be
returned. If absent or false then a directory search will be performed and users
from other pods who are visible to the calling user will also be returned.Stream
of users found by query@API(status=EXPERIMENTAL) public java.util.stream.Stream<UserV2> searchAllUsers(@Nonnull UserSearchQuery query, @Nullable java.lang.Boolean local, @Nonnull StreamPaginationAttribute pagination)
searchAllUsers
in interface OboUserService
query
- Searching query containing complicated information like title, location, company...local
- If true then a local DB search will be performed and only local pod users will be
returned. If absent or false then a directory search will be performed and users
from other pods who are visible to the calling user will also be returned.pagination
- The chunkSize and totalSize for pagination.Stream
of users found by querypublic void followUser(@Nonnull java.util.List<java.lang.Long> followerIds, @Nonnull java.lang.Long userId)
followUser(List, Long)
followUser
in interface OboUserService
followerIds
- List of ids of the followers.userId
- The id of the user to be followed.public void unfollowUser(@Nonnull java.util.List<java.lang.Long> followerIds, @Nonnull java.lang.Long userId)
unfollowUser(List, Long)
unfollowUser
in interface OboUserService
followerIds
- List of the ids of the followers.userId
- The id of the user to be unfollowed.public V2UserDetail getUserDetail(@Nonnull java.lang.Long userId)
userId
- User Idpublic java.util.List<V2UserDetail> listUsersDetail()
public java.util.List<V2UserDetail> listUsersDetail(@Nonnull PaginationAttribute pagination)
pagination
- The skip and limit for pagination.@API(status=EXPERIMENTAL) public java.util.stream.Stream<V2UserDetail> listAllUsersDetail()
Stream
with default chunk size and total size equals 100.Stream
of retrieved users@API(status=EXPERIMENTAL) public java.util.stream.Stream<V2UserDetail> listAllUsersDetail(@Nonnull StreamPaginationAttribute pagination)
Stream
.pagination
- The chunkSize and totalSize for pagination.Stream
of retrieved userspublic java.util.List<V2UserDetail> listUsersDetail(@Nonnull UserFilter filter)
filter
- using to filter users byUserFeature
public java.util.List<V2UserDetail> listUsersDetail(@Nonnull UserFilter filter, @Nonnull PaginationAttribute pagination)
filter
- using to filter users by.pagination
- The skip and limit for pagination.UserFeature
@API(status=EXPERIMENTAL) public java.util.stream.Stream<V2UserDetail> listAllUsersDetail(@Nonnull UserFilter filter)
Stream
with default chunk size and total size equals 100.filter
- using to filter users byStream
of retrieved usersUserFeature
@API(status=EXPERIMENTAL) public java.util.stream.Stream<V2UserDetail> listAllUsersDetail(@Nonnull UserFilter filter, @Nonnull StreamPaginationAttribute pagination)
Stream
.filter
- using to filter users by.pagination
- The chunkSize and totalSize for pagination.Stream
of retrieved usersUserFeature
public void addRole(@Nonnull java.lang.Long userId, @Nonnull RoleId roleId)
userId
- User IdroleId
- Role Idpublic java.util.List<RoleDetail> listRoles()
RoleDetail
of all roles in the pod.public void removeRole(@Nonnull java.lang.Long userId, @Nonnull RoleId roleId)
userId
- User IdroleId
- Role Idpublic java.util.List<Avatar> getAvatar(@Nonnull java.lang.Long userId)
userId
- User Idpublic void updateAvatar(@Nonnull java.lang.Long userId, @Nonnull java.lang.String image)
userId
- User Idimage
- The avatar image for the user profile picture.The image must be a base64-encoded.public void updateAvatar(@Nonnull java.lang.Long userId, @Nonnull byte[] image)
userId
- User Idimage
- The avatar image in bytes array for the user profile picture.public void updateAvatar(@Nonnull java.lang.Long userId, @Nonnull java.io.InputStream imageStream) throws java.io.IOException
userId
- User IdimageStream
- The avatar image input stream for the user profile picture.java.io.IOException
public Disclaimer getDisclaimer(@Nonnull java.lang.Long userId)
userId
- User Idpublic void removeDisclaimer(@Nonnull java.lang.Long userId)
userId
- User Idpublic void addDisclaimer(@Nonnull java.lang.Long userId, @Nonnull java.lang.String disclaimerId)
userId
- User IddisclaimerId
- Disclaimer to be assignedpublic java.util.List<java.lang.Long> getDelegates(@Nonnull java.lang.Long userId)
userId
- User Idpublic void udpateDelegates(@Nonnull java.lang.Long userId, @Nonnull java.lang.Long delegatedUserId, @Nonnull DelegateAction.ActionEnum actionEnum)
userId
- User IddelegatedUserId
- Delegated user Id to be assignedactionEnum
- Action to be performedpublic java.util.List<Feature> getFeatureEntitlements(@Nonnull java.lang.Long userId)
userId
- User Idpublic void updateFeatureEntitlements(@Nonnull java.lang.Long userId, @Nonnull java.util.List<Feature> features)
userId
- User Idfeatures
- List of feature entitlements to be updatedpublic UserStatus getStatus(@Nonnull java.lang.Long userId)
userId
- User Idpublic void updateStatus(@Nonnull java.lang.Long userId, @Nonnull UserStatus status)
userId
- User Idstatus
- Status to be updated to the userpublic FollowersListResponse listUserFollowers(@Nonnull java.lang.Long userId)
userId
- User Idpublic FollowersListResponse listUserFollowers(@Nonnull java.lang.Long userId, @Nonnull CursorPaginationAttribute pagination)
userId
- User Idpagination
- The range and limit for pagination.@API(status=EXPERIMENTAL) public java.util.stream.Stream<java.lang.Long> listAllUserFollowers(@Nonnull java.lang.Long userId)
Stream
of followers of a specific user with default chunk size and total size equals 100.userId
- User IdStream
of followers of a specific user.@API(status=EXPERIMENTAL) public java.util.stream.Stream<java.lang.Long> listAllUserFollowers(@Nonnull java.lang.Long userId, @Nonnull StreamPaginationAttribute pagination)
Stream
of followers of a specific user.userId
- User Idpagination
- The chunkSize and totalSize for pagination.Stream
of followers of a specific user.public FollowingListResponse listUsersFollowing(@Nonnull java.lang.Long userId)
userId
- User Idpublic FollowingListResponse listUsersFollowing(@Nonnull java.lang.Long userId, @Nonnull CursorPaginationAttribute pagination)
userId
- User Idpagination
- The range and limit for pagination.@API(status=EXPERIMENTAL) public java.util.stream.Stream<java.lang.Long> listAllUserFollowing(@Nonnull java.lang.Long userId)
Stream
of users followed by a specific user with default chunk size and total size equals 100.userId
- User IdStream
of users followed by a specific user with the pagination information.@API(status=EXPERIMENTAL) public java.util.stream.Stream<java.lang.Long> listAllUserFollowing(@Nonnull java.lang.Long userId, @Nonnull StreamPaginationAttribute pagination)
Stream
of users followed by a specific user.userId
- User Idpagination
- The chunkSize and totalSize for pagination.Stream
of users followed by a specific user with the pagination information.public V2UserDetail create(@Nonnull V2UserCreate payload)
payload
- User's details to create.V2UserDetail
with created user details.public V2UserDetail update(@Nonnull java.lang.Long userId, @Nonnull V2UserAttributes payload)
userId
- User Idpayload
- User's new attributes for update.V2UserDetail
with updated user details.public V1AuditTrailInitiatorList listAuditTrail(@Nonnull java.lang.Long startTimestamp, java.lang.Long endTimestamp, CursorPaginationAttribute pagination, java.lang.Long initiatorId, java.lang.String role)
startTimestamp
- The start time of the period to retrieve the data.endTimestamp
- The end time of the period to retrieve the data.pagination
- The range and limit for pagination of data.initiatorId
- Privileged user id to list audit trail for.role
- Role to list audit trail for.V1AuditTrailInitiatorList
with items and pagination.@API(status=EXPERIMENTAL) public java.util.stream.Stream<V1AuditTrailInitiatorResponse> listAllAuditTrail(@Nonnull java.lang.Long startTimestamp, java.lang.Long endTimestamp, java.lang.Long initiatorId, java.lang.String role, java.lang.Integer chunkSize, java.lang.Integer maxItems)
startTimestamp
- The start time of the period to retrieve the data.endTimestamp
- The end time of the period to retrieve the data.initiatorId
- Privileged user id to list audit trail for.role
- Role to list audit trail for.chunkSize
- The max number of items to retrieve in a given endpoint callmaxItems
- The max number of items to retrieve in totalpublic void suspendUser(@Nonnull java.lang.Long userId, @Nonnull java.lang.String reason, @Nonnull java.time.Instant until)
userId
- user id to suspendreason
- reason why the user has to be suspendeduntil
- instant till when the user should be suspendedpublic void unsuspendUser(@Nonnull java.lang.Long userId)
userId
- user id to reactivate