Skip to content
This repository was archived by the owner on Oct 30, 2025. It is now read-only.

Conversation

@avbk
Copy link

@avbk avbk commented Oct 17, 2018

Hey Guys,

I needed a script to invite people automatically to specific private rooms. And since I like kotlin I tried to use this library and found it very easy to use. But for my needs there were two calls missing, one to invite someone to a specific room and one to find a user by his username.

I've added both and tried to copy your style. I hope you like it :-)

Best regards
Alex

@CLAassistant
Copy link

CLAassistant commented Oct 17, 2018

CLA assistant check
All committers have signed the CLA.

@avbk
Copy link
Author

avbk commented Oct 19, 2018

I realized that @R12rus wrote something similar in #209 and I liked his approach using RestResult instead of creating a new response class. Thus I incorporated his idea and extended my getUserByUsername() and introduced getUserById(). I also wrote some supporting tests.

I decided to consume the APIException, if the username or id is not known, and return an optional User instead, because one will write more robust code in Kotlin when using nullable types instead of exceptions.

avbk added 3 commits October 19, 2018 09:52
# Conflicts:
#	core/src/main/kotlin/chat/rocket/core/internal/rest/ChatRoom.kt
#	core/src/main/kotlin/chat/rocket/core/internal/rest/User.kt
#	core/src/test/kotlin/chat/rocket/core/internal/rest/ChatRoomTest.kt
#	core/src/test/kotlin/chat/rocket/core/internal/rest/Constants.kt
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants