feat: allow specifying custom page size for course list api (#37815)
This commit is contained in:
@@ -15,6 +15,7 @@ from cms.djangoapps.contentstore.rest_api.v2.serializers import CourseHomeTabSer
|
||||
|
||||
class HomePageCoursesPaginator(PageNumberPagination):
|
||||
"""Custom paginator for the home page courses view version 2."""
|
||||
page_size_query_param = 'page_size'
|
||||
|
||||
def get_paginated_response(self, data):
|
||||
"""Return a paginated style `Response` object for the given output data."""
|
||||
@@ -77,6 +78,11 @@ class HomePageCoursesViewV2(APIView):
|
||||
apidocs.ParameterLocation.QUERY,
|
||||
description="Query param to paginate the courses",
|
||||
),
|
||||
apidocs.string_parameter(
|
||||
"page_size",
|
||||
apidocs.ParameterLocation.QUERY,
|
||||
description="Query param to set page size",
|
||||
),
|
||||
],
|
||||
responses={
|
||||
200: CourseHomeTabSerializerV2,
|
||||
@@ -96,6 +102,7 @@ class HomePageCoursesViewV2(APIView):
|
||||
GET /api/contentstore/v2/home/courses?active_only=true
|
||||
GET /api/contentstore/v2/home/courses?archived_only=true
|
||||
GET /api/contentstore/v2/home/courses?page=2
|
||||
GET /api/contentstore/v2/home/courses?page_size=20
|
||||
|
||||
**Response Values**
|
||||
|
||||
|
||||
Reference in New Issue
Block a user