-
Notifications
You must be signed in to change notification settings - Fork 9
Split Request module into multiple Request builder modules #78
Comments
Great suggestion, this is something I've thought about quite a bit in the past and this is definitely necessary given the size of the I'm not convinced by |
@inaniyants we could rename as follows:
And then go with a tree like this:
This would also be more consistent with what is being done in the Rust equivalent of this project. Thoughts? |
@niklaslong such renaming and tree looks good. This will greatly simplify life for library contributors. Example1:
Example2:
In the example above there are 2 problems:
So, we could:
Example3:
Example4:
Example5:
|
Thanks for listing all the options! Point taken on encouraging a convention and I agree this is important going forward. I think these will emerge fairly naturally as this split is undertaken and as more elements make their way into the library (response parsing, encryption, ...). The Elixir API guidelines also suggest preferring |
I'm new to this library so I'm missing lots of context so feel free to correct me. I'm planning to use this for the use-case I mentioned in #90. My initial thoughts are that the Rust SDK isn't very well done. We should reference more the JS SDK. The modules here roughly match the spec and is easier to follow. Another reference SDK can be aws-elixir. With these thoughts in mind, I propose the following structure:
Where the request module then would be only responsible for sending & parsing HTTP requests. Looking forward to your thoughts. Thanks again for the work on this! |
@kowsheek Agreed, and thank you for the references. I think a flatter structure would be beneficial. Generally all the trees thus far have looked fairly similar (minus some fairly superficial nesting), I think the main point is to undertake a split as the Another aspect relevant to this split I'd like to open for discussion is the how the requests are being built. I think the request module could probably just have a
I initially wrote the SDK with a deliberate seperation between the |
Yes, agreed! I'll work on a PR :) |
First of all I want to mention, that all coming next is just a suggestion, which could be modified or declined via discussion.
Right now Request module consists of 2500+ lines of code and docs. And this number will increase greatly in future, since in current state library does not support many existing client-server matrix endpoints.
But there are much more endpoints, except client-server
https://matrix.org/docs/spec/#id6
don't forget about administrative methods, which are not documented on matrix.org:
https://github.com/matrix-org/synapse/tree/master/docs/admin_api
So, it is better to keep
MatrixSDK.Client.Request
module clear and consist only from struct definition, common types definition , and some context methods, which are helping to build request (remove\add header, etc...).In order to build Request, I suggest to implement multiple modules (each for it's own concern), like:
ClientRequest, AdminRequest, etc.
ClientRequest
could be divided even more, like:ContentRequest, AccountRequest, RoomRequest, etc...
.Modules structure could be, like:
What do you think about this suggestion?
The text was updated successfully, but these errors were encountered: