Open lucasthomazoni opened 1 year ago
Not sure I follow what you mean about the APIs not allowing user#username
and room#name
. They both support these params. See
and
Specifically from the getUserFromParams
helper method: https://github.com/RocketChat/Rocket.Chat/blob/f74ba4e587ec294b4482ba578dcb2708f0322b4e/apps/meteor/app/api/server/helpers/getUserFromParams.ts#L7-L27
And the findChannelByIdOrName
method: https://github.com/RocketChat/Rocket.Chat/blob/404cfffe3fcee219579efce47ee0cab114162c69/apps/meteor/app/api/server/v1/channels.ts#L30-L62
and findPrivateGroupByIdOrName
method: https://github.com/RocketChat/Rocket.Chat/blob/404cfffe3fcee219579efce47ee0cab114162c69/apps/meteor/app/api/server/v1/groups.js#L22-L68
The kick
APIs are also already supported by the gem. See https://github.com/abrom/rocketchat-ruby/blob/main/lib/rocket_chat/messages/room.rb#L200-L207
Still happy to accept a PR improving the docs and specs, although another spec or two to test the username/room name options would be nice (and removing the channel/group kick methods).
@abrom Sorry I was looking at https://developer.rocket.chat/ docs instead of the actual code on GitHub and there is no mention of the user#username param.
I will undo the changes made and improve specs as well, just one unrelated question: Why are custom_fields
not marked as settable attributes on channel and group APIs? Can I add it?
Thanks!
No problems! Yeah the rocketchat docs are a little misleading on that front. I had to go hunting through the code base to find the real story 😉
Regarding custom fields, are you referring to https://developer.rocket.chat/reference/api/rest-api/endpoints/core-endpoints/channels-endpoints/setcustomfields ? (and similar for groups of course)
If so, it looks like that also supports finding the channel by ID or name (same as kick
and others). See https://github.com/RocketChat/Rocket.Chat/blob/404cfffe3fcee219579efce47ee0cab114162c69/apps/meteor/app/api/server/v1/channels.js#L692-L712
But yes, absolutely. PR's welcome!
Added:
Channel Kick API
Group Kick API
Specs are passing
Rubocop is passing
@abrom Since both API's do not allow
user#username
androom#name
, I'm sending it asnil
onuser_params
androom_params
respectively.