Client
Client copied to clipboard
Make methods related to Channels and Messages more comfortable to use
Let me describe this simple scenario: I need to get messages from a group or channel. Currently I need to see what type of group I am in. E.g.
var peer = IdTools.FromTdToApi(chatId);
if (peer.Type == PeerType.Channel) {
// call *.CloudChatsApi.Channels.GetMessagesAsync(..)
} else if (peer.Type == PeerType.Group) {
// call *.CloudChatsApi.Messages.GetMessagesAsync(..)
} else {
// and so on
}
And the same thing with DeleteMessages, etc.
Maybe CatraProto should have this built-in to ease life of developers or have a separate .Extensions package?
I think this should be implemented by hiding the N "conflicting" methods from the end-user and creating a unique method. While most of the methods are automatically generated, I'd say this should be done manually as it requires human touch to choose how to structure and where to locate the API.
For this example, I think it would be nice to completely hide channels.GetMessages
and have both methods under the messages namespace as it sounds the least specialized between the two. Do you agree?
Sounds good, the same with DeleteMessages and similar methods