Refactor Message methods to be nested resources under Channels
jpbullalayao opened this issue · 0 comments
jpbullalayao commented
We'd like to implement the following functionalities for Messages:
List messages in a channel
Send messages in a channel
View messages in a channel
Update messages in a channel
Delete messages in a channel
View message count in a channel
Right now, these are implemented with the following methods in api_resources/channel.py
:
channel.list_messages()
channel.send_text_message()
channel.view_message()
channel.update_text_message()
channel.delete_message()
channel.view_message_count()
While these work, I'd like to refactor the above method calls to use the following convention in the form of nested resources:
channel.messages.list()
channel.messages.send()
channel.messages.retrieve()
message.update()
message.delete()
channel.messages.count()
See Stripe nested resources implementation for reference: https://github.com/stripe/stripe-python/blob/master/stripe/api_resources/abstract/nested_resource_class_methods.py