forked from openedx/edx-platform
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add api for help tokens (openedx#33073)
- Loading branch information
1 parent
6eba79a
commit b84d454
Showing
4 changed files
with
66 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
cms/djangoapps/contentstore/rest_api/v1/views/help_urls.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
""" API Views for help tokens """ | ||
|
||
from rest_framework.request import Request | ||
from rest_framework.response import Response | ||
from rest_framework.views import APIView | ||
from openedx.core.lib.api.view_utils import view_auth_classes | ||
|
||
from ....utils import get_help_urls | ||
|
||
|
||
@view_auth_classes(is_authenticated=True) | ||
class HelpUrlsView(APIView): | ||
""" | ||
View for getting all help urls. | ||
""" | ||
def get(self, request: Request): | ||
""" | ||
Get an help url. | ||
**Example Request** | ||
GET /api/contentstore/v1/help_urls | ||
**Response Values** | ||
If the request is successful, an HTTP 200 "OK" response is returned. | ||
The HTTP 200 response contains a single dict that contains keys for | ||
pages and locales | ||
**Example Response** | ||
```json | ||
{ | ||
"default": "http://edx.readthedocs.io/projects/.../index.html", | ||
"home": "http://edx.readthedocs.io/projects/.../CA_get_started_Studio.html", | ||
"develop_course": "http://edx.readthedocs.io/projects/.../developing_course/index.html", | ||
... | ||
} | ||
``` | ||
""" | ||
|
||
data = get_help_urls() | ||
return Response(data) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters