Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Calls for channels.invite and users.info #210

Open
wants to merge 8 commits into
base: develop
Choose a base branch
from

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 join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants