-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #99 from OdyAsh/DB-and-API-Refactors
DB and API Refactors
- Loading branch information
Showing
19 changed files
with
925 additions
and
690 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
76 changes: 76 additions & 0 deletions
76
...structure_of_api_responses/ansari_website_api_structure_of_a_request_sent_using_zrok.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
{ | ||
"scope": { | ||
"type": "http", | ||
"asgi": { | ||
"version": "3.0", | ||
"spec_version": "2.4" | ||
}, | ||
"http_version": "1.1", | ||
"server": ["127.0.0.1", 8000], // When running locally | ||
"client": ["127.0.0.1", 11563], // The port here changes dynamically | ||
"scheme": "http", | ||
"method": "POST", | ||
"root_path": "", | ||
"path": "/api/v2/users/login", | ||
"raw_path": "/api/v2/users/login", | ||
"query_string": "", | ||
"headers": [ | ||
["host", "localhost:8000"], | ||
["connection", "keep-alive"], | ||
["content-length", "83"], | ||
["sec-ch-ua-platform", "\"Windows\""], | ||
["user-agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36"], | ||
["x-mobile-ansari", "ANSARI"], | ||
["sec-ch-ua", "\"Google Chrome\";v=\"131\", \"Chromium\";v=\"131\", \"Not_A Brand\";v=\"24\""], | ||
["content-type", "application/json"], | ||
["sec-ch-ua-mobile", "?0"], | ||
["accept", "*/*"], | ||
["origin", "http://localhost:3000"], | ||
["sec-fetch-site", "same-site"], | ||
["sec-fetch-mode", "cors"], | ||
["sec-fetch-dest", "empty"], | ||
["referer", "http://localhost:3000/"], | ||
["accept-encoding", "gzip, deflate, br, zstd"], | ||
["accept-language", "en-GB,en;q=0.9,ar-EG;q=0.8,ar;q=0.7,en-US;q=0.6"] | ||
], | ||
"state": {}, | ||
"app": "<fastapi.applications.FastAPI object>", | ||
"starlette.exception_handlers": { | ||
"<class 'starlette.exceptions.HTTPException'>": "<function http_exception_handler>", | ||
"<class 'starlette.exceptions.WebSocketException'>": "<bound method ExceptionMiddleware.websocket_exception>", | ||
"<class 'fastapi.exceptions.RequestValidationError'>": "<function request_validation_exception_handler>", | ||
"<class 'fastapi.exceptions.WebSocketRequestValidationError'>": "<function websocket_request_validation_exception_handler>" | ||
}, | ||
"router": "<fastapi.routing.APIRouter object>", | ||
"endpoint": "<function login_user>", | ||
"path_params": {}, | ||
"route": { | ||
"path": "/api/v2/users/login", | ||
"name": "login_user", | ||
"methods": ["POST"] | ||
} | ||
}, | ||
"_receive": "<bound method RequestResponseCycle.receive>", | ||
"_send": "<function wrap_app_handling_exceptions.<locals>.wrapped_app.<locals>.sender>", | ||
"_stream_consumed": true, | ||
"_is_disconnected": false, | ||
"_form": null, | ||
// _body's value (and other strings) were actually binary strings (i.e., start with b'...') | ||
"_body": "{\"email\":\"guest_<<AUTO_GENERATED_KEY>>@endeavorpal.com\",\"password\":\"<<PASSWORD_SENT_VIA_ANSARI_WEBSITE>>\",\"guest\":true}", | ||
// this is what actually gets returned when accessing headers property (e.g., `request.headers`) | ||
// Check Starlette's implementation (which FastAPI uses) for details: | ||
// https://github.com/encode/starlette/blob/b68a142a356ede730083347f254e1eae8b5c803e/starlette/requests.py#L12 | ||
"_headers": { | ||
"host": "localhost:8000", | ||
"connection": "...", | ||
"...": "..." | ||
// I.e., the value of the `_headers` key is a dictionary of the headers already mentioned above | ||
}, | ||
"_json": { | ||
"email": "guest_<<AUTO_GENERATED_KEY>>@endeavorpal.com", | ||
"...": ["..."] | ||
// I.e., the value of the `_json` key is simply the dictionary equivalent of `_body`'s string value | ||
}, | ||
"_query_params": "", | ||
"_cookies": {} | ||
} |
73 changes: 73 additions & 0 deletions
73
.../structure_of_api_responses/meta_whatsapp_api_structure_of_a_request_sent_using_zrok.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
{ | ||
"scope": { | ||
"type": "http", | ||
"asgi": { | ||
"version": "3.0", | ||
"spec_version": "2.4" | ||
}, | ||
"http_version": "1.1", | ||
"server": ["127.0.0.1", 8000], // When running locally | ||
"client": ["<<WHATSAPP.USER.IP>>", 0], | ||
"scheme": "https", | ||
"method": "POST", | ||
"root_path": "", | ||
"path": "/whatsapp/v1", | ||
"raw_path": "/whatsapp/v1", | ||
"query_string": "", | ||
"headers": [ | ||
["host", "YOUR_ZROK_SHARE_TOKEN.share.zrok.io"], | ||
["user-agent", "facebookexternalua"], | ||
["content-length", "545"], | ||
["accept", "*/*"], | ||
["accept-encoding", "deflate, gzip"], | ||
["content-type", "application/json"], | ||
["x-amzn-trace-id", "Root=1-674b2035-0f0a8ab27075asce3324dcdb"], // trace value here is fake | ||
["x-forwarded-for", "173.REST.OF.IP, <<WHATSAPP.USER.IP>>"], | ||
["x-forwarded-port", "443"], | ||
["x-forwarded-proto", "https"], | ||
["x-hub-signature", "sha1=8a3e35da6fb5dfaaf5aaa46c8d059d519e18112d"], // sha1 hash here is fake | ||
["x-hub-signature-256", "sha256=51d62480d40ffd0f48d1cde1ea47656452fd65b5ac29077fe3c6b4e68d74c827"], // sha256 here is fake | ||
["x-proxy", "zrok"] | ||
], | ||
"state": {}, | ||
"app": "<FastAPI object>", | ||
"starlette.exception_handlers": { | ||
"<class 'starlette.exceptions.HTTPException'>": "<function http_exception_handler>", | ||
"<class 'starlette.exceptions.WebSocketException'>": "<bound method ExceptionMiddleware.websocket_exception>", | ||
"<class 'fastapi.exceptions.RequestValidationError'>": "<function request_validation_exception_handler>", | ||
"<class 'fastapi.exceptions.WebSocketRequestValidationError'>": "<function websocket_request_validation_exception_handler>" | ||
}, | ||
"router": "<APIRouter object>", | ||
"endpoint": "<function main_webhook>", | ||
"path_params": {}, | ||
"route": { | ||
"path": "/whatsapp/v1", | ||
"name": "main_webhook", | ||
"methods": ["POST"] | ||
} | ||
}, | ||
"_receive": "<bound method RequestResponseCycle.receive>", | ||
"_send": "<function wrap_app_handling_exceptions.<locals>.wrapped_app.<locals>.sender>", | ||
"_stream_consumed": true, | ||
"_is_disconnected": false, | ||
"_form": null, | ||
"_query_params": "", | ||
// this is what actually gets returned when accessing headers property (e.g., `request.headers`) | ||
// Check Starlette's implementation (which FastAPI uses) for details: | ||
// https://github.com/encode/starlette/blob/b68a142a356ede730083347f254e1eae8b5c803e/starlette/requests.py#L125 | ||
"_headers": { | ||
"host": "...", | ||
"user-agent": "...", | ||
"...": "..." | ||
// I.e., the value of the `_headers` key is a dictionary of the headers already mentioned above | ||
}, | ||
"_cookies": {}, | ||
// _body's value (and other strings) were actually binary strings (i.e., start with b'...') | ||
// Also, it contains content mentioned in other `meta_whatsapp_*.json` files | ||
"_body": "{\"object\":\"whatsapp_business_account\", ...}", | ||
"_json": { | ||
"object": "whatsapp_business_account", | ||
"...": ["..."] | ||
// I.e., the value of the `_json` key is simply the dictionary equivalent of `_body`'s string value | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.