Repository: Cloud-CV/EvalAI

Issue:
Add swagger api documentation for download_all_submissions API
### Description

Hosts can use EvalAI APIs to download all submission details. The download all submissions API documentation is missing documentation on EvalAI [docs](http://eval.ai/api/docs/).


### Deliverables
Add documentation for using `download_all_submissions` API using swagger. An example of using swagger for API documentation is available [here](https://github.com/Cloud-CV/EvalAI/blob/master/apps/jobs/views.py#L87). The documentation should provide a list of query and header params described briefly and an example.
Add swagger api documentation for download_all_submissions API
### Description

Hosts can use EvalAI APIs to download all submission details. The download all submissions API documentation is missing documentation on EvalAI [docs](http://eval.ai/api/docs/).


### Deliverables
Add documentation for using `download_all_submissions` API using swagger. An example of using swagger for API documentation is available [here](https://github.com/Cloud-CV/EvalAI/blob/master/apps/jobs/views.py#L87). The documentation should provide a list of query and header params described briefly and an example.


Discussion:
I am new to open source contribution, Can I help to resolve the issue.
I used swagger and know how it works.
Can you assign an issue?
@mukul20-21 sure, you can work on the issue.
Hello sir, I am Nikhilesh I have  experience in writing swagger documentation for two REST api's I created.Can I work on this issue if its still open?
@Ram81 , Seems like nobody is working on this issue, Could you please assign it to me.
I am new to open source contribution, Can I help to resolve the issue.
I used swagger and know how it works.
Can you assign an issue?
@mukul20-21 sure, you can work on the issue.
Hello sir, I am Nikhilesh I have  experience in writing swagger documentation for two REST api's I created.Can I work on this issue if its still open?
@Ram81 , Seems like nobody is working on this issue, Could you please assign it to me.

Resolving patch:
diff --git a/apps/challenges/views.py b/apps/challenges/views.py
--- a/apps/challenges/views.py
+++ b/apps/challenges/views.py
@@ -1740,6 +1740,78 @@ def get_all_submissions_of_challenge(
         return Response(response_data, status=status.HTTP_400_BAD_REQUEST)
 
 
+@swagger_auto_schema(
+    methods=["get"],
+    manual_parameters=[
+        openapi.Parameter(
+            name="challenge_pk",
+            in_=openapi.IN_PATH,
+            type=openapi.TYPE_NUMBER,
+            description="Challenge pk",
+            required=True,
+        ),
+        openapi.Parameter(
+            name="challenge_phase_pk",
+            in_=openapi.IN_PATH,
+            type=openapi.TYPE_NUMBER,
+            description="Challenge phase pk",
+            required=True,
+        ),
+        openapi.Parameter(
+            name="file_type",
+            in_=openapi.IN_PATH,
+            type=openapi.TYPE_STRING,
+            description="File type",
+            required=True,
+        ),
+    ],
+    operation_id="download_all_submissions",
+    responses={
+        status.HTTP_200_OK: openapi.Response(""),
+        status.HTTP_400_BAD_REQUEST: openapi.Response(
+            "{'error': 'The file type requested is not valid!'}"
+        ),
+        status.HTTP_404_NOT_FOUND: openapi.Response(
+            "{'error': 'Challenge Phase does not exist'}"
+        )
+    },
+)
+@swagger_auto_schema(
+    methods=["post"],
+    manual_parameters=[
+        openapi.Parameter(
+            name="challenge_pk",
+            in_=openapi.IN_PATH,
+            type=openapi.TYPE_NUMBER,
+            description="Challenge pk",
+            required=True,
+        ),
+        openapi.Parameter(
+            name="challenge_phase_pk",
+            in_=openapi.IN_PATH,
+            type=openapi.TYPE_NUMBER,
+            description="Challenge phase pk",
+            required=True,
+        ),
+        openapi.Parameter(
+            name="file_type",
+            in_=openapi.IN_PATH,
+            type=openapi.TYPE_STRING,
+            description="File type",
+            required=True,
+        ),
+    ],
+    operation_id="download_all_submissions",
+    responses={
+        status.HTTP_200_OK: openapi.Response(""),
+        status.HTTP_400_BAD_REQUEST: openapi.Response(
+            "{'error': 'The file type requested is not valid!'}"
+        ),
+        status.HTTP_401_UNAUTHORIZED: openapi.Response(
+            "{'error': 'Sorry, you do not belong to this Host Team!'}"
+        )
+    },
+)
 @api_view(["GET", "POST"])
 @throttle_classes([UserRateThrottle])
 @permission_classes((permissions.IsAuthenticated, HasVerifiedEmail))
@@ -1747,7 +1819,18 @@ def get_all_submissions_of_challenge(
 def download_all_submissions(
     request, challenge_pk, challenge_phase_pk, file_type
 ):
+    """
+    API endpoint to download all the submissions for a particular challenge as a csv
+
+    Arguments:
+        request {HttpRequest} -- The request object
+        challenge_pk {[int]} -- Challenge primary key
+        challenge_phase_pk {[int]} -- Challenge phase primary key
+        file_type {[str]} -- File type
 
+    Returns:
+        Response Object -- An object containing api response
+    """
     # To check for the corresponding challenge from challenge_pk.
     challenge = get_challenge_model(challenge_pk)
 


Test patch: