RocketChat / Rocket.Chat.Flutter.SDK

Easily integrate Rocket.Chat into all your Flutter projects
MIT License
14 stars 4 forks source link

[to-do] add coverage of rest api #3

Open Sing-Li opened 1 year ago

Sing-Li commented 1 year ago

Add wrappers for common rest api to make them callable from flutter code.

Add tests and sample code for these APIs.

yatendra2001 commented 1 year ago

@Sing-Li Before starting to implement the code right away, I want to ask you a few questions to get a better understanding, which can assist me in delivering a high-quality implementation.

  1. Which specific REST API endpoints do you want me to prioritize when implementing the wrapper? (I can start with authentication, user management, and chat room management endpoints. Please let me know if you have other priorities.)
  2. Are there any specific conventions or style guidelines that you want me to follow when writing the code and tests? (I will follow the Dart style guide, adhere to the Effective Dart guidelines, and use a specific linter configuration. Please let me know your preferences.)
  3. Do you have any preferences or best practices regarding error handling and exception handling in the API wrapper? (I feel custom exception classes will work the best. Please let me know if there is any different approach you prefer. )
Sing-Li commented 1 year ago

Thanks @yatendra2001 ! That's a great question.

What I have seen worked very well is to:

  1. first have some non-trivial example app in mind
  2. cover all the APIs that will be used by that example app across REST, real-time and functional areas (for example auth)

Instead of casting the net wide (yet without useful context) horizontally. This is similar to "page faults in virtual memory management" - we can Fault-in each "group" of API with full usage context as we develop more and more example apps.

And meanwhile, other community members may decide to "fill in the holes" with our API coverage. FWIW

subhadeepchowdhury41 commented 1 year ago

Guys, I am having college exams till 4th May. Sorry for the late response. @Sing-Li do you think should me and @yatendra2001 work on the same issue?

yatendra2001 commented 1 year ago

@Sing-Li Thank you for the insightful advice! I understand the importance of focusing on the APIs that are relevant to specific example apps rather than attempting to cover every possible API without context. This approach will help us create a more practical and efficient API wrapper implementation.

Based on your suggestion, I have a non-trivial example app in mind, Here's a brief outline of the app features:

  1. User registration and authentication: Users can sign up and log in to the app using their email and password.
  2. User profile management: Users can view and update their profile information, such as username, display name, and avatar.
  3. Chat room creation: Users can create new public or private chat rooms.
  4. Chat room management: Users can join, leave, or invite others to chat rooms. They can also view the list of members in a chat room and manage user roles.
  5. Messaging: Users can send and receive messages in chat rooms, including text, images, and file attachments.
  6. Real-time updates: The app should display new messages and chat room updates in real-time.

This would give a good starting point to cover multiple aspects of the Rocket.Chat platform.

So should I start working on building API wrappers for the above 6 features?

Sing-Li commented 1 year ago

Spectacular! Please go right ahead and start the coverage. @yatendra2001

Only advice is to put some extra focus on 5 and 6. Especially when it comes to the different connectivity behaviors (mode) of all the platforms that Flutter supports.

For example, desktop is connect-for-a-few-hours and disconnects-for-a-few-hours; mobile is connect-disconnect-connect-disconnect-totally.no.connection-connect-disconnect ALL the time; browser is connect-on-new-instance on demand.

This will tease out a huge set of APIs (some possibly native and platform specific) that will be both in-context and essential to any users of the SDK to solve real-world messaging problems 🙏

Sing-Li commented 1 year ago

Guys, I am having college exams till 4th May. Sorry for the late response. @Sing-Li do you think should me and @yatendra2001 work on the same issue?

@subhadeepchowdhury41 please revisit the history of all issues here - including the closed ones. Read all the comments.

When you have time, do come back and see what issues are outstanding and help/contribute (here or on any other repositories in or outside of our ecosystem) Thanks.

raymondyegon commented 1 year ago

@Sing-Li Can I take up this task. I'm interested in doing this and want to see this package up and running.