kopia lustrzana https://github.com/bugout-dev/moonstream
Moved /streams/now -> /now
Response is now JSON object of the form: ```json { "epoch_time": 1629572206 } ``` It is not authenticated.pull/105/head
rodzic
036d1c169d
commit
6443ad3da5
|
@ -2,6 +2,7 @@
|
|||
The Moonstream HTTP API
|
||||
"""
|
||||
import logging
|
||||
import time
|
||||
|
||||
from fastapi import FastAPI, Form
|
||||
from fastapi.middleware.cors import CORSMiddleware
|
||||
|
@ -39,6 +40,11 @@ async def version_handler() -> data.VersionResponse:
|
|||
return data.VersionResponse(version=MOONSTREAM_VERSION)
|
||||
|
||||
|
||||
@app.get("/now", tags=["time"])
|
||||
async def now_handler() -> int:
|
||||
return data.NowResponse(epoch_time=int(time.time()))
|
||||
|
||||
|
||||
app.mount("/subscriptions", subscriptions_api)
|
||||
app.mount("/users", users_api)
|
||||
app.mount("/streams", streams_api)
|
||||
|
|
|
@ -52,6 +52,14 @@ class VersionResponse(BaseModel):
|
|||
version: str
|
||||
|
||||
|
||||
class NowResponse(BaseModel):
|
||||
"""
|
||||
Schema for responses on /now endpoint
|
||||
"""
|
||||
|
||||
epoch_time: int
|
||||
|
||||
|
||||
class SubscriptionUpdate(BaseModel):
|
||||
update: Dict[str, Any]
|
||||
drop_keys: List[str] = Field(default_factory=list)
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
The Moonstream subscriptions HTTP API
|
||||
"""
|
||||
import logging
|
||||
import time
|
||||
from typing import Dict, List, Optional
|
||||
|
||||
from bugout.data import BugoutResource
|
||||
|
@ -88,11 +87,6 @@ def get_user_subscriptions(token: str) -> Dict[str, List[BugoutResource]]:
|
|||
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)
|
||||
async def stream_handler(
|
||||
request: Request,
|
||||
|
|
Ładowanie…
Reference in New Issue