Benoit Tellier created JAMES-3376:
-------------------------------------

             Summary: Implement Email/query - unlock single request INBOX 
content loading
                 Key: JAMES-3376
                 URL: https://issues.apache.org/jira/browse/JAMES-3376
             Project: James Server
          Issue Type: New Feature
          Components: JMAP
    Affects Versions: 3.6.0
            Reporter: Benoit Tellier
            Assignee: Antoine Duprat


# Why

Email query allows retrieving the mailboxId of (among others) the INBOX. It 
empowers a single request load for INBOX (woop)

## DOD

 - Write an integretion test loading, for the connected user, without using any 
provisioned id in the request, loads the 20 first mail previews in the INBOX 
mailbox.

(sentAt sorting, ascending, 30 last items)

## How

Implement the email query method in order to resolve mailbox by role (`role` 
filter condition). Any other role/filter should be ignored/

Write integretaion tests for this method. Don't forget to document the 
limitation.

`sortAsTree` and `filterAsTree` should not be supported. 

JsonPath resolution might also need in array resolution:

```
{
    "resultOf": "c1",
    "name": "Mailbox/query",
    "path": "list[0]"
}
```

## Example

Here is a single request example: 

```
{
  "using": [
    "urn:ietf:params:jmap:core",
    "urn:ietf:params:jmap:mail"],
  "methodCalls": [[
    "Mailbox/query",
    {
      "accountId": 
"29883977c13473ae7cb7678ef767cbfbaffc8a44a6e463d971d23a65c1dc4af6",
       "filter": {
           "role": "Inbox"
       }
    },
    "c1"]]
}
```

Would reply:

```
{
    "sessionState": "75128aab4b1b",
    "methodResponses": [[
            "Mailbox/query",
            {
                "accountId": 
"29883977c13473ae7cb7678ef767cbfbaffc8a44a6e463d971d23a65c1dc4af6",
                "queryState": "xyz",
                "canCalculateChanges": false,
                "position": 0,
                "limit": 256,
                "ids": ["zeifgzeyrgf"]
            },
            "c1"
        ]]
}
```

Here is an example query for full account loading :

```
{
  "using": ["urn:ietf:params:jmap:core", "urn:ietf:params:jmap:mail"],
  "methodCalls": [[
            "Mailbox/query",
            {
                "accountId": 
"29883977c13473ae7cb7678ef767cbfbaffc8a44a6e463d971d23a65c1dc4af6",
                "filter": {
                     "role": "Inbox"
                 }
            },
            "c1"
        ],[
             "Email/query",
             {
                "accountId": 
"29883977c13473ae7cb7678ef767cbfbaffc8a44a6e463d971d23a65c1dc4af6"
                 "filter" {
                      "#inMailbox": {
                           "resultOf":"c1",
                           "name":"Mailbox/query",
                           "path":"list[0]"
                     }
                 },
                 "sort" {
                     "property": "sentAt",
                     "isAscending": true
                 }
             },
           "c2"],[
              "Email/get",
             {
                  "accountId": 
"29883977c13473ae7cb7678ef767cbfbaffc8a44a6e463d971d23a65c1dc4af6",
                  "properties": ["id", "preview"],
                  "#ids": {
                      "resultOf":"c2",
                       "name":"Email/query",
                       "path":"list/*"
                   }
              },
            "c3"]
]
}
```



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to