-
Notifications
You must be signed in to change notification settings - Fork 17
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
Separate low and high level API #46
Comments
I would maybe put it the other way around?
|
We should make it clear that several calls could be made and highLevel is IMO a nice way to depict that. |
Well, it might be better to do it like this if:
I would do it the other way if:
Ok, so we could keep the structure or change it (for the high level one) to remove the unused property ( |
Could you elaborate on benefits of that separation? Is it purely for OpenPaaS? Because at the moment I look at it and don't clearly understand what does it mean. |
Hello @jeserkin, This library so far maps directly JMAP calls (which could be seen as low level). However, there is a couple of higher level primitives that could be used to build a mail user agent, are generic, but might be slightly opinionated. #45 is one of them. Also, rather than writing a generic back-reference mechanism (an API doing some kind of data validation would be hard to do), we are thinking about writing some higher level functions in the client. Like "list the mails in the INBOX", "mark all mails as read", "clear the trash" - common utilities that lib users can rely on, or not. Lower level primitives would still here if need be. JMAP clients in the Android space tend to do the distinction (https://github.com/iNPUTmice/jmap jmap-client VS jmap-mua). Hence the idea of low level VS high level client. Does it helps? Cheers, Benoit |
Same as @jeserkin , how do you define here what is high and low level? What is your context around it? |
@chibenwa I see. So basically if at the moment I have something like this from(this.fetchSession())
.pipe(
mergeMap(session => from(this.jmapClient.mailbox_get({
accountId: Object.keys(session.accounts)[0],
ids: null
})))
); then it would change into something more like this This is nice, but based on your discussion I would suggest following structure. By default you offer Higher Level API as const lowLevelClient = this.jmapClient.getLowLevelClient(); // This will either create or if lowLevel API is already used under the hood, then just return it
from(this.fetchSession())
.pipe(
mergeMap(session => from(lowLevelClient.mailbox_get({
accountId: Object.keys(session.accounts)[0],
ids: null
})))
); |
I agree with @jeserkin remark, that is fine for me. (the most important thing IMO is to have a clear separation beteen both) |
Mhm. I would also like to have single method for updating draft. |
Why do you need back references for updating a draft? You want to cary over information from the old draft to the new without specifying it in the request? To be honest, I think getting back references working on a typed manner on top of the lowLevel clients will be really challenging. I would support the idea that high level calls backed by backreferences are typed themselves, but could rely on raw JSON over the transport layer. An alternative to this might be to duplicate the properties the highLevel clients needs backreference support on, in order to have the
Ok this is your use case! Doing 2 API calls would solve it, at the price of more roundtrips... |
Can you create a new issue? I do not really see what you want to do with these methods, so I do not know if it is in the scope of the project, so we can discuss about it. |
Why?
To easily know which methods are low and high level.
How?
Separate files?
About mailbox_changes
Issue #45
What about the case of mailbox_changes to get changes until hasMoreChanges is false?
Is it low level because its response is the same, and it just mimics the simple
mailbox_changes
using the same data structure?Or is it high level because it does more than just making a simple JMAP request?
The text was updated successfully, but these errors were encountered: