Skip to content

Routes

routes.tvtime

TvTime Routes

Raises:

Type Description
HTTPException

Redis Connection Error

Returns:

Name Type Description
APIRouter

Router for tvtime routes

router = APIRouter(prefix='', tags=['tvtime'], responses={200: {'description': 'Success'}, 404: {'description': 'Not found/Redis Connection Error'}}) module-attribute

follow_show(user, show)

Source code in src/routes/tvtime.py
103
104
105
106
@router.put("/show", summary="Follow a show")
def follow_show(user: TVTimeUser, show: Show):
    response = {"message": "Not Impemented"}
    return JSONResponse(content=response, status_code=501)

get_all_data(username, tvtime_data_service)

Source code in src/routes/tvtime.py
45
46
47
48
49
50
51
52
53
54
@router.get("/all-data", summary="Get All Data")
def get_all_data(
    username: str, tvtime_data_service: Annotated[TVTimeDataService, Depends()]
):
    try:
        data = tvtime_data_service.get_all_data(username)
    except RedisConnectionError as exc:
        logger.error(exc)
        raise HTTPException(status_code=404, detail="Redis Connection Error") from exc
    return JSONResponse(content=data.dict(), status_code=200)

get_not_started_yet(username, tvtime_data_service)

Source code in src/routes/tvtime.py
81
82
83
84
85
86
87
88
89
90
@router.get("/not-started-yet", summary="Get Not Started Yet List")
def get_not_started_yet(
    username: str, tvtime_data_service: Annotated[TVTimeDataService, Depends()]
):
    try:
        response = tvtime_data_service.get_not_started_yet(username)
    except RedisConnectionError as exc:
        logger.error(exc)
        raise HTTPException(status_code=404, detail="Redis Connection Error") from exc
    return JSONResponse(content=response, status_code=200)

get_not_watched_for_while(username, tvtime_data_service)

Source code in src/routes/tvtime.py
69
70
71
72
73
74
75
76
77
78
@router.get("/not-watched-for-while", summary="Get Not Watched For While List")
def get_not_watched_for_while(
    username: str, tvtime_data_service: Annotated[TVTimeDataService, Depends()]
):
    try:
        response = tvtime_data_service.get_not_watched_for_while(username)
    except RedisConnectionError as exc:
        logger.error(exc)
        raise HTTPException(status_code=404, detail="Redis Connection Error") from exc
    return JSONResponse(content=response, status_code=200)

get_show(username, show, tvtime_data_service)

Source code in src/routes/tvtime.py
 93
 94
 95
 96
 97
 98
 99
100
@router.get("/show", summary="Get Show")
def get_show(
    username: str,
    show: Show,
    tvtime_data_service: Annotated[TVTimeDataService, Depends()],
):
    response = {"message": "Not Impemented"}
    return JSONResponse(content=response, status_code=501)

get_status(current_user, tvtime_data_service)

Source code in src/routes/tvtime.py
32
33
34
35
36
37
38
39
40
41
42
@router.get("/status", summary="Get Data Status")
def get_status(
    current_user: Annotated[UserOut, Depends(get_current_active_user)],
    tvtime_data_service: Annotated[TVTimeDataService, Depends()],
) -> JSONResponse:
    try:
        response = tvtime_data_service.get_status(current_user.username)
    except RedisConnectionError as exc:
        logger.error(exc)
        raise HTTPException(status_code=404, detail="Redis Connection Error") from exc
    return JSONResponse(content=response, status_code=200)

get_watch_next(username, tvtime_data_service)

Source code in src/routes/tvtime.py
57
58
59
60
61
62
63
64
65
66
@router.get("/watch-next", summary="Get Watch Next List")
def get_watch_next(
    username: str, tvtime_data_service: Annotated[TVTimeDataService, Depends()]
):
    try:
        response = tvtime_data_service.get_watch_next(username)
    except RedisConnectionError as exc:
        logger.error(exc)
        raise HTTPException(status_code=404, detail="Redis Connection Error") from exc
    return JSONResponse(content=response, status_code=200)

mark_episode_unwatched(user, episode, tvtime_data_service)

Source code in src/routes/tvtime.py
131
132
133
134
135
136
137
138
@router.delete("/episode", summary="Mark Episode UnWatched")
def mark_episode_unwatched(
    user: TVTimeUser,
    episode: Episode,
    tvtime_data_service: Annotated[TVTimeDataService, Depends()],
):
    response = {"message": "Not Impemented"}
    return JSONResponse(content=response, status_code=501)

mark_episode_watched(user, episode, tvtime_data_service)

Source code in src/routes/tvtime.py
121
122
123
124
125
126
127
128
@router.put("/episode", summary="Mark Episode Watched")
def mark_episode_watched(
    user: TVTimeUser,
    episode: Episode,
    tvtime_data_service: Annotated[TVTimeDataService, Depends()],
):
    response = {"message": "Not Impemented"}
    return JSONResponse(content=response, status_code=501)

mark_season_unwatched(user, season, tvtime_data_service)

Source code in src/routes/tvtime.py
151
152
153
154
155
156
157
158
@router.delete("/season", summary="Mark Season UnWatched")
def mark_season_unwatched(
    user: TVTimeUser,
    season: Season,
    tvtime_data_service: Annotated[TVTimeDataService, Depends()],
):
    response = {"message": "Not Impemented"}
    return JSONResponse(content=response, status_code=501)

mark_season_watched(user, season, tvtime_data_service)

Source code in src/routes/tvtime.py
141
142
143
144
145
146
147
148
@router.put("/season", summary="Mark Season Watched")
def mark_season_watched(
    user: TVTimeUser,
    season: Season,
    tvtime_data_service: Annotated[TVTimeDataService, Depends()],
):
    response = {"message": "Not Impemented"}
    return JSONResponse(content=response, status_code=501)

mark_show_watched_until(user, show)

Source code in src/routes/tvtime.py
115
116
117
118
@router.put("/show/until", summary="Mark show as watched until a date")
def mark_show_watched_until(user: TVTimeUser, show: Show):
    response = {"message": "Not Impemented"}
    return JSONResponse(content=response, status_code=501)

unfollow_show(user, show)

Source code in src/routes/tvtime.py
109
110
111
112
@router.delete("/show", summary="Unfollow a show")
def unfollow_show(user: TVTimeUser, show: Show):
    response = {"message": "Not Impemented"}
    return JSONResponse(content=response, status_code=501)