diff --git a/core/src/main/kotlin/chat/rocket/core/internal/rest/User.kt b/core/src/main/kotlin/chat/rocket/core/internal/rest/User.kt index 0a88bf42..964f30c1 100644 --- a/core/src/main/kotlin/chat/rocket/core/internal/rest/User.kt +++ b/core/src/main/kotlin/chat/rocket/core/internal/rest/User.kt @@ -71,6 +71,22 @@ suspend fun RocketChatClient.updateProfile( return handleRestCall>(request, type).result() } +/** + * Get user profile by id. + * + * @param userId The ID of the user. + * @return An [User] profile. + */ +suspend fun RocketChatClient.getProfile(userId: String): User { + val urlBuilder = requestUrl(restUrl, "users.info") + .addQueryParameter("userId", userId) + + val request = requestBuilderForAuthenticatedMethods(urlBuilder.build()).get().build() + + val type = Types.newParameterizedType(RestResult::class.java, User::class.java) + return handleRestCall>(request, type).result() +} + /** * Updates own basic information for the user. *