diff --git a/build/lib/rest_api_payload/__init__.py b/build/lib/rest_api_payload/__init__.py new file mode 100644 index 0000000..a51694c --- /dev/null +++ b/build/lib/rest_api_payload/__init__.py @@ -0,0 +1,38 @@ +def error_response(status, message): + """ + Custom error response + + Args: + status ([string]): [status message -> 404 not found, 500 server error, 400 bad request, etc] + message ([string]): [what error message do you want to show to the end user?] + + Returns: + [response]: [Returns a dictionary of status, and message] + """ + + payload = { + "status": status, + "message": message + } + return payload + + +def success_response(status, message, data): + """ + Custom success response + + Args: + status ([string]): [status message -> 201 created, 200 ok, 202 accepted, etc] + message ([string]): [what message do you want to show to the end user?] + data ([dict]): [serialized data from the server side] + + Returns: + [response]: [Returns a dictionary of status, message, data of whatever object that was serialized] + """ + + payload = { + "status": status, + "message": message, + "data": data + } + return payload diff --git a/dist/rest_api_payload-0.0.2-py3-none-any.whl b/dist/rest_api_payload-0.0.2-py3-none-any.whl new file mode 100644 index 0000000..c48b205 Binary files /dev/null and b/dist/rest_api_payload-0.0.2-py3-none-any.whl differ diff --git a/dist/rest_api_payload-0.0.2.tar.gz b/dist/rest_api_payload-0.0.2.tar.gz new file mode 100644 index 0000000..b523e2d Binary files /dev/null and b/dist/rest_api_payload-0.0.2.tar.gz differ diff --git a/rest_api_payload.egg-info/PKG-INFO b/rest_api_payload.egg-info/PKG-INFO index cb335f1..bd37d39 100644 --- a/rest_api_payload.egg-info/PKG-INFO +++ b/rest_api_payload.egg-info/PKG-INFO @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: rest-api-payload -Version: 0.0.1 +Version: 0.0.2 Summary: Industry ready custom API payload with an easy format for building Python APIs (Django/Django Rest Framework) Home-page: https://github.com/israelabraham/API-Payload Author: Abraham (Abram 🐼) Israel diff --git a/rest_api_payload.egg-info/SOURCES.txt b/rest_api_payload.egg-info/SOURCES.txt index da56332..245ac45 100644 --- a/rest_api_payload.egg-info/SOURCES.txt +++ b/rest_api_payload.egg-info/SOURCES.txt @@ -4,7 +4,6 @@ pyproject.toml setup.cfg setup.py rest_api_payload/__init__.py -rest_api_payload/rest_api_payload.py rest_api_payload.egg-info/PKG-INFO rest_api_payload.egg-info/SOURCES.txt rest_api_payload.egg-info/dependency_links.txt