Added a /streams/now endpoint so that clients have access to server time

pull/105/head
Neeraj Kashyap 2021-08-21 11:52:48 -07:00
rodzic 2adedaf1fd
commit 036d1c169d
1 zmienionych plików z 6 dodań i 0 usunięć

Wyświetl plik

@ -2,6 +2,7 @@
The Moonstream subscriptions HTTP API The Moonstream subscriptions HTTP API
""" """
import logging import logging
import time
from typing import Dict, List, Optional from typing import Dict, List, Optional
from bugout.data import BugoutResource from bugout.data import BugoutResource
@ -87,6 +88,11 @@ def get_user_subscriptions(token: str) -> Dict[str, List[BugoutResource]]:
return user_subscriptions return user_subscriptions
@app.get("/now", tags=["streams"])
async def now_handler() -> int:
return int(time.time())
@app.get("/", tags=["streams"], response_model=data.GetEventsResponse) @app.get("/", tags=["streams"], response_model=data.GetEventsResponse)
async def stream_handler( async def stream_handler(
request: Request, request: Request,