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

Make methods related to Channels and Messages more comfortable to use #3

Open
luckyycode opened this issue Jul 15, 2022 · 2 comments
Open
Labels
feature-request New feature or request
Milestone

Comments

@luckyycode
Copy link

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?

@Aquathing
Copy link
Collaborator

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?

@luckyycode
Copy link
Author

Sounds good, the same with DeleteMessages and similar methods

@Aquathing Aquathing added the feature-request New feature or request label Jul 15, 2022
@Aquathing Aquathing added this to the v1.2 milestone Dec 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants