You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@james.apache.org by rc...@apache.org on 2021/08/06 03:19:35 UTC

[james-project] 04/04: JAMES-3621 Mailbox webadmin routes - Document - messageCount & unseenMessageCount

This is an automated email from the ASF dual-hosted git repository.

rcordier pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/james-project.git

commit 9327cd96a442751df83e1745ebd7ca75f9b5c2ea
Author: Tung TRAN <vt...@linagora.com>
AuthorDate: Mon Aug 2 18:04:32 2021 +0700

    JAMES-3621 Mailbox webadmin routes - Document - messageCount & unseenMessageCount
---
 .../pages/distributed/operate/webadmin.adoc        | 36 +++++++++++++++++++++
 .../james/webadmin/routes/UserMailboxesRoutes.java |  4 +--
 src/site/markdown/server/manage-webadmin.md        | 37 ++++++++++++++++++++++
 3 files changed, 75 insertions(+), 2 deletions(-)

diff --git a/docs/modules/servers/pages/distributed/operate/webadmin.adoc b/docs/modules/servers/pages/distributed/operate/webadmin.adoc
index 4674540..d7be9d1 100644
--- a/docs/modules/servers/pages/distributed/operate/webadmin.adoc
+++ b/docs/modules/servers/pages/distributed/operate/webadmin.adoc
@@ -1322,6 +1322,42 @@ Warning: While we have been trying to reduce the inconsistency window to
 a maximum (by keeping track of ongoing events), concurrent changes done
 during the reIndexing might be ignored.
 
+=== Counting emails
+
+....
+curl -XGET http://ip:port/users/{usernameToBeUsed}/mailboxes/{mailboxName}/messageCount
+....
+
+Will return the total count of messages within the mailbox of that user.
+
+Resource name `usernameToBeUsed` should be an existing user.
+
+Resource name `mailboxName` should not be empty, nor contain `% *` characters, nor starting with `#`.
+
+Response codes:
+
+* 200: The number of emails in a given mailbox
+* 400: Invalid mailbox name
+* 404: Invalid get on user mailboxes. The `usernameToBeUsed` or `mailboxName` does not exit'
+
+=== Counting unseen emails
+
+....
+curl -XGET http://ip:port/users/{usernameToBeUsed}/mailboxes/{mailboxName}/unseenMessageCount
+....
+
+Will return the total count of unseen messages within the mailbox of that user.
+
+Resource name `usernameToBeUsed` should be an existing user.
+
+Resource name `mailboxName` should not be empty, nor contain `% *` characters, nor starting with `#`.
+
+Response codes:
+
+* 200: The number of unseen emails in a given mailbox
+* 400: Invalid mailbox name
+* 404: Invalid get on user mailboxes. The `usernameToBeUsed` or `mailboxName` does not exit'
+
 === Subscribing a user to all of its mailboxes
 
 ....
diff --git a/server/protocols/webadmin/webadmin-mailbox/src/main/java/org/apache/james/webadmin/routes/UserMailboxesRoutes.java b/server/protocols/webadmin/webadmin-mailbox/src/main/java/org/apache/james/webadmin/routes/UserMailboxesRoutes.java
index a20ae30..092c2c6 100644
--- a/server/protocols/webadmin/webadmin-mailbox/src/main/java/org/apache/james/webadmin/routes/UserMailboxesRoutes.java
+++ b/server/protocols/webadmin/webadmin-mailbox/src/main/java/org/apache/james/webadmin/routes/UserMailboxesRoutes.java
@@ -358,7 +358,7 @@ public class UserMailboxesRoutes implements Routes {
     })
     @ApiOperation(value = "Counting emails in a given mailbox.")
     @ApiResponses(value = {
-        @ApiResponse(code = HttpStatus.OK_200, message = "The number emails in a given mailbox", response = Long.class),
+        @ApiResponse(code = HttpStatus.OK_200, message = "The number of emails in a given mailbox", response = Long.class),
         @ApiResponse(code = HttpStatus.BAD_REQUEST_400, message = "Invalid mailbox name"),
         @ApiResponse(code = HttpStatus.UNAUTHORIZED_401, message = "Unauthorized. The user is not authenticated on the platform"),
         @ApiResponse(code = HttpStatus.NOT_FOUND_404, message = "Invalid get on user mailboxes"),
@@ -396,7 +396,7 @@ public class UserMailboxesRoutes implements Routes {
     })
     @ApiOperation(value = "Counting unseen emails in a given mailbox.")
     @ApiResponses(value = {
-        @ApiResponse(code = HttpStatus.OK_200, message = "The number unseen emails in a given mailbox", response = Long.class),
+        @ApiResponse(code = HttpStatus.OK_200, message = "The number of unseen emails in a given mailbox", response = Long.class),
         @ApiResponse(code = HttpStatus.BAD_REQUEST_400, message = "Invalid mailbox name"),
         @ApiResponse(code = HttpStatus.UNAUTHORIZED_401, message = "Unauthorized. The user is not authenticated on the platform"),
         @ApiResponse(code = HttpStatus.NOT_FOUND_404, message = "Invalid get on user mailboxes"),
diff --git a/src/site/markdown/server/manage-webadmin.md b/src/site/markdown/server/manage-webadmin.md
index 00b69a5..936f82c 100644
--- a/src/site/markdown/server/manage-webadmin.md
+++ b/src/site/markdown/server/manage-webadmin.md
@@ -990,6 +990,8 @@ by an admin to ensure Cassandra message consistency.
  - [Exporting user mailboxes](#Exporting_user_mailboxes)
  - [ReIndexing a user mails](#ReIndexing_a_user_mails)
  - [Recomputing User JMAP fast message view projection](#Recomputing_User_JMAP_fast_message_view_projection)
+ - [Counting emails](#Counting_emails)
+ - [Counting unseen emails](#Couting_unseen_emails)
 
 ### Creating a mailbox
 
@@ -1167,6 +1169,41 @@ Warning: Canceling this task should be considered unsafe as it will leave the cu
 Warning: While we have been trying to reduce the inconsistency window to a maximum (by keeping track of ongoing events),
 concurrent changes done during the reIndexing might be ignored.
 
+### Counting emails
+
+```bash
+curl -XGET http://ip:port/users/{usernameToBeUsed}/mailboxes/{mailboxName}/messageCount
+```
+
+Will return the total count of messages within the mailbox of that user.
+
+Resource name `usernameToBeUsed` should be an existing user.    
+Resource name `mailboxName` should not be empty, nor contain `% *` characters, nor starting with `#`.
+
+Response codes:
+
+- 200: The number of emails in a given mailbox
+- 400: Invalid mailbox name
+- 404: Invalid get on user mailboxes. The `usernameToBeUsed` or `mailboxName` does not exit'
+
+### Counting unseen emails
+
+```bash
+curl -XGET http://ip:port/users/{usernameToBeUsed}/mailboxes/{mailboxName}/unseenMessageCount
+```
+
+Will return the total count of unseen messages within the mailbox of that user.
+
+Resource name `usernameToBeUsed` should be an existing user.    
+Resource name `mailboxName` should not be empty, nor contain `% *` characters, nor starting with `#`.
+
+Response codes:
+
+- 200: The number of unseen emails in a given mailbox
+- 400: Invalid mailbox name
+- 404: Invalid get on user mailboxes. The `usernameToBeUsed` or `mailboxName` does not exit'
+
+
 ### Subscribing a user to all of its mailboxes
  
 ```

---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org
For additional commands, e-mail: notifications-help@james.apache.org