openreplay/ee/api/routers/subs/v1_api_ee.py
Kraiem Taha Yassine 437fe9533b
Api v1.15.0 (#1580)
* fix(chalice): fixed public API
refactor(chalice): changed path logging
refactor(chalice): refactored public API
2023-10-27 14:35:16 +02:00

28 lines
1.1 KiB
Python

from fastapi import Depends, Body
import schemas
from chalicelib.utils import assist_helper
from or_dependencies import OR_context
from routers import core
from routers.base import get_routers
public_app, app, app_apikey = get_routers()
@app_apikey.get('/v1/assist/credentials', tags=["api"])
def get_assist_credentials():
credentials = assist_helper.get_temporary_credentials()
if "errors" in credentials:
return credentials
return {"data": credentials}
@app_apikey.get('/v1/{projectKey}/assist/sessions', tags=["api"])
def get_sessions_live(projectKey: str, userId: str = None, context: schemas.CurrentContext = Depends(OR_context)):
return core.get_sessions_live(projectId=context.project.project_id, userId=userId, context=context)
@app_apikey.post('/v1/{projectKey}/assist/sessions', tags=["api"])
def sessions_live(projectKey: str, data: schemas.LiveSessionsSearchPayloadSchema = Body(...),
context: schemas.CurrentContext = Depends(OR_context)):
return core.sessions_live(projectId=context.project.project_id, data=data, context=context)