Skip to content

Commit

Permalink
Make Item resource return tuple w/ quueue JSON and HTTP return code p…
Browse files Browse the repository at this point in the history
…lus update docs
  • Loading branch information
Justin Campbell committed Nov 10, 2020
1 parent ba3c9b7 commit b75f3d7
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions api/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ def post(self) -> tuple:
200 (OK): On success.
401 (Unauthroized): When username or password are incorrect.
422 (Unprocessable Entitiy): When the username or password can't be parsed.
500 (Internal Server Error): On API error.
Example:
curl -X POST
Expand Down Expand Up @@ -100,9 +101,13 @@ def post(self):

class Item(Resource):
@jwt_required
def get(self, queue: str, number: int) -> str:
def get(self, queue: str, number: int) -> tuple:
"""Returns the JSON representation of the item requested.
Return Codes:
200 (OK): On success.
500 (Internal Server Error): On API error.
Example:
/api/ce/100 returns:
{
Expand All @@ -127,9 +132,9 @@ def get(self, queue: str, number: int) -> str:
item (int): The number of the item requested.
Returns:
str: JSON representation of the item requested.
tuple: Response containing queue as JSON and HTTP response code.
"""
return ECNQueue.Item(queue, number).toJson()
return (ECNQueue.Item(queue, number).toJson(), 200)

class Queue(Resource):
@jwt_required
Expand Down

0 comments on commit b75f3d7

Please sign in to comment.