Skip to content

Commit

Permalink
Implement queue endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
Justin Campbell committed Jul 27, 2020
1 parent 07e85d5 commit ca9c4c2
Showing 1 changed file with 30 additions and 1 deletion.
31 changes: 30 additions & 1 deletion api/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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/<string:queue>/<int:number>")
api.add_resource(Queue, "/api/<string:queue>")



Expand Down

0 comments on commit ca9c4c2

Please sign in to comment.