mirror of
https://github.com/tubearchivist/tubearchivist-frontend.git
synced 2024-11-22 11:50:14 +00:00
add video list api view
This commit is contained in:
parent
0c8fa8f49e
commit
6f5969f520
@ -38,6 +38,9 @@ after successful login returns
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Video List View
|
||||||
|
/api/video/
|
||||||
|
|
||||||
## Video Item View
|
## Video Item View
|
||||||
/api/video/\<video_id>/
|
/api/video/\<video_id>/
|
||||||
|
|
||||||
|
@ -7,6 +7,7 @@ from api.views import (
|
|||||||
DownloadApiView,
|
DownloadApiView,
|
||||||
LoginApiView,
|
LoginApiView,
|
||||||
PlaylistApiView,
|
PlaylistApiView,
|
||||||
|
VideoApiListView,
|
||||||
VideoApiView,
|
VideoApiView,
|
||||||
VideoProgressView,
|
VideoProgressView,
|
||||||
)
|
)
|
||||||
@ -14,6 +15,11 @@ from django.urls import path
|
|||||||
|
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
path("login/", LoginApiView.as_view(), name="api-login"),
|
path("login/", LoginApiView.as_view(), name="api-login"),
|
||||||
|
path(
|
||||||
|
"video/",
|
||||||
|
VideoApiListView.as_view(),
|
||||||
|
name="api-video-list",
|
||||||
|
),
|
||||||
path(
|
path(
|
||||||
"video/<slug:video_id>/",
|
"video/<slug:video_id>/",
|
||||||
VideoApiView.as_view(),
|
VideoApiView.as_view(),
|
||||||
|
@ -89,6 +89,23 @@ class VideoApiView(ApiBaseView):
|
|||||||
return Response(self.response, status=self.status_code)
|
return Response(self.response, status=self.status_code)
|
||||||
|
|
||||||
|
|
||||||
|
class VideoApiListView(ApiBaseView):
|
||||||
|
"""resolves to /api/video/
|
||||||
|
GET: returns list of videos
|
||||||
|
"""
|
||||||
|
|
||||||
|
search_base = "ta_video/_search/"
|
||||||
|
|
||||||
|
def get(self, request):
|
||||||
|
# pylint: disable=unused-argument
|
||||||
|
"""get request"""
|
||||||
|
data = {"query": {"match_all": {}}}
|
||||||
|
self.get_document_list(data)
|
||||||
|
self.get_paginate()
|
||||||
|
|
||||||
|
return Response(self.response)
|
||||||
|
|
||||||
|
|
||||||
class VideoProgressView(ApiBaseView):
|
class VideoProgressView(ApiBaseView):
|
||||||
"""resolves to /api/video/<video_id>/
|
"""resolves to /api/video/<video_id>/
|
||||||
handle progress status for video
|
handle progress status for video
|
||||||
|
Loading…
Reference in New Issue
Block a user