JAMES-2411 Upgrade swagger documentation for MailRepository endpoints

Project: http://git-wip-us.apache.org/repos/asf/james-project/repo
Commit: http://git-wip-us.apache.org/repos/asf/james-project/commit/0d666522
Tree: http://git-wip-us.apache.org/repos/asf/james-project/tree/0d666522
Diff: http://git-wip-us.apache.org/repos/asf/james-project/diff/0d666522

Branch: refs/heads/master
Commit: 0d666522e08d17077ddb8309375dcf144c27954f
Parents: 4d3cda3
Author: Antoine Duprat <[email protected]>
Authored: Wed Jun 6 14:18:22 2018 +0200
Committer: benwa <[email protected]>
Committed: Tue Jun 12 07:00:46 2018 +0700

----------------------------------------------------------------------
 .../apache/james/webadmin/routes/MailRepositoriesRoutes.java   | 6 ++++--
 src/site/markdown/server/manage-webadmin.md                    | 6 ++++--
 2 files changed, 8 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/james-project/blob/0d666522/server/protocols/webadmin/webadmin-mailrepository/src/main/java/org/apache/james/webadmin/routes/MailRepositoriesRoutes.java
----------------------------------------------------------------------
diff --git 
a/server/protocols/webadmin/webadmin-mailrepository/src/main/java/org/apache/james/webadmin/routes/MailRepositoriesRoutes.java
 
b/server/protocols/webadmin/webadmin-mailrepository/src/main/java/org/apache/james/webadmin/routes/MailRepositoriesRoutes.java
index 2600812..83f035d 100644
--- 
a/server/protocols/webadmin/webadmin-mailrepository/src/main/java/org/apache/james/webadmin/routes/MailRepositoriesRoutes.java
+++ 
b/server/protocols/webadmin/webadmin-mailrepository/src/main/java/org/apache/james/webadmin/routes/MailRepositoriesRoutes.java
@@ -67,7 +67,7 @@ import spark.HaltException;
 import spark.Request;
 import spark.Service;
 
-@Api(tags = "MailRepositories")
+@Api(tags = "MailRepositories", consumes = "application/json")
 @Path("/mailRepositories")
 @Produces("application/json")
 public class MailRepositoriesRoutes implements Routes {
@@ -173,8 +173,10 @@ public class MailRepositoriesRoutes implements Routes {
             jsonTransformer);
     }
 
+    @GET
+    @Produces("application/json, message/rfc822")
     @Path("/{encodedUrl}/mails/{mailKey}")
-    @ApiOperation(value = "Retrieving a specific mail details")
+    @ApiOperation(value = "Retrieving a specific mail details (this endpoint 
can accept both \"application/json\" or \"message/rfc822\")")
     @ApiResponses(value = {
         @ApiResponse(code = HttpStatus.OK_200, message = "The list of all 
mails in a repository", response = List.class),
         @ApiResponse(code = HttpStatus.INTERNAL_SERVER_ERROR_500, message = 
"Internal server error - Something went bad on the server side."),

http://git-wip-us.apache.org/repos/asf/james-project/blob/0d666522/src/site/markdown/server/manage-webadmin.md
----------------------------------------------------------------------
diff --git a/src/site/markdown/server/manage-webadmin.md 
b/src/site/markdown/server/manage-webadmin.md
index 5dfc243..01d2022 100644
--- a/src/site/markdown/server/manage-webadmin.md
+++ b/src/site/markdown/server/manage-webadmin.md
@@ -1360,7 +1360,7 @@ Response codes:
  - 404: This repository can not be found
  - 500: Internal error
 
-### Reading a mail details
+### Reading/downloading a mail details
 
 ```
 curl -XGET 
http://ip:port/mailRepositories/encodedUrlOfTheRepository/mails/mailKey
@@ -1372,7 +1372,7 @@ Resource name `encodedUrlOfTheRepository` should be the 
resource id of an existi
 curl -XGET 
http://ip:port/mailRepositories/file%3A%2F%2Fvar%2Fmail%2Ferror%2F/mails/mail-key-1
 ```
 
-Response looks like:
+If the Accept header in the request is "application/json", then the response 
looks like:
 
 ```
 {
@@ -1383,6 +1383,8 @@ Response looks like:
     "error": "A small message explaining what happened to that mail..."
 }
 ```
+If the Accept header in the request is "message/rfc822", then the response 
will be the _eml_ file itself.
+
 
 Response codes:
 


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

Reply via email to