From ca9c4c2d0e2087ad2d016771487ac35dfcb37517 Mon Sep 17 00:00:00 2001 From: Justin Campbell Date: Mon, 27 Jul 2020 11:27:42 -0400 Subject: [PATCH] Implement queue endpoint --- api/api.py | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/api/api.py b/api/api.py index 2ded269..bcb2eef 100644 --- a/api/api.py +++ b/api/api.py @@ -16,6 +16,22 @@ def get(self, queue: str, number: int) -> str: Example: /api/ce/100 returns: + { + "lastUpdated": "07-23-20 10:11 PM", + "headers": [...], + "content": [...], + "isLocked": "ce 100 is locked by knewell using qvi", + "userEmail": "campb303@purdue.edu", + "userName": "Justin Campbell", + "userAlias": "campb303", + "assignedTo": "campb303", + "subject": "Beepboop", + "status": "Dont Delete", + "priority": "", + "deparment": "", + "building": "", + "dateReceived": "Tue, 23 Jun 2020 13:25:51 -0400" + } Args: queue (str): The queue of the item requested. @@ -25,10 +41,23 @@ def get(self, queue: str, number: int) -> str: str: JSON representation of the item requested. """ return ECNQueue.Item(queue, number).toJson() - + +class Queue(Resource): + def get(self, queue: str) -> str: + """Returns the JSON representation of the queue requested. + + Args: + queue (str): The queue requested. + + Returns: + str: JSON representation of the queue requested. + """ + return ECNQueue.Queue(queue).toJson() + api.add_resource(Item, "/api//") +api.add_resource(Queue, "/api/")